Converting Multipage TIFF to PDF

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

Moderators: XnTriq, xnview

MYasin786
Posts: 2
Joined: Tue Mar 04, 2014 3:10 pm

Converting Multipage TIFF to PDF

Post by MYasin786 » Tue Mar 04, 2014 3:17 pm

Hi, I am trying to convert Multipage Tiff with different page sizes into PDF, I am able to do this bying Xnview application but not able to do as command line using Xconvert. I used the similar syntax to convert from PDF to TIFF which is working fine but i am unable to reverse the process, Please help.

"C:\Program files\XnView\NConvert.exe" -xall -multi -out pdf "C:\Temp2\Image2PDF-TEST\Janine\tiff-pdf.Tif"

MYasin786
Posts: 2
Joined: Tue Mar 04, 2014 3:10 pm

Re: Converting Multipage TIFF to PDF

Post by MYasin786 » Tue Mar 04, 2014 3:47 pm

I've managed to get it converting into multipage PDF by using the following command line

"C:\Program files\XnView\NConvert.exe" -xall -multi -out pdf -o "C:\Temp2\Image2PDF-TEST\Janine\tiff-pdf.pdf" "C:\Temp2\Image2PDF-TEST\Janine\tiff-pdf.Tif"


how can i improve the quality?

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

Re: Converting Multipage TIFF to PDF

Post by cday » Tue Mar 04, 2014 4:08 pm

MYasin786 wrote:I've managed to get it converting into multipage PDF by using the following command line ...

... how can i improve the quality?
The default Ghostscript dpi is 72, to set a higher value such as 300 please include the following term in your script:

-dpi 300

gintaras
Posts: 10
Joined: Wed Mar 25, 2015 9:45 am

Re: Converting Multipage TIFF to PDF

Post by gintaras » Wed Mar 25, 2015 10:07 am

I cannot manage to do the vice versa: I need to convert multipage PDF to a multipage TIFF. Used it like this:

nconvert -o $\%.tif -out tiff -dpi 200 -xall -multi ak_multi.pdf

I get ak_multi.tiff on the output but the file is singlepage with only the first page of original PDF...

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

Re: Converting Multipage TIFF to PDF

Post by cday » Wed Mar 25, 2015 11:24 am

You need to add this term to create a multipage output file:

Code: Select all

 -multi            : Create a multipage (TIFF/DCX/LDF only)
Note that creation of a multipage PDF output file isn't supported.

Do you have a listing of the full NConvert syntax?

Code: Select all

nconvert -help > nconvert_Help.txt

gintaras
Posts: 10
Joined: Wed Mar 25, 2015 9:45 am

Re: Converting Multipage TIFF to PDF

Post by gintaras » Wed Mar 25, 2015 1:19 pm

As I mentioned I'used -multi to no avail:

nconvert -o $\%.tif -out tiff -dpi 200 -xall -multi ak_multi.pdf

I only need to convert multipage PDF to multipage TIFF, not vice versa.

It seems that in above example either -multi, or -xall doesn't work.

gintaras
Posts: 10
Joined: Wed Mar 25, 2015 9:45 am

Re: Converting Multipage TIFF to PDF

Post by gintaras » Wed Mar 25, 2015 1:26 pm

My nconcert version is 6.70.

Tried -multi and -xall in different places but again- output TIFF is singlepaged although input PDF is two-page:

nconvert -o $\%.tif -out tiff -multi -xall ak_multi.pdf

In resulting TIFF file there's only the first page of corresponding PDF file.

User avatar
xnview
Author of XnView
Posts: 31372
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Converting Multipage TIFF to PDF

Post by xnview » Wed Mar 25, 2015 3:21 pm

gintaras wrote:My nconcert version is 6.70.

Tried -multi and -xall in different places but again- output TIFF is singlepaged although input PDF is two-page:

nconvert -o $\%.tif -out tiff -multi -xall ak_multi.pdf

In resulting TIFF file there's only the first page of corresponding PDF file.
Please send me your pdf?
Pierre.

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

Re: Converting Multipage TIFF to PDF

Post by cday » Wed Mar 25, 2015 3:33 pm

Sorry, I missed the fact that you already had the -multi term included. :(

The following code works for me in a quick test:

Code: Select all

nconvert -xall -dpi 200 -multi -out tiff -o Multi_TIFF.tif Multi_PDF.pdf
You will probably want to add an output compression option to the above code.

If the above code doesn't work for you, please send your PDF file to Pierre as above, or upload it here.

Note that I normally run my scripts as Windows batch files but I don't think that matters here.

Edit: Code revised to place -multi before -out tiff to avoid creation of a second, spurious output file.

gintaras
Posts: 10
Joined: Wed Mar 25, 2015 9:45 am

Re: Converting Multipage TIFF to PDF

Post by gintaras » Thu Mar 26, 2015 6:05 am

Thank you, Cday your example command. Tried it but again- the output TIFF is only with the first page of PDF.

I attach the PDF I tried to convert.
Attachments
2paged_exmpl.pdf
2-page PDF to convert to 2-page TIFF
(524.31 KiB) Downloaded 78 times

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

Re: Converting Multipage TIFF to PDF

Post by cday » Thu Mar 26, 2015 8:09 am

This code works for me:

Code: Select all

nconvert -xall -dpi 200 -multi -out tiff -c 8 -o 2paged_exmpl.tif 2paged_exmpl.pdf
I've added JPEG compression to reduce the output file size from 22.64MB to a size within the attachment limit.

If you can reproduce that maybe you can work from there...
2paged_exmpl.tif
(1.27 MiB) Downloaded 81 times
Edit: Which program are you using to view the output TIFF, I'm wondering if you may only be seeing the first page of a file that is actually multi-page?

User avatar
xnview
Author of XnView
Posts: 31372
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Converting Multipage TIFF to PDF

Post by xnview » Thu Mar 26, 2015 8:32 am

i've tried and the tiff output has 2 pages. Last version? on windows?
Pierre.

gintaras
Posts: 10
Joined: Wed Mar 25, 2015 9:45 am

Re: Converting Multipage TIFF to PDF

Post by gintaras » Thu Mar 26, 2015 8:36 am

I'm using Windows Photo Viewer.

Strangely enough, I can see with it that TIFF you've attached is two paged.

I tried your command with JPEG compression, the output still consisted just one page!

There must be something wrong with my nconvert.exe or my OS.

I downloaded 32 bit version NConvert-win.zip and using it on 64bit Windows7.

I'll try 64bit right away.

By the way, is this ok, that nconvert always returns some "my_error_exit..."?

D:\xNconvert\XnView>nconvert -xall -dpi 200 -multi -out tiff -c 8 -o 2paged_exmpl.tif 2paged_exmpl.pdf
** NCONVERT v6.70 (c) 1991-2015 Pierre-E Gougelet (Feb 18 2015/16:43:07) **
Version for Windows NT/9x/2000/Xp/Vista/7 (All rights reserved)
** This is freeware software (for non-commercial use)
my_error_exit...<Not a JPEG file: starts with 0x25 0x50>
JPEG load : 2480 3507
my_error_exit...<Not a JPEG file: starts with 0x25 0x50>
JPEG load : 2480 3507
Conversion of 2paged_exmpl.pdf into 2paged_exmpl.tif OK

gintaras
Posts: 10
Joined: Wed Mar 25, 2015 9:45 am

Re: Converting Multipage TIFF to PDF

Post by gintaras » Thu Mar 26, 2015 8:52 am

Just tried Windows 64bit version. Again, windows photo viewer shows only the first page:

D:\xNconvert\XnView64>nconvert -xall -dpi 200 -multi -out tiff -c 8 -o 2paged_exmpl.tif 2paged_exmpl.pdf
** NCONVERT v6.70 (c) 1991-2015 Pierre-E Gougelet (Feb 18 2015/16:46:22) **
Version for Windows Xp/Vista/7 x64 (All rights reserved)
** This is freeware software (for non-commercial use)

my_error_exit...<Not a JPEG file: starts with 0x25 0x50>
JPEG load : 2480 3507
my_error_exit...<Not a JPEG file: starts with 0x25 0x50>
JPEG load : 2480 3507
Conversion of 2paged_exmpl.pdf into 2paged_exmpl.tif OK

D:\xNconvert\XnView64>D:\xNconvert\XnView64\2paged_exmpl.tif

Produced file is 925424 bytes while the file you've sent me is 1331590 bytes,- that clearly shows that the problem is not my windows photo viewer.

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

Re: Converting Multipage TIFF to PDF

Post by cday » Thu Mar 26, 2015 9:07 am

I have retested with NConvert x32 6.70 on Windows 7 x64 without any problems, and I don't get the error message in your previous post.

The -c 8 term applies JPEG compression, but in general it would be better also add a -q term to set the quality value, as in -c 8 -q 80. The basic code would therefore become:

Code: Select all

nconvert -xall -dpi 200 -multi -out tiff -c 8 -q 80 -o 2paged_exmpl.tif 2paged_exmpl.pdf
The smaller output file size you obtained may possibly be due to a lower JPEQ quality setting somehow being applied.

The command line is very unforgiving of errors, but you seem to be using identical code...

Could you please upload the output file you are obtaining?

Post Reply