Multipage PDF to PNG sometimes shows incomplete image

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

Moderators: XnTriq, helmut, xnview

Post Reply
Anja
Posts: 4
Joined: Tue Aug 08, 2017 1:03 pm

Multipage PDF to PNG sometimes shows incomplete image

Post by Anja »

Hi,
I seem to run in to an issue when converting a pdf file that has pages in both portrait and landscape orientation. All pages are converted as portrait, so some pages are cut off.
This is the command i usually use:
nconvert -dpi 300 -out png -merge_alpha -o outputpath\out.png -xall

Is there a way to get the orientation right for each page?

Thanks in advance
cday
XnThusiast
Posts: 3973
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Multipage PDF to PNG maintaining mixed page orientation

Post by cday »

Anja wrote:I seem to run in to an issue when converting a pdf file that has pages in both portrait and landscape orientation. All pages are converted as portrait, so some pages are cut off.
This is the command i usually use:

Code: Select all

nconvert  -dpi 300 -out png -merge_alpha -o outputpath\out.png -xall
Is there a way to get the orientation right for each page?
I don't have a problem using this code with the attached test file I created:

Code: Select all

nconvert -dpi 300 -out png -merge_alpha -o test.png -xall *.pdf
Can you upload a file that has the problem (2MiB maximum the current forum limit)?

PDF_Mixed_Orientation.pdf
(4.47 KiB) Downloaded 55 times
cday
XnThusiast
Posts: 3973
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Multipage PDF to PNG maintaining page orientations

Post by cday »

Further:

Which version of NConvert are you using, and which version of Ghostscript do you have installed?

NConvert 32-bit requires Ghostscript 32-bit installed (even on 64-bit operating systems...).

Nconvert 64-bit requires Ghostscript 64-bit installed.

I have a vague recollection of a report of a possibly similar problem to the one you describe several years ago, when the wrong version of Ghostscript was installed... :?:
Anja
Posts: 4
Joined: Tue Aug 08, 2017 1:03 pm

Re: Multipage PDF to PNG maintaining page orientations

Post by Anja »

https://send.firefox.com/download/f4875 ... 6V1s7Wx3MA

The file I have an issue with is just over the limit, I hope you can get it here.

I'm using the 32 bit version (v2.36) with Ghostscript 32 bit
cday
XnThusiast
Posts: 3973
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Multipage PDF to PNG maintaining page orientations

Post by cday »

I can reproduce, your file opens normally in Adobe Acrobat, but when the pages are extracted using an NConvert script, only the left-half of landscape orientation pages is displayed...

Googling the GS error displayed for some pages "ERROR: -101" produces this hit:

[gs-bugs] [Bug 695848] New: Ghostscript decode error when opening PDF

You might like to Google the error code yourself, as the above bug report was only tentative.

I may be able to have another look later in the day, but if anyone has a solution it will probably be XnTriq much later today... :wink:
User avatar
XnTriq
Moderator & Librarian
Posts: 6336
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Multipage PDF to PNG maintaining page orientations

Post by XnTriq »

cday wrote:I have a vague recollection of a report of a possibly similar problem to the one you describe several years ago, when the wrong version of Ghostscript was installed... :?:
I've found quite a few topics discussing the issue, …
… but as far ar I can tell, there's no solution.
Anja
Posts: 4
Joined: Tue Aug 08, 2017 1:03 pm

Re: Multipage PDF to PNG sometimes shows incomplete image

Post by Anja »

I seem to have run in to some other files which seem to suffer from the same issue.
In this case however, all the pages in the pdf do have the same orientation (landscape). When converting to png, the first one is ok, but all of the following pages are put in portrait, so almost half of the image is cut off. I'd add the file, but it's quite large.

So first one's a winner, get the file here:
https://send.firefox.com/download/4955b ... 9xwTTdZZTw

Out of curiosity, I let the Microsoft Print to PDF have a try. Opening the resulting pdf, no information is lost but all pages are rotated to portrait. Then converting that file works as it should.
Post Reply