Error in converted PDF

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

Moderators: XnTriq, xnview

Post Reply
punith8626
Posts: 48
Joined: Thu Feb 02, 2017 11:22 am

Error in converted PDF

Post by punith8626 »

HI ALL,

I have a png file and I am trying to convert to PDF using nconvert. The resultant file which is generated is not correct and its not opening.
Getting below Error when i open the PDF.

Code: Select all

There was an error processing a page. There was a problem reading this document(14).
Please find the attached png file for testing.

Here is the command I have used to convert the png to PDF.

Code: Select all

nconvert -out  pdf -multi -c 1 -overwrite -o C:\Users\test\Desktop\tiff\t\test.pdf C:\Users\test\Desktop\tiff\t\test.png
testimage.png
testimage.png (4.07 KiB) Viewed 1210 times
cday
XnThusiast
Posts: 2525
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Error in converted PDF

Post by cday »

For the PDF compression term please try:

Code: Select all

-out  pdf -c 1 

And for a single input file, the -multi term is not required and may be causing a problem, for multiple input files try placing term in another position in your code.
punith8626
Posts: 48
Joined: Thu Feb 02, 2017 11:22 am

Re: Error in converted PDF

Post by punith8626 »

cday wrote: Wed Feb 06, 2019 7:10 am For the PDF compression term please try:

Code: Select all

-out  pdf -c 1 

And for a single input file, the -multi term is not required and may be causing a problem, for multiple input files try placing term in another position in your code.
I tried with both ways and did not succeed.
Did you try to convert the file that I attached ?
cday
XnThusiast
Posts: 2525
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Error in converted PDF

Post by cday »

I can't easily test your code as I am on vacation and only have my laptop.

You tried removing the -multi term when using a single input file?

Your test PNG is 32-bit, possibly that is relevant?
cday
XnThusiast
Posts: 2525
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Error in converted PDF

Post by cday »

You are trying to save a 32-bit image as a 1-bit black and white image, please see this post which may be relevant.
punith8626
Posts: 48
Joined: Thu Feb 02, 2017 11:22 am

Re: Error in converted PDF

Post by punith8626 »

cday wrote: Wed Feb 06, 2019 7:50 am I can't easily test your code as I am on vacation and only have my laptop.

You tried removing the -multi term when using a single input file?

Your test PNG is 32-bit, possibly that is relevant?
Yes the test png is 32 bit depth.
I have used below command

Code: Select all

nconvert -out  pdf  -c 1 -overwrite -o C:\Users\test\Desktop\tiff\t\test.pdf C:\Users\test\Desktop\tiff\t\test.png
cday
XnThusiast
Posts: 2525
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Error in converted PDF

Post by cday »

punith8626 wrote: Wed Feb 06, 2019 8:51 am I have used below command

Code: Select all

nconvert -out  pdf  -c 1 -overwrite -o C:\Users\test\Desktop\tiff\t\test.pdf C:\Users\test\Desktop\tiff\t\test.png
Does it work?
punith8626
Posts: 48
Joined: Thu Feb 02, 2017 11:22 am

Re: Error in converted PDF

Post by punith8626 »

cday wrote: Wed Feb 06, 2019 8:58 am
punith8626 wrote: Wed Feb 06, 2019 8:51 am I have used below command

Code: Select all

nconvert -out  pdf  -c 1 -overwrite -o C:\Users\test\Desktop\tiff\t\test.pdf C:\Users\test\Desktop\tiff\t\test.png
Does it work?
No
cday
XnThusiast
Posts: 2525
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Error in converted PDF

Post by cday »

punith8626 wrote: Wed Feb 06, 2019 9:02 am
cday wrote: Wed Feb 06, 2019 8:58 am
punith8626 wrote: Wed Feb 06, 2019 8:51 am I have used below command

Code: Select all

nconvert -out  pdf  -c 1 -overwrite -o C:\Users\test\Desktop\tiff\t\test.pdf C:\Users\test\Desktop\tiff\t\test.png
Does it work?
No

Please try converting the input 32-bit file to black and white before saving to PDF with CCITT G4 compression, as in the link above...
punith8626
Posts: 48
Joined: Thu Feb 02, 2017 11:22 am

Re: Error in converted PDF

Post by punith8626 »

cday wrote: Wed Feb 06, 2019 9:09 am
punith8626 wrote: Wed Feb 06, 2019 9:02 am
cday wrote: Wed Feb 06, 2019 8:58 am

Does it work?
No

Please try converting the input 32-bit file to black and white before saving to PDF with CCITT G4 compression, as in the link above...
I have situation like this:
I have colored multi tiff image from that I need to convert perticular images to PDF.
Before I was having only black and white images and I was converting black and white multi tiff images to png and then i was generating PDF from that.

Now I have colored multi tiff but I am not able to convert to PDF
punith8626
Posts: 48
Joined: Thu Feb 02, 2017 11:22 am

Re: Error in converted PDF

Post by punith8626 »

punith8626 wrote: Wed Feb 06, 2019 9:21 am
cday wrote: Wed Feb 06, 2019 9:09 am
punith8626 wrote: Wed Feb 06, 2019 9:02 am
No

Please try converting the input 32-bit file to black and white before saving to PDF with CCITT G4 compression, as in the link above...
I have situation like this:
I have colored multi tiff image from that I need to convert perticular images to PDF.
Before I was having only black and white images and I was converting black and white multi tiff images to png and then i was generating PDF from that.

Now I have colored multi tiff but I am not able to convert to PDF
I tried with below command

Code: Select all

nconvert -out  pdf  -binary nodither -multi  -overwrite -o C:\Users\test\Desktop\tiff\t\test.pdf C:\Users\test\Desktop\tiff\t\*.png
I am able to convert to PDF but clarity is not good and I am getting only black and White.
cday
XnThusiast
Posts: 2525
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Error in converted PDF

Post by cday »

punith8626 wrote: Wed Feb 06, 2019 9:24 am I am able to convert to PDF but clarity is not good and I am getting only black and White.

The PDF compression option in your original code is CCITT G4, which is a black and white option.

If you wish to retain colour, use one of the compression options that support colour...

I'm not sure how retaining a 32-bit image, if you need to, might limit your choice of compression method, possibly not a factor?
Post Reply