Convert multiple multipage TIFFs to multipage PDFs

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

Moderators: XnTriq, helmut, xnview

Post Reply
azon2111
Posts: 5
Joined: Sat Apr 21, 2018 2:32 pm

Convert multiple multipage TIFFs to multipage PDFs

Post by azon2111 »

Trying to get the syntax correct or understand what is wrong with my syntax so that I can fix it.

Trying to convert all tiff files in a directory to pdf files with 1 to 1 ratio. The TIff is multipage and pdf output should be multipage. The source and the destination are the same and permission for the folder is set to everyone full read/write access.

Code: Select all

nconvert -xall -quiet -multi -out pdf N:\ServerFolders\Company\FAXES\Incoming\*.tif
produces a pdf per page for each tiff file instead of combining those pages into one pdf file.

Thank you in advance for any help.
cday
XnThusiast
Posts: 3976
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Multipage Fax TIFF to same PDF

Post by cday »

At a quick look you probably need a -o term, and can set the required path and file name using the options in the Help file...

Could you please try that first, and report back if you don't get the result you need.
azon2111
Posts: 5
Joined: Sat Apr 21, 2018 2:32 pm

Re: Multipage Fax TIFF to same PDF

Post by azon2111 »

Tried adding the -o %.pdf but says cannot create file and it is still trying to produce 1 pdf per page in the tiff file.

Thank you.
azon2111
Posts: 5
Joined: Sat Apr 21, 2018 2:32 pm

Re: Multipage Fax TIFF to same PDF

Post by azon2111 »

And just for reference GhostScript is installed but do I need to place files into the XnView folder?

I used the windows installer for version 9.23 gs dot com site and not .edu as rerefenced in the format txt file.
azon2111
Posts: 5
Joined: Sat Apr 21, 2018 2:32 pm

Re: Multipage Fax TIFF to same PDF

Post by azon2111 »

Okay I got it working by specifying the output path and not just the file name.

What is now happening is with -xall it produces a single file per page pdf and without it only produces pdf's with the first page of a multipage tiff.
azon2111
Posts: 5
Joined: Sat Apr 21, 2018 2:32 pm

Re: Multipage Fax TIFF to same PDF

Post by azon2111 »

I feel I am f=very close but cannot figure out now each file is its own pdf and not combining into a single pdf for multiple tif files

Code: Select all

nconvert -quiet -multi -out pdf -c 1 -o PATH-TO-OUTPUT-FOLDER\%.pdf PATH-TO-INPUT-FOLDER\*.tif
Thank you for any help you can provide.
cday
XnThusiast
Posts: 3976
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Multipage Fax TIFF to same PDF

Post by cday »

azon2111 wrote: Sat Apr 21, 2018 3:07 pm And just for reference GhostScript is installed but do I need to place files into the XnView folder?

I used the windows installer for version 9.23 gs dot com site and not .edu as rerefenced in the format txt file.
GhostScript is only required to read PDF files, not to create them, so that is not a factor. It wouldn't normally be installed in the XnView/NConvert folder, rather in Program Files or Program Files (x86), as appropriate. It must be installed using the installer, otherwise NConvert can't find it. The NConvert and GhostScript x32 and x64 must also match.

You are using the right technique: lots of trial and error! :D

I'm firing up my Windows computer to see if I have an example of code that works...
cday
XnThusiast
Posts: 3976
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Multipage Fax TIFF to same PDF

Post by cday »

This tested code filed under M-TIFF_to_M-PDF was originally run as a batch file and using relative addressing, but you should be able to adapt it to your case:

Code: Select all

nconvert -out pdf -multi -o M-PDF.pdf M-TIFF.tif
So it looks as if -xall in your code is your immediate problem...

Edit:

To convert multiple TIFFs using *.tif I think you may need to use a FOR loop around the basic code, if you could get your code working for a single TIFF first, and then test whether it will also process multiple input TIFFs as it is...
cday
XnThusiast
Posts: 3976
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Multipage TIFF to multipage PDF

Post by cday »

azon2111 wrote: Sat Apr 21, 2018 2:44 pm Trying to convert all tiff files in a directory to pdf files with 1 to 1 ratio. The TIff is multipage and pdf output should be multipage. The source and the destination are the same and permission for the folder is set to everyone full read/write access.
Did you find a satisfactory solution?

I had a look at a For loop solution at the weekend, and after a false start I can now offer you the following outline code which seems to produce the desired result in my quick tests:

Code: Select all

FOR %A IN ("C:\Y\*.tif") DO nconvert -out pdf -multi -o "C:\Y\%.pdf" "%A" 
You would need to modify and elaborate that code as necessary, of course.

Replace % by %% everywhere when using the above code in a batch file .bat .

If you have an alternative solution please post it... :D
Post Reply