Tiff to PDF

Post Reply
User avatar
Marco Turco
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London
Contact:

Tiff to PDF

Post 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.
Best Regards,

Marco Turco
SOFTWARE XP LLP
User avatar
Antonio Linares
Site Admin
Posts: 42508
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 30 times
Been thanked: 73 times
Contact:

Re: Tiff to PDF

Post 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()
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
mastintin
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Re: Tiff to PDF

Post 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) :D

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

 
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: Tiff to PDF

Post by nageswaragunupudi »

Very Good Idea !!!

You might have worked with this change.
Any feedback about the quality and size ?
Regards

G. N. Rao.
Hyderabad, India
User avatar
Antonio Linares
Site Admin
Posts: 42508
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 30 times
Been thanked: 73 times
Contact:

Re: Tiff to PDF

Post by Antonio Linares »

Manuel,

:shock:

Great! :D
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Enrico Maria Giordano
Posts: 8753
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 3 times
Contact:

Re: Tiff to PDF

Post by Enrico Maria Giordano »

mastintin wrote:And proposed change for fwh code : ( Bye Bye freeImage) :D


Great! But... what about IMAGE control?

EMG
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: Tiff to PDF

Post by nageswaragunupudi »

Enrico Maria Giordano wrote:
mastintin wrote:And proposed change for fwh code : ( Bye Bye freeImage) :D


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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Enrico Maria Giordano
Posts: 8753
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 3 times
Contact:

Re: Tiff to PDF

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 42508
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 30 times
Been thanked: 73 times
Contact:

Re: Tiff to PDF

Post 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 :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
mastintin
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Re: Tiff to PDF

Post 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 ). :)
User avatar
lucasdebeltran
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am
Contact:

Re: Tiff to PDF

Post by lucasdebeltran »

Manuel,

Cual es tu email por favor?.

Gracias
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
Enrico Maria Giordano
Posts: 8753
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 3 times
Contact:

Re: Tiff to PDF

Post 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
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: Tiff to PDF

Post 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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: Tiff to PDF

Post 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.
Regards

G. N. Rao.
Hyderabad, India
Horizon
Posts: 1323
Joined: Fri May 23, 2008 1:33 pm
Has thanked: 4 times

Re: Tiff to PDF

Post 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.
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Post Reply