Am 20.03.2018 23:31 schrieb Leonard Rosenthol:
To be clear - AP's are optional in ISO 32000-1 (PDF 1.x) but are required by ISO 32000-2 (PDF 2.x)

Ah, thanks, wasn't aware of that. Afaik poppler doesn't claim to support PDF 2.x yet, but good to know anyway.

However, you are completely correct that drawing an AP (either
pre-generated or dynamically created) outside of the Rect is a bug.
The Rect is considered a clipping rect for the AP - this is defined in
32K somewhere...

Ok, then the bugfixing patches should get their own entry on bugzilla. Such a change should be visible (actively announced?) to downstream projects, because it's very likely some of them have adapted to the buggy poppler behavior and would have to change accordingly. I'll cut the patches out of my unrelated patch series therefore.

Cheers
Tobias


On 3/20/18, 6:22 PM, "poppler on behalf of Tobias Deiminger"
<[email protected] on behalf of
[email protected]> wrote:

I've stumbled upon the following issue several times, and it affects a
    patch series I'm currently doing. Please let me ask about it here.

    Suppose we've got an annotation object like
    <<
    /Type /Annot
    /Rect [0.00 0.00 10.00 10.00]
    % ... other required stuff, omitted for readability ... %
    % Important: There's no /AP %
    >>

An annotation at position 0,0 with dimension 10x10 pts... There's no AP entry, i.e. no embedded appearance. That's fine, AP is optional in ISO
    32000. Poppler conforms and does its best to generate the missing
    appearance at runtime.

    But then poppler does something that seems buggy. In some cases it
ignores /Rect and draws the generated appearance with a new size chosen
    by poppler. The new size is not written back to /Rect, nor is it
reflected in public APIs (this puzzles Okular [0]). As an example you'll always get 24x24 pts icons for popup notes, even if /Rect says 10x10
    pts.

    My first question: Is ignoring /Rect for dynamically generated
    appearances compliant with ISO 32000?
If not, then it's a poppler bug, and I'd prefer to fix the bug instead
    of building workarounds into my patch.

    If I got it right, "Algorithm: Appearance streams" from ISO 32000
describes how to do it right. We shall transform AP BBox to match with Annot Rect. And we're almost there: Gfx::drawAnnot [1] sets up a matrix to transform AP BBox into a rectangle given by xMin, yMin, xMax, yMax
    arguments. It already works. We just have to use the original Rect
coordinates when calling Gfx::drawAnnot, instead of new ones. We might loose aspect ratio for popplers own appearances, but that's imho better
    than lying about the drawn size.

So my second question: Is calling Gfx::drawAnnot with original /Rect
    coordinates a valid approach for a fix?

    [0]
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugs.kde.org%2Fshow_bug.cgi%3Fid%3D388458&data=02%7C01%7Clrosenth%40adobe.com%7Cdf368ef231de4d30f88908d58e8f86bf%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636571669467648347&sdata=fHXn5irYuLI51s5pCKEY1EvOpyMZLl69szEzK%2B4M4Fk%3D&reserved=0
    [1]

https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcgit.freedesktop.org%2Fpoppler%2Fpoppler%2Ftree%2Fpoppler%2FGfx.cc%3Fh%3Dpoppler-0.63.0%23n5125&data=02%7C01%7Clrosenth%40adobe.com%7Cdf368ef231de4d30f88908d58e8f86bf%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636571669467648347&sdata=3Hsg66glB7AADAz4L5wtLpP%2FG910kYLxqg0qIDE7Zpo%3D&reserved=0
    _______________________________________________
    poppler mailing list
    [email protected]

https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fpoppler&data=02%7C01%7Clrosenth%40adobe.com%7Cdf368ef231de4d30f88908d58e8f86bf%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636571669467648347&sdata=VS4fgL2LNavg1ueN4k8Oht43emYjPsX8mvA2tjF63is%3D&reserved=0
_______________________________________________
poppler mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to