TIFF to PDF

R

revuesbio

Hello,

I'm looking for :
1/ the best method to convert tiff files to PDF.
2/ and I want to merge these pdf files.

thank you for your help
 
M

Marc 'BlackJack' Rintsch

revuesbio said:
I'm looking for :
1/ the best method to convert tiff files to PDF.
2/ and I want to merge these pdf files.

If it doesn't need to be done in pure Python I would use the
command line tools from libtiff: `tiffcp` to copy several tiffs into one
multipage tiff and `tiff2pdf` to convert it into PDF.

Ciao,
Marc 'BlackJack' Rintsch
 
R

revuesbio

I'm trying to use tifflib but i have some problems.
When i use direct command line like
"C:\Program Files\GnuWin32\bin\tiff2pdf.exe" -o C:\test.pdf C:
\test.TIF
the pdf file is ok.

but when i try to launch command line via python the pdf file doesn't
create.

import os
os.system('"C:\Program Files\GnuWin32\bin\tiff2pdf.exe" -o C:\test.pdf
C:\test.TIF')

where is the problem ?
 
R

revuesbio

I'm trying to use tifflib but i have some problems :

when i use direct command line :
"C:\Program Files\GnuWin32\bin\tiff2pdf.exe" -o C:\test.pdf C:
\test.TIF

the pdf is ok.

but when i try to launch command line via python the pdf file is not
created.
where is the problem ?
import os
os.system('"C:\Program Files\GnuWin32\bin\tiff2pdf.exe" -o C:\test.pdf
C:\test.TIF')

thank you
 
G

Gabriel Genellina

os.system('"C:\Program Files\GnuWin32\bin\tiff2pdf.exe" -o C:\test.pdf
C:\test.TIF')

\ is used as a escape character in strings.
Use either \\ or a raw string, that is:

os.system('"C:\\Program Files\\GnuWin32\\bin\\tiff2pdf.exe" -o
C:\\test.pdf C:\\test.TIF')
os.system(r'"C:\Program Files\GnuWin32\bin\tiff2pdf.exe" -o C:\test.pdf
C:\test.TIF')

(This should be added to the Python FAQ - the most related entry is about
raw strings ending in \)
 
R

revuesbio

\ is used as a escape character in strings.
Use either \\ or a raw string, that is:

os.system('"C:\\Program Files\\GnuWin32\\bin\\tiff2pdf.exe" -o
C:\\test.pdf C:\\test.TIF')
os.system(r'"C:\Program Files\GnuWin32\bin\tiff2pdf.exe" -o C:\test.pdf
C:\test.TIF')

(This should be added to the Python FAQ - the most related entry is about
raw strings ending in \)

Thank you very much,
all is ok!
 
B

Brian van den Broek

Gabriel Genellina said unto the world upon 05/21/2007 07:01 AM:
\ is used as a escape character in strings.
Use either \\ or a raw string, that is:

os.system('"C:\\Program Files\\GnuWin32\\bin\\tiff2pdf.exe" -o
C:\\test.pdf C:\\test.TIF')
os.system(r'"C:\Program Files\GnuWin32\bin\tiff2pdf.exe" -o C:\test.pdf
C:\test.TIF')

(This should be added to the Python FAQ - the most related entry is about
raw strings ending in \)

Better still, use / as the path separator. That works fine on both
windows and *nixes.

Best,

Brian vdB
 
G

Gabriel Genellina

En Mon, 21 May 2007 10:53:08 -0300, Brian van den Broek
Gabriel Genellina said unto the world upon 05/21/2007 07:01 AM:
Better still, use / as the path separator. That works fine on both
windows and *nixes.

But unfortunately / does not always work, specially for arguments to
internal commands:

py> os.system("type c:/windows/win.ini")
La sintaxis del comando no es correcta. [invalid syntax]
1
py> os.system(r"type c:\windows\win.ini")
[Compatibility]
_3DPC=0x00400000
_BNOTES=0x224000
....
 
B

Brian van den Broek

Gabriel Genellina said unto the world upon 05/21/2007 10:12 AM:
En Mon, 21 May 2007 10:53:08 -0300, Brian van den Broek
Gabriel Genellina said unto the world upon 05/21/2007 07:01 AM:
Better still, use / as the path separator. That works fine on both
windows and *nixes.

But unfortunately / does not always work, specially for arguments to
internal commands:

py> os.system("type c:/windows/win.ini")
La sintaxis del comando no es correcta. [invalid syntax]
1
py> os.system(r"type c:\windows\win.ini")
[Compatibility]
_3DPC=0x00400000
_BNOTES=0x224000
...

Thanks for the catch then, Gabriel. Windows is but a bitter memory for
me, and / worked in every context in which I ever used it---I didn't
know that the support was only partial.

Best,

Brian vdB
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,124
Latest member
JuniorPell
Top