PDF to PNG issue

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

Moderators: XnTriq, helmut, xnview

Brainfreeze8
Posts: 5
Joined: Mon Feb 09, 2015 4:12 pm

PDF to PNG issue

Post by Brainfreeze8 »

Hey,

I use nconvert to convert PDF files to PNG images. I always use the command:

nconvert.exe -dpi 300 -out png -merge_alpha -o out.png -xall "file.pdf"

This used to work just fine. But now I have come across a pdf where only the first page converts fine and all the other pages generate a 1 KB sized file.
When I open this pdf (which looks just fine) and print it again as pdf, I get a new pdf file that is 5kb less in size and converts just fine with nconvert. What is going on here?
Is the original not a "valid" pdf for nconvert?

Pdf in question: https://www.dropbox.com/s/zjut7bmoafoie ... 6.pdf?dl=0

Here is part of the output I get from nconvert:
(I tried to look up what the error code -101 means but no success)

Code: Select all

GS: (C:\Program Files\gs\gs9.15\bin\gsdll64.dll)
ARG 0 -dNODISPLAY 
ARG 1 -dQUIET 
ARG 2 -sPDFname=14586.pdf 
ARG 3 -sDSCname=C:\Users\Pieter\AppData\Local\Temp\x_84B0.tmp 
ARG 4 pdf2dsc.ps 
ARG 5 -c quit 
==> 109 
ERROR: -101 
GS: (C:\Program Files\gs\gs9.15\bin\gsdll64.dll)
ARG 0 -dBATCH 
ARG 1 -dMaxBitmap=300000000 
ARG 2 -sDEVICE=tiff24nc 
ARG 3 -dFirstPage=1 
ARG 4 -dLastPage=1 
ARG 5 -q 
ARG 6 -dNOPAUSE 
ARG 7 -dSAFER 
ARG 8 -dTextAlphaBits=4 
ARG 9 -dGraphicsAlphaBits=4 
ARG 10 -g4962x3507 
ARG 11 -r300x300 
ARG 12 -sOutputFile=C:\Users\Pieter\AppData\Local\Temp\x_84E0.tmp 
ARG 13 14586.pdf 
ARG 14 -c quit 
ARG 15 -c quit 
==> 227 
GS>GS: (C:\Program Files\gs\gs9.15\bin\gsdll64.dll)
ARG 0 -dNODISPLAY 
ARG 1 -dQUIET 
ARG 2 -sPDFname=14586.pdf 
ARG 3 -sDSCname=C:\Users\Pieter\AppData\Local\Temp\x_883B.tmp 
ARG 4 pdf2dsc.ps 
ARG 5 -c quit 
==> 109 
ERROR: -101 
GS: (C:\Program Files\gs\gs9.15\bin\gsdll64.dll)
ARG 0 -dBATCH 
ARG 1 -dMaxBitmap=300000000 
ARG 2 -sDEVICE=tiff24nc 
ARG 3 -dFirstPage=2 
ARG 4 -dLastPage=2 
ARG 5 -q 
ARG 6 -dNOPAUSE 
ARG 7 -dSAFER 
ARG 8 -dTextAlphaBits=4 
ARG 9 -dGraphicsAlphaBits=4 
ARG 10 -g3x3 
ARG 11 -r300x300 
ARG 12 -sOutputFile=C:\Users\Pieter\AppData\Local\Temp\x_886A.tmp 
ARG 13 14586.pdf 
ARG 14 -c quit 
ARG 15 -c quit 
==> 221 
GS>GS: (C:\Program Files\gs\gs9.15\bin\gsdll64.dll)
ARG 0 -dNODISPLAY 
ARG 1 -dQUIET 
ARG 2 -sPDFname=14586.pdf 
ARG 3 -sDSCname=C:\Users\Pieter\AppData\Local\Temp\x_88E8.tmp 
ARG 4 pdf2dsc.ps 
ARG 5 -c quit 
==> 109 
ERROR: -101 
GS: (C:\Program Files\gs\gs9.15\bin\gsdll64.dll)
ARG 0 -dBATCH 
ARG 1 -dMaxBitmap=300000000 
ARG 2 -sDEVICE=tiff24nc 
ARG 3 -dFirstPage=3 
ARG 4 -dLastPage=3 
ARG 5 -q 
ARG 6 -dNOPAUSE 
ARG 7 -dSAFER 
ARG 8 -dTextAlphaBits=4 
ARG 9 -dGraphicsAlphaBits=4 
ARG 10 -g3x3 
ARG 11 -r300x300 
ARG 12 -sOutputFile=C:\Users\Pieter\AppData\Local\Temp\x_8928.tmp 
ARG 13 14586.pdf 
ARG 14 -c quit 
ARG 15 -c quit 
==> 221 
GS>GS: (C:\Program Files\gs\gs9.15\bin\gsdll64.dll)
ARG 0 -dNODISPLAY 
ARG 1 -dQUIET 
ARG 2 -sPDFname=14586.pdf 
ARG 3 -sDSCname=C:\Users\Pieter\AppData\Local\Temp\x_89B5.tmp 
ARG 4 pdf2dsc.ps 
ARG 5 -c quit 
==> 109 
ERROR: -101 
Thanks in advance for any responses.
User avatar
xnview
Author of XnView
Posts: 44885
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: PDF to PNG issue

Post by xnview »

yes ghostscript seems to have problem with this file...
Pierre.
Brainfreeze8
Posts: 5
Joined: Mon Feb 09, 2015 4:12 pm

Re: PDF to PNG issue

Post by Brainfreeze8 »

Ok, thanks! Too bad I already use the latest version of Ghostscript...
cday
XnThusiast
Posts: 4180
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: PDF to PNG issue

Post by cday »

Brainfreeze8 wrote:Ok, thanks! Too bad I already use the latest version of Ghostscript...
The file opens normally with Irfanview using Ghostscript, but not with XnViewMP using the same Ghostscript x32 version...

In XnViewMP pages after the first display as a small white rectangle 21 x 16px, accounting for the small file size of the NConvert-extracted files.

So possibly an XnView issue, at least maybe in terms of lower tolerance of a [possibly] malformed PDF file??

Regarding malformed PDF files, the following link may be of interest:

http://superuser.com/questions/773343/v ... -integrity
Brainfreeze8
Posts: 5
Joined: Mon Feb 09, 2015 4:12 pm

Re: PDF to PNG issue

Post by Brainfreeze8 »

Thanks for the reponse Cday. I tried several PDF analysis tools but none have flagged the PDF as damaged/corrupted in any way. The PDFs are processed on a server automaticaly so maybe I should look into a commandline tool to convert my PDF to a "better" PDF before I give it to nconvert.
User avatar
xnview
Author of XnView
Posts: 44885
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: PDF to PNG issue

Post by xnview »

ok, right a bug from XnView and not GS
Pierre.
Brainfreeze8
Posts: 5
Joined: Mon Feb 09, 2015 4:12 pm

Re: PDF to PNG issue

Post by Brainfreeze8 »

Will this possibly be fixed in the future?
User avatar
xnview
Author of XnView
Posts: 44885
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: PDF to PNG issue

Post by xnview »

Brainfreeze8 wrote:Will this possibly be fixed in the future?
yes will be fixed
Pierre.
Brainfreeze8
Posts: 5
Joined: Mon Feb 09, 2015 4:12 pm

Re: PDF to PNG issue

Post by Brainfreeze8 »

I noticed there was an update for nconvert and the pdf I mentioned works now. Thanks a lot!