Convert multiple PDF's to seperate Tiffs

Discussions on NConvert - the command line tool for image conversion and manipulation

Moderators: XnTriq, helmut, xnview

activefire
Posts: 2
Joined: Fri May 16, 2014 4:41 pm

Convert multiple PDF's to seperate Tiffs

Post by activefire »

Hey,

I'm trying to convert a folder of PDF's to Tiff's. But I'm stuck. This is the command line that I have: nconvert -o $\%.tif -out tiff -levels 130 180 -binary nodither -dpi 200 -xall -multi "C:\users\test\Desktop\PDFs\*" This will convert all PDF's to Tiffs, but will store all Tiffs in one tiff file, which I don't want.

Next, I have tried the same thing, but taking out the -multi, so my command line looks like this: nconvert -$\%.tif -out tiff -levels 130 180 -binary nodither -dpi 200 -xall "C:\users\test\PDFs\*" This correctly converts each PDF to Tiff, but all the TIffs are seperated into multiple files.
For example, let's say I had two PDF's, A.PDF and B.PDF and each PDF was two pages. Here is the output if I use the second command line
A.PDF
A-0.tif
A-1.tif
B.PDF
B-0.tif
B-1.tif

Which, I don't want. I would like A.tif to be a two page tiff.

Next, I tried getting rid of -xall and keeping -multi, so my command line looked like this: nconvert -o $\%.tif -out tiff -levels 130 180 -binary nodither -dpi 200 -multi "C:\users\test\Desktop\PDFs\*" My results are the same for the first command line.

So, how do I make it, so Nconvert will convert all Pdf's and make one tiff per pdf?

Thanks,

Activefire.
cday
XnThusiast
Posts: 3951
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Convert multiple PDF's to seperate Tiffs

Post by cday »

You want to convert an input folder containing multiple multi-page PDFs to an output folder containing multiple multiple-page TIFFs?

You will need -xall to extract the images in the input PDF files, and -multi to create the multi-page TIFF files, and I think you will have to use (for Windows) a cmd.exe ('DOS') FOR IN DO statement to process each input file separately. If you're not familiar with that, Google is a fantastic resource for coding.

I've done fairly similar operations in the past but I don't really have a suitable example to post now, and with my level of experience at the command line (I never expected to use it...) it would likely take me some time to come up with one...

Note that you can use the 'Code' facility to display your code more clearly, for example:

Code: Select all

nconvert -o $\%.tif -out tiff -levels 130 180 -binary nodither -dpi 200 -xall -multi "C:\users\test\Desktop\PDFs\*" 
Let us know how you get on!
activefire
Posts: 2
Joined: Fri May 16, 2014 4:41 pm

Re: Convert multiple PDF's to seperate Tiffs

Post by activefire »

You are correct with what I need to do.

I was thinking of doing a FOR loop in DOS, but I was hoping I could have avoided it.

The way I am getting around it now in C# is to do a for loop in the directory, then call nconvert.exe to convert each pdf, but that takes so long, so I was wondering if their was a way for nconvert to do it.
cday
XnThusiast
Posts: 3951
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Convert multiple PDF's to seperate Tiffs

Post by cday »

Also:

Be aware that there some limitations -- not clearly documented anywhere as far as I know -- on the use of spaces in paths when using NConvert on a Windows computer, at least when used in conjunction with wildcards. Ideally design your scripts to avoid all spaces, although some combinations of quoted filenames with spaces and wildcards do work. From memory, input file names containing both spaces and wildcards only seem to work when *unquoted*. [EDITED].

That's from hard experience, and I would welcome some clarification or further insight into this issue myself...
Last edited by cday on Fri May 16, 2014 9:46 pm, edited 1 time in total.
cday
XnThusiast
Posts: 3951
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Convert multiple PDF's to seperate Tiffs

Post by cday »

activefire wrote:The way I am getting around it now in C# is to do a for loop in the directory, then call nconvert.exe to convert each pdf, but that takes so long, so I was wondering if their was a way for nconvert to do it.
I'm fairly sure it can be done, and fairly simply with the correct syntax...