z4zz
z4zz

Reputation: 23

Converting several pdfs to tiffs with ghostscript in one call, and keep reference to originale file

I'm trying to convert several multipage pdfs to several single pages tiffs. I want to do it with one single command and perserve reference from single tiff to original pdf.

Now I'm using

gs -dNOPAUSE -dNoVerifyXref -sDEVICE=tiffg4 -r300 -dBATCH -sOutputFile=page-%d.tiff pdf1.pdf pdf2.pdf ... pdfn.pdf

with the resulting files

page-1.tiff, page-2.tiff ... page-m.tiff 

where m is the totalt number pages combined in all inputted pdfs.

What I want to achieve

Is it pssoible to update the command to instead get the resulting files:

[pdf name]_[pdf page].tiff

eg. pdf1_1.tiff pdf1_2.tiff pdf2_1.tiff, if pdf1 has two pages and pdf2 one page.

Or similar

Note. Don't want any script examples, just looking for Ghostscript command.

Upvotes: 2

Views: 1778

Answers (1)

KenS
KenS

Reputation: 31141

The Ghostscript devices (eg TIFF output) are independent of the input interpreter, because they are required to work with a number of different input languages (PDF, PostScript, XPS, PCL). As such, they are not aware of the fact that there are multiple input files, they simply see a stream of output to format up and deliver.

So no, you can't do that in a single invocation of GS. You can do it in a script by calling GS once for each input file but that is all.

Upvotes: 2

Related Questions