Multipage PDF to PNG sometimes shows incomplete image

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

Moderators: XnTriq, xnview

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

Multipage PDF to PNG sometimes shows incomplete image

Postby Anja » Tue Aug 08, 2017 1:56 pm

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: 1561
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Multipage PDF to PNG maintaining mixed page orientation

Postby cday » Tue Aug 08, 2017 3:11 pm

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 7 times

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

Re: Multipage PDF to PNG maintaining page orientations

Postby cday » Wed Aug 09, 2017 7:54 am

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

Postby Anja » Wed Aug 09, 2017 8:29 am

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: 1561
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Multipage PDF to PNG maintaining page orientations

Postby cday » Wed Aug 09, 2017 8:50 am

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: 5088
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Multipage PDF to PNG maintaining page orientations

Postby XnTriq » Tue Aug 15, 2017 9:45 pm

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

Postby Anja » Tue Oct 03, 2017 9:19 am

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.


Return to “NConvert”

Who is online

Users browsing this forum: No registered users and 1 guest