Monorail Project: pdfium Issues People Development process History Sign in
New issue
Advanced search Search tips
Issue 585 PDFium always uses /Rect coordinates to annotation
Starred by 2 users Reported by toniki...@chromium.org, Sep 1 Back to list
Status: Fixed
Owner: ----
Closed: Sep 20



Sign in to add a comment
I have been investigating some differences in the way PDFium and
Acrobat draw some annotations.

One difference is clear:

On Acrobat, if "/AP" is present on the "/Annot" definition, the
coordinates used to draw annotations come from "/Rect"
values. On the other hand, when "/AP" is not defined, "/QuadPoints" is
used to grab the annotation coordinates from.

The divergence comes from the fact that PDFium uses "/Rect" regardless
the presence or absence of "/AP".

This might cause differences on where annotations are placed in
Acrobat reader and on PDFium, depending on whether /Rect and
/QuadPoints values differ.
For instance, here is an example:

- open  the following PDF samples [1] and [2] in Acrobat (side by side
is better), and compare the placement of the annotation in each case.
Then do the same with PDFium (e.g. using Chromium).

[1] https://people.igalia.com/agomes/pdfium/samples/test_when_ap_use_rect.pdf
[2] https://people.igalia.com/agomes/pdfium/samples/test_when_no_ap_use_quadpoints.pdf

 
To add a little more context, QuadPoints only exist in Text Markup Annotations: highlight, underline, strikeouts, and squiggly.
Project Member Comment 2 by bugdroid1@chromium.org, Sep 6
The following revision refers to this bug:
  https://pdfium.googlesource.com/pdfium.git/+/921d58f43cbf0dc3f12394b80cb315d00ee0bd35

commit 921d58f43cbf0dc3f12394b80cb315d00ee0bd35
Author: tonikitoo <tonikitoo@igalia.com>
Date: Tue Sep 06 13:14:06 2016

Move ShouldGenerateAPForAnnotation check to CPDF_Annot::GenerateAPIfNeeded

By doing this, we simplify the code in cpvt_generateap.cpp,
and avoid calling CPVT_GenerateAP methods altogether,
when it is known that they are bailing out.

This is a preparation to fix pdfium bug 585.

BUG=pdfium:585

Review-Url: https://codereview.chromium.org/2310873002

[modify] https://crrev.com/921d58f43cbf0dc3f12394b80cb315d00ee0bd35/core/fpdfdoc/cpdf_annot.cpp
[modify] https://crrev.com/921d58f43cbf0dc3f12394b80cb315d00ee0bd35/core/fpdfdoc/cpvt_generateap.cpp

Project Member Comment 3 by bugdroid1@chromium.org, Sep 15
The following revision refers to this bug:
  https://pdfium.googlesource.com/pdfium.git/+/0a17fafd723e8684d1deb4b5ceea58967a0154da

commit 0a17fafd723e8684d1deb4b5ceea58967a0154da
Author: tonikitoo <tonikitoo@igalia.com>
Date: Thu Sep 15 20:50:50 2016

Use either /RECT or /QuadPoints for annotation coordinates, depending on /AP

On Acrobat, if "/AP" is present on a text markup definition,
the coordinates used to draw the annotation come from "/Rect
values, whereas if "/AP" is not defined, the array defined
in /QuadPoints is used to grab the annotation coordinates from.
PDFium, on the other hand, uses "/Rect" regardless of
presence or absence of "/AP".

CL fixes PDFium to work similarly to Acrobat, in this case.

TEST=testing/resources/pixel/bug_585_*.in
BUG=pdfium:585

Review-Url: https://codereview.chromium.org/2289293005

[modify] https://crrev.com/0a17fafd723e8684d1deb4b5ceea58967a0154da/DEPS
[modify] https://crrev.com/0a17fafd723e8684d1deb4b5ceea58967a0154da/core/fpdfdoc/cpdf_annot.cpp
[modify] https://crrev.com/0a17fafd723e8684d1deb4b5ceea58967a0154da/core/fpdfdoc/cpvt_generateap.cpp
[modify] https://crrev.com/0a17fafd723e8684d1deb4b5ceea58967a0154da/core/fpdfdoc/include/cpdf_annot.h
[add] https://crrev.com/0a17fafd723e8684d1deb4b5ceea58967a0154da/testing/resources/pixel/bug_585.in
[add] https://crrev.com/0a17fafd723e8684d1deb4b5ceea58967a0154da/testing/resources/pixel/bug_585_expected.pdf.0.png

Project Member Comment 4 by thestig@chromium.org, Sep 20
Fixed?
It is, sir.

PS: I emailed pdfium@ in order to get "edit bugs" privileges and to the status update myself: https://groups.google.com/forum/#!msg/pdfium/l0hh2WP_FaE/P6GJ74zDAgAJ
Project Member Comment 6 by thestig@chromium.org, Sep 20
Status: Fixed
Sign in to add a comment