[Poppler-bugs] [Bug 105692] New: PDF compliance: Always respect Annot Rect

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu Mar 22 14:13:07 UTC 2018


https://bugs.freedesktop.org/show_bug.cgi?id=105692

            Bug ID: 105692
           Summary: PDF compliance: Always respect Annot Rect
           Product: poppler
           Version: unspecified
          Hardware: Other
                OS: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: general
          Assignee: poppler-bugs at lists.freedesktop.org
          Reporter: haxtibal at posteo.de

To be compliant to ISO 32k, we always have to respect the geometry of Annot
/Rect. See [0]. Currently there are cases where poppler draws annotations at
another size. Namely this happens when poppler generates appearances at runtime
to substitute missing AP entries for AnnotText, AnnotLine, AnnotTextMarkup,
AnnotPolygon and AnnotInk (e.g. [1], [2]).

For example, you can end up with a popup note drawn as 24 x 24 pts even if
Annot Rect says 16 x 16 pts. Poppler does not update Annot Rect, it keeps
telling 16 x 16. Therefore the new size is also not reflected in public APIs.
So the bug is not only about PDF non-conformance, but it also leaves clients
unaware of the actually rendered size [4].

ISO 32k contains a detailed description about how to fit appearance streams
into Annot Rect. See "Algorithm: Appearance streams" from ISO 32000-1:2008,
12.5.5. To sum up:
a) make a quadrilateral from AP BBox by applying apperances transformation
Matrix, and calculate a temporary transformed AP BBox that encompasses the
quadrilateral
b) calculate a temporary Matrix A that scales the transformed AP BBox into
Annot Rect
c) use this Matrix A to draw the appearance

The existing method Gfx::drawAnnot nicely implements this algorithm. We just
have to call Gfx::drawAnnot with the original Annot Rect size instead passing
other values.

Patches will follow, comments are appreciated in advance.

[0] https://lists.freedesktop.org/archives/poppler/2018-March/012909.html
[1]
https://cgit.freedesktop.org/poppler/poppler/tree/poppler/Annot.cc?h=poppler-0.63.0#n2486
[2]
https://cgit.freedesktop.org/poppler/poppler/tree/poppler/Annot.cc?h=poppler-0.63.0#n5890
[3]
https://cgit.freedesktop.org/poppler/poppler/tree/poppler/Gfx.cc?h=poppler-0.63.0#n5125
[4] https://bugs.kde.org/show_bug.cgi?id=388458

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/poppler-bugs/attachments/20180322/307698de/attachment.html>


More information about the Poppler-bugs mailing list