Get page rotation from current document  SOLVED

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

KarlTH
User
Posts: 57
Joined: Mon Aug 01, 2005 2:33 pm

Get page rotation from current document

Post by KarlTH »

Hello Tracker-Support,

I am using the rectangle annot to determine its coordinates (X, Y, Width, Height) to replace it with a signature field. This works fine except if the page has been rotated because all values are the other way around. :(

This is how I determine the coordinates of the rectangle annot in VB .NET:

Code: Select all

PDFXCViewer.DoDocumentVerb(_MainPresenter.Model.PDocID, "Pages[" + PDPage.ToString + "]", "GetAnnotRect", _oDataIn, _oDataOut, 0)
How can I detect if the page from the opened document has been rotated?

In PDF Structure, I can see this by the parameter /Rotate from the Mediabox but I do not know how I get this out with the PDF-XChange Viewer control.

Code: Select all

5 0 obj
<<
/Type /Page
/Annots [10 0 R 11 0 R]
/Parent 3 0 R
/Rotate -90
/Contents 12 0 R
/MediaBox [0 0 842 595]
/Resources 13 0 R
>>
endobj

Best regards,

Karl
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: Get page rotation from current document

Post by Vasyl - PDF-XChange »

Hi Karl.

Use:

Code: Select all

PDFXCViewer.GetDocumentProperty(_MainPresenter.Model.PDocID, "Pages[" + PDPage.ToString + "].Rotation", _oDataOut, 0);
int pageRotation = (int)_oDataOut;
HTH
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
KarlTH
User
Posts: 57
Joined: Mon Aug 01, 2005 2:33 pm

Re: Get page rotation from current document

Post by KarlTH »

Hi Vasyl,

yes that helps! It could be so easy if I would better read the SDK documentation! :)


Thank you so much,

Karl
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19868
Joined: Mon Jan 12, 2009 8:07 am

Re: Get page rotation from current document

Post by Stefan - PDF-XChange »

:)