Page 1 of 1
My suggestions to HMG_HPDF
Posted: Thu Apr 23, 2015 12:43 pm
by Pablo César
Rathinagiri wrote:You have to add 'type JPG' for printing JPEG file types.
Actually this you can get from i_print.ch
Code: Select all
#xtranslate @ <nRow> , <nCol> PRINT IMAGE <cImage> ;
WIDTH <nWidth> ;
HEIGHT <nheight> ;
[ <stretch : STRETCH> ] ;
[ <transparent: TRANSPARENT> ] ;
[ TRANSPARENTCOLOR <aTransparentColor> ];
[ TYPE <cType:JPG,PNG> ] ;
=> ;
iif( _HMG_SYSDATA \[ 513 \],_HMG_HPDF_IMAGE ( <cImage> , <nRow> , <nCol> , <nheight> , <nWidth> , <.stretch.>, <"cType"> ), _HMG_PRINTER_H_IMAGE ( _HMG_SYSDATA \[ 374 \] , <cImage> , <nRow> , <nCol> , <nheight> , <nWidth> , <.stretch.> , <.transparent.> , <aTransparentColor> ) )
Type is not required for ordinary print. For PDF Print you need to mention the type.
Dear Rathi,
In order to avoid this kind of missing parameter, please considere following possibilities for correction and improvement of the code at
_HMG_HPDF_IMAGE function.
Where is
default cImageType := "PNG" could be replaced by:
Code: Select all
If cImageType == Nil
MsgStop("Missing Image Type!") // It could be added more one item in _HMG_HPDF_Error
Return Nil
Endif
Code: Select all
If cImageType == Nil
cImageType := cFileExt( cImage )
Endif
You can choose one of these above options.
B.Rgds
My suggestions to HMG_HPDF
Posted: Thu Apr 23, 2015 1:07 pm
by Pablo César
Rathinagiri wrote:I see that only images with color information about transparency are shown in HPDF.
If I enable this while saving the above image in GIMP, the image is shown in the PDF.

Very interesting, thank you Rathi for your tips.
Do you think this could it be warned by previous testing if image file has transparency ?
I saw this
fi_IsTransparent function in Harbour:

- Screen2.png (101.37 KiB) Viewed 4277 times
Probably it could helps if make some enhance in your code or with BosTaurus implementations.
Re: My suggestions to HMG_HPDF
Posted: Thu Apr 23, 2015 2:35 pm
by Rathinagiri
Yes. Good suggestions.
Also, we can check whether the cImageFilename contains .jpg and if it is there then we can default the image type to jpg. But if the image is from resources, then it won't have an extension.
My suggestions to HMG_HPDF
Posted: Thu Apr 23, 2015 3:07 pm
by Pablo César
Rathinagiri wrote:Also, we can check whether the cImageFilename contains .jpg and if it is there then we can default the image type to jpg. But if the image is from resources, then it won't have an extension.
I see, thank you Rathi to share your experience about.
I am study a bit more this case and what it can be done.
I'll revert soon as I have something to indicate.
My suggestions to HMG_HPDF
Posted: Thu Apr 23, 2015 8:59 pm
by Pablo César
Hi Rathi,
I've got succefully for this case of TYPEs image in h_HMG_HPDF.Prg

- Screen3.png (63.24 KiB) Viewed 4214 times
I've tested and works perfectly with file name without image TYPE at HPDFPRINT IMAGE and also thru resource definition.
I'm sure all of these FindResource, could be optimized for a generic function that it could be by array returning:
- nHandle
- cName
- cType
- cTrueName
But my C language knowledge is restricted and poor.
