Problem with landscape-oriented pdf
Problem with landscape-oriented pdf
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?
Is there a way to detect when the pdf is in landscape orientation so I can code a workaround for this?
Re: Problem with landscape-oriented pdf
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
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
Re: Problem with landscape-oriented pdf
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.
Re: Problem with landscape-oriented pdf
Actually I just checked, the render rotation is Rotate90FlipNone. But the page rotation is none and the view rotation is none.
Re: Problem with landscape-oriented pdf
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
May I ask you to share the file you are working with? It would help me a lot to better understand.
Thank you,
David
Re: Problem with landscape-oriented pdf
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
Re: Problem with landscape-oriented pdf
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
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
Re: Problem with landscape-oriented pdf
Thanks David. Please let me know when a fix for this is out.
Re: Problem with landscape-oriented pdf
Hi,
GdPicture.NET 12.0.35 has been released.
Regards,
David
GdPicture.NET 12.0.35 has been released.
Regards,
David
Re: Problem with landscape-oriented pdf
Thanks I'll give it a try and let you know how it works!
Who is online
Users browsing this forum: No registered users and 2 guests