Evg
Evg

Reputation: 160

conversion from PDF to TIFF does not work

I want to convert my test.pdf file to test.tyff and save it in another folder. But unfortunately, both methods do not work, the program either freezes or simply does not produce anything

def transformPDFtoTIFF():
    pdfFile = r'C:\Users\MyOrder\test.pdf'
    tiffFile = r'C:\Users\NewOrder\test.tiff'
        os.system("gs -sDEVICE=tiffgray -r100 -q -sOutputFile= " + pdfFile + tiffFile )
        # os.system("gs -sDEVICE=tiffgray -r100 -q -o " + pdfFile + tiffFile )
)

Upvotes: 1

Views: 123

Answers (1)

K J
K J

Reputation: 11727

your current command is

os.system("gs -sDEVICE=tiffgray -r100 -q -sOutputFile= " + pdfFile + tiffFile )

The error messages you show in comments are normally powershell errors thus should not be in a standard windows console where gswin##c is expected to run !

NOTE:- GS is not the normal .exe for windows it is usually gswin32c.exe or gswin64c.exe so check which one works from your standard users windows cmd prompt.

As suggested check first at cmd> prompt that

gswin64c -sDEVICE=tiffgray -r100 -o"C:\Users\MyOrder\test.tif" "C:\Users\MyOrder\test.pdf"

works well, if it does not then check Ghostscript was installed correctly. You say you want tiff from pdf so the command sequence

-q -sOutputFile= " + pdfFile + tiffFile

should much simpler be -o" + tiffFile + " " + pdfFile + "

Upvotes: 1

Related Questions