Page 1 of 1
Tiff to PDF
Posted: Sat Jan 03, 2015 6:54 pm
by Marco Turco
Hi all,
I'm using the FWJPGTOPDF function to convert several jpg files in a single PDF file and it runs well.
I would like to know if there is a way to generate a PDF importing Tiff files.
Thank you in advance.
Re: Tiff to PDF
Posted: Sun Jan 04, 2015 5:45 am
by Antonio Linares
Marco,
You could convert the TIFF files to JPG files using the new FWH function GDIPlusConvertImage( cImageIni, cImageEnd ) and then use function FWJPGTOPDF()
Re: Tiff to PDF
Posted: Sun Jan 04, 2015 10:36 am
by mastintin
Antonio, Marco ...
New function for fwh ...
Code: Select all | Expand
function FWIMAGESTOPDF( aJpg, cPDF )
local i
local oPdf := FWPdf():New( cPDF )
local aFilesDelete:= {}
local cJpg
if ValType( aJpg ) != 'A'
aJpg := { aJpg }
endif
for i = 1 to len( aJpg )
cJpg := aJpg[i]
if Upper( cFileExt( cJpg ) ) != "JPG"
cJpg:= cFileSetExt( cJpg, "jpg" )
aadd( aFileDelete, cJpg )
GDIPlusConvertImage( aJpg[i], cJpg )
endif
oPdf:nPage++
oPdf:WritePage( MemoRead( cJpg ) )
next
oPdf:Close()
if len(aFilesDelete) > 0
AEval( aFilesDelete, { |cJpg| FErase( cJpg ) } )
endif
return cPDF
And proposed change for fwh code : ( Bye Bye freeImage)
Code: Select all | Expand
static function Emf2Jpeg( cEMF )
local cJpeg := cFileSetExt( cEMF, "jpg" )
local cBuf, lRet := .f.
GDIPlusConvertImage( cEMF, cJpeg )
cBuf := If( File( cJpeg ), MemoRead( cJpeg ), "" )
FErase( cJpeg )
return cBuf
Re: Tiff to PDF
Posted: Sun Jan 04, 2015 11:01 am
by nageswaragunupudi
Very Good Idea !!!
You might have worked with this change.
Any feedback about the quality and size ?
Re: Tiff to PDF
Posted: Sun Jan 04, 2015 11:56 am
by Antonio Linares
Manuel,
Great!

Re: Tiff to PDF
Posted: Sun Jan 04, 2015 2:05 pm
by Enrico Maria Giordano
mastintin wrote:And proposed change for fwh code : ( Bye Bye freeImage)

Great! But... what about IMAGE control?
EMG
Re: Tiff to PDF
Posted: Sun Jan 04, 2015 2:36 pm
by nageswaragunupudi
Enrico Maria Giordano wrote:mastintin wrote:And proposed change for fwh code : ( Bye Bye freeImage)

Great! But... what about IMAGE control?
EMG
We still need freeimage.dll in some cases like this.
It is better to reduce dependence on this dll in as many modules as we can.
Re: Tiff to PDF
Posted: Sun Jan 04, 2015 2:51 pm
by Enrico Maria Giordano
Rao,
nageswaragunupudi wrote:We still need freeimage.dll in some cases like this.
It is better to reduce dependence on this dll in as many modules as we can.
Any chance to drop freeimage for loading an image too?
EMG
Re: Tiff to PDF
Posted: Sun Jan 04, 2015 4:27 pm
by Antonio Linares
Enrico,
I just emailed Manuel Alvarez (Mastintin) to know if GDI+ provides us a function to load images from resources and we will be much closer to finally drop FreeImage.dll use

Re: Tiff to PDF
Posted: Sun Jan 04, 2015 5:20 pm
by mastintin
nageswaragunupudi wrote:Very Good Idea !!!
You might have worked with this change.
Any feedback about the quality and size ?
Size -> some as original
quality -> default 7 ...about 70% as original .

. Quality control not implemented yet (TODO LIST ).

Re: Tiff to PDF
Posted: Sun Jan 04, 2015 5:25 pm
by lucasdebeltran
Manuel,
Cual es tu email por favor?.
Gracias
Re: Tiff to PDF
Posted: Sun Jan 04, 2015 6:00 pm
by Enrico Maria Giordano
Antonio,
Antonio Linares wrote:I just emailed Manuel Alvarez (Mastintin) to know if GDI+ provides us a function to load images from resources and we will be much closer to finally drop FreeImage.dll use

Very good!
EMG
Re: Tiff to PDF
Posted: Sun Jan 04, 2015 7:45 pm
by nageswaragunupudi
We should be able to read not only from resources, but directly from any image file and memory and save to file also.
Re: Tiff to PDF
Posted: Sun Jan 04, 2015 7:49 pm
by nageswaragunupudi
Marco Turco wrote:Hi all,
I'm using the FWJPGTOPDF function to convert several jpg files in a single PDF file and it runs well.
I would like to know if there is a way to generate a PDF importing Tiff files.
Thank you in advance.
You can also consider using pdf libraries (contrib) of (x)Harbour. Using those libraries you can embed tiff, jpeg, png and bmp files into pdf.
We are not using these libraries for FWH because we like to restrict dependence on 3rd party libs.
Re: Tiff to PDF
Posted: Thu Aug 05, 2021 1:58 pm
by Horizon
Antonio Linares wrote:Marco,
You could convert the TIFF files to JPG files using the new FWH function GDIPlusConvertImage( cImageIni, cImageEnd ) and then use function FWJPGTOPDF()
Hi Antonio,
What about multipage tif files? It only converts first page to jpg file. Is there any workaround?
Thanks.