Called from: => HB_HHASKEY( 0 )
Called from: .\source\classes\FWPDF.PRG => FWPDF:GETIMAGEFROMFILE( 732 )
Called from: .\source\classes\FWPDF.PRG => FWPDF:PRINTIMAGE( 796 )
Called from: => HB_HHASKEY( 0 )
Called from: .\source\classes\FWPDF.PRG => FWPDF:GETIMAGEFROMFILE( 732 )
Called from: .\source\classes\FWPDF.PRG => FWPDF:PRINTIMAGE( 796 )
You may use any image file name, image resource or image from web, hBitmap, or gdi+ pImage.
But not any objects.
If you have a bitmap object, you can use oBmp:hBitmap.
If you are creating a bitmap object only for the purpose of printing, that is totally an unnecessary step. You can save code buy directly specifying the original source of the image.
Same with fwpdf and printer class.
Mr. Nages, i have a fix height of the picture to print. I must set the width of print respecting the ratio. So i calculate it with nPic_x := int( nPic_y * (oImage:nWidth() / oImage:nHeight()) ) from the predefined picture. The parameter lStretch := .T. without a nWidth gives wrong results! (different in tprinter and fwpdf)
An other interesting effect is the print from transparent PNGs: In tPrinter gives in the preview exact transparent pictures but in the real print the transparence is lost. Printing the PDF-file from fwpdf is correct and transparent!
If the rectangle you specify (nrow, ncol, nwidth, nheight) is smaller than the size of the image, all our latest functions shrink the image to fit the rectangle, without losing aspect ratio.
You better let the FWH functions do it. They give good quality and we keep improving the quality.
You can reduce a lot of coding.
Also if you give the file name directly, lot of conversions will be avoided and you get better quality output.
About printing alpha images: Your printer needs to support alpha printing. Not all printers support.
Try the latest jet printers and you get this well. The limitation is the printer not fwh
HPDF_LoadPngImageFromFile
HPDF_LoadJpegImageFromFile
HPDF_LoadPngImageFromMem
HPDF_LoadJpegImageFromMem
HPDF_LoadRawImageFromMem1.png (1,006,696 bytes) --> 11.png (165,938 bytes)
3.png ( 86,227 bytes) --> 33.png ( 83,362 bytes)#include "fivewin.ch"
REQUEST FWHARU
function Main()
local oPrn, oFont, oPen, oBrush
local cPdfFile
local uImage
local nRow, nCol, nWidth, nHeight
local s1, s2
TPrinter():lUseHaruPDF := .t.
if MsgYesNo( "HaruPdf?" )
cPdfFile := "test.pdf"
endif
PRINT oPrn PREVIEW FILE cPdfFile
DEFINE FONT oFont NAME "ARIAL" SIZE 0,-20 OF oPrn
DEFINE PEN oPen WIDTH 1 OF oPrn
DEFINE BRUSH oBrush FILE "c:\fwh\bitmaps\backgrnd\browback.bmp"
PAGE
nWidth := nHeight := 2
nRow := 1
nCol := 0.75
uImage := "https://imagizer.imageshack.com/img923/1482/4FId0E.png"
oPrn:Box( nRow, nCol, nRow + nHeight, nCol + nWidth, oPen, nil, nil, "INCHES" )
@ nRow, nCol PRINT TO oPrn IMAGE uImage SIZE nWidth, nHeight INCHES
nCol += 0.5 + nWidth
uImage := "http://byte-one.com/2.png"
oPrn:Box( nRow, nCol, nRow + nHeight, nCol + nWidth, oPen, nil, nil, "INCHES" )
@ nRow, nCol PRINT TO oPrn IMAGE uImage SIZE nWidth, nHeight INCHES
nCol += 0.5 + nWidth
uImage := "https://imagizer.imageshack.com/img924/4041/WWsR34.png"
oPrn:Box( nRow, nCol, nRow + nHeight, nCol + nWidth, oPen, nil, nil, "INCHES" )
@ nRow, nCol PRINT TO oPrn IMAGE uImage SIZE nWidth, nHeight INCHES
nWidth := 6
nHeight := 3
nRow := 3.5
nCol := 1
uImage := "https://imagizer.imageshack.com/img923/1482/4FId0E.png"
oPrn:Box( nRow, nCol, nRow + nHeight, nCol + nWidth, oPen, oBrush, nil, "INCHES" )
@ nRow, nCol PRINT TO oPrn IMAGE uImage SIZE nWidth, nHeight INCHES
nWidth := 6
nHeight := 1
nRow := 7.0
nCol := 1
uImage := "https://imagizer.imageshack.com/img924/4041/WWsR34.png"
oPrn:Box( nRow, nCol, nRow + nHeight, nCol + nWidth, oPen, nil, nil, "INCHES" )
@ nRow, nCol PRINT TO oPrn IMAGE uImage SIZE nWidth, nHeight INCHES
ENDPAGE
ENDPRINT
RELEASE FONT oFont
RELEASE PEN oPen
RELEASE BRUSH oBrush
return nil
It is noticed that libharu.lib along with the present png.lig of (x)Harbour is unable to read some png files/buffers.
Temporarily, we modified the fwpdf.prg. Now png images are first read by FWH own functions, bypassing the libharu native functions and then create pdf images from the gdi+ image read by FWH.
With this change, fwpdf is able to read all the 3 images provided above.