Tiff to PDF

Tiff to PDF

Postby Marco Turco » Sat Jan 03, 2015 6:54 pm

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
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Re: Tiff to PDF

Postby Antonio Linares » Sun Jan 04, 2015 5:45 am

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
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Tiff to PDF

Postby mastintin » Sun Jan 04, 2015 10:36 am

Antonio, Marco ...
New function for fwh ...
Code: Select all  Expand view


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 view


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
mastintin
 
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Re: Tiff to PDF

Postby nageswaragunupudi » Sun Jan 04, 2015 11:01 am

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
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Tiff to PDF

Postby Antonio Linares » Sun Jan 04, 2015 11:56 am

Manuel,

:shock:

Great! :D
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Tiff to PDF

Postby Enrico Maria Giordano » Sun Jan 04, 2015 2:05 pm

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


Great! But... what about IMAGE control?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8315
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Tiff to PDF

Postby nageswaragunupudi » Sun Jan 04, 2015 2:36 pm

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
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Tiff to PDF

Postby Enrico Maria Giordano » Sun Jan 04, 2015 2:51 pm

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
Enrico Maria Giordano
 
Posts: 8315
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Tiff to PDF

Postby Antonio Linares » Sun Jan 04, 2015 4:27 pm

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
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Tiff to PDF

Postby mastintin » Sun Jan 04, 2015 5:20 pm

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
mastintin
 
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Re: Tiff to PDF

Postby lucasdebeltran » Sun Jan 04, 2015 5:25 pm

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
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: Tiff to PDF

Postby Enrico Maria Giordano » Sun Jan 04, 2015 6:00 pm

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
Enrico Maria Giordano
 
Posts: 8315
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Tiff to PDF

Postby nageswaragunupudi » Sun Jan 04, 2015 7:45 pm

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: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Tiff to PDF

Postby nageswaragunupudi » Sun Jan 04, 2015 7:49 pm

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
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Tiff to PDF

Postby Horizon » Thu Aug 05, 2021 1:58 pm

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
Horizon
 
Posts: 1288
Joined: Fri May 23, 2008 1:33 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 49 guests