Problem with landscape-oriented pdf

Discussions about image processing and document imaging.
Post Reply
drsneed
Posts: 6
Joined: Thu Sep 08, 2016 4:20 pm

Problem with landscape-oriented pdf

Post by drsneed » Thu Sep 08, 2016 4:28 pm

Hi I've encountered an issue that only seems to occur if a pdf is landscape-oriented. When retrieving the width and height with GdViewer.PagePixelWidth and GdViewer.PagePixelHeight, the values appear to be swapped (Height is larger than Width) even though the page is clearly wider than it is tall. GdViewer.GetRectCoordinatesOnDocumentPixel also returns swapped values. This completely ruins my cropping routine.

Is there a way to detect when the pdf is in landscape orientation so I can code a workaround for this?

David
Posts: 66
Joined: Mon Feb 08, 2016 3:12 pm

Re: Problem with landscape-oriented pdf

Post by David » Fri Sep 09, 2016 8:56 am

Hi,

Thank you for you interest in Orpalis technologies.

The GetPageRotation method retrieves the page rotation (clockwise), in degrees, of the current page of the PDF.

https://www.gdpicture.com/guides/gdpicture/web ... ation.html

Have you taken into consideration the value returned by this method within your croppping code?

In order to ease your life, I recommend to normalize the page before working with its coordinates. This will let you crop without taking into consideration orientation neither crop box.

Please see the NormalizePage method: https://www.gdpicture.com/guides/gdpicture/web ... ePage.html

Regards,

David

drsneed
Posts: 6
Joined: Thu Sep 08, 2016 4:20 pm

Re: Problem with landscape-oriented pdf

Post by drsneed » Fri Sep 09, 2016 6:31 pm

Thanks David. Normalizing the page definitely helped. Now I'm getting the correct width and height. However, I'm still getting swapped values when I call GdViewer1.GetRectCoordinatesOnDocumentPixel(ref left, ref top, ref width, ref height); Also, querying for the current rotation (before normalization) returns no rotation.

drsneed
Posts: 6
Joined: Thu Sep 08, 2016 4:20 pm

Re: Problem with landscape-oriented pdf

Post by drsneed » Fri Sep 09, 2016 7:04 pm

Actually I just checked, the render rotation is Rotate90FlipNone. But the page rotation is none and the view rotation is none.

David
Posts: 66
Joined: Mon Feb 08, 2016 3:12 pm

Re: Problem with landscape-oriented pdf

Post by David » Mon Sep 12, 2016 2:49 pm

Hi,

May I ask you to share the file you are working with? It would help me a lot to better understand.

Thank you,

David

drsneed
Posts: 6
Joined: Thu Sep 08, 2016 4:20 pm

Re: Problem with landscape-oriented pdf

Post by drsneed » Mon Sep 12, 2016 4:39 pm

Sure, here it is. The method GdViewer.GetRectCoordinatesOnDocumentPixel(ref left, ref top, ref width, ref height) returns swapped values.
Attachments
LandscapePdfIssue.zip
(156.67 KiB) Downloaded 374 times

David
Posts: 66
Joined: Mon Feb 08, 2016 3:12 pm

Re: Problem with landscape-oriented pdf

Post by David » Tue Sep 13, 2016 10:36 am

Hi,

It seems the NormalizePage method doesn't work properly with this particular PDF.

The development team is currently working on the topic. We are doing our best effort to include this fix within the next release, which should come in the coming days.

Regards,

David Ometto

drsneed
Posts: 6
Joined: Thu Sep 08, 2016 4:20 pm

Re: Problem with landscape-oriented pdf

Post by drsneed » Tue Sep 13, 2016 4:34 pm

Thanks David. Please let me know when a fix for this is out.

David
Posts: 66
Joined: Mon Feb 08, 2016 3:12 pm

Re: Problem with landscape-oriented pdf

Post by David » Fri Sep 16, 2016 9:24 am

Hi,

GdPicture.NET 12.0.35 has been released.

Regards,

David

drsneed
Posts: 6
Joined: Thu Sep 08, 2016 4:20 pm

Re: Problem with landscape-oriented pdf

Post by drsneed » Tue Sep 20, 2016 4:51 pm

Thanks I'll give it a try and let you know how it works!

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests