Menu

#12 Fix invalid cast in Page.Rotation.get()

0.1.2.1
closed-fixed
None
5
2015-04-28
2015-04-28
Brian Bolte
No

Similar to [BUG:67], occasionally a PDF will have the Rotation value as a PdfReal instead of the expected PdfInteger. This causes an InvalidCastException upon fetching the Rotation value.

To reproduce: load provided PDF and access file.Document.Pages[0].Rotation
To fix: Cast to IPdfNumber and change RotationEnumExtension to accept IPdfNumber as the first parameter, instead of PdfInteger.

Unsure if specifying rotation as a Real is technically allowed by the spec.

Have not looked into Java side of the code for this, but I would expect it to have a similar bug and fix.

Patch file attached.

2 Attachments

Discussion

  • Stefano Chizzolini

    Your sample's notation is abusive because page rotation should be expressed as an integer multiple of 90; nonetheless, in accordance with viewers like Acrobat which resiliently tolerate such flaws, your patch is welcomed.

    Fixed on 0.1.2-Fix branch (rev 198) and 0.2.0 trunk (rev 199).

    thank you

     
  • Stefano Chizzolini

    • status: open --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB