Reset PDF Page Rotation to 0

Q: We’ve noticed that some applications will generate PDF files with initial rotation values (in this case it’s the CutePDF print driver). When you open the PDF in Adobe, the orientation is correct (landscape), but there is a stored rotation value of 90. If we remove that value with CosEdit and reopen the PDF, it’s now rotated into portrait mode.

Is there any way to reset the rotation value of a page to 0 while maintaining the correct orientation?

I’ve attached a PDF which displays this behavior.

A:

As a solution you can call page.SetRotation(Page.Rotate.e_270), and rotate page media & crop box (similar to Rect sample - pdftron.com/pdfnet/samplecode.html#Rect) and also add a transform matrix that will rotate all page content. The last part is a bit more tricky… You can use ElementEdit approach (http://pdftron.com/pdfnet/samplecode.html#ElementEdit), where you adjust the transform on the initial element (you could surround all content with e_group_begin/end element; i.e q/Q). Perhaps a simpler approach is to approach shown in Imposition sample (http://pdftron.com/pdfnet/samplecode.html#Imposition))… where you place an existing page on another page (in your case that would be rotated page).