Skip to content

Underline and strikeout on rotated pages show as a short cross mark in other viewers #527

Description

@DutchSailor

What happens

On pages with /Rotate 90 or /Rotate 270, text underline, strikeout and squiggly annotations saved by Open PDF Studio look right in Open PDF Studio, but other viewers draw the line across the text as a short mark instead of along it. Checked with two independent renderers (PDFium and MuPDF). Highlights are not affected, because they are only a filled box.

Why

The text markup branch of js/pdf/saver.js writes every QuadPoints quad axis-aligned in user space, always in the order (x1,y2) (x2,y2) (x1,y1) (x2,y1), and writes no /AP. Viewers build the appearance from the quads and take the edge from the first to the second point as the direction of the text:

  • on an unrotated page that edge runs along the text, so the line is right;
  • on a /Rotate 90 or /Rotate 270 page the text runs along the user-space y axis, so that edge crosses the text and the line is drawn across it.

Expected

  • Write each quad in reading direction as the page is displayed (taking /Rotate into account): the first two points along the top of the text, from start to end.
  • Preferably also write an /AP that draws the line along the text, like other annotation types already get.
  • Files saved with the old order must keep loading correctly in Open PDF Studio.

Notes

Found while verifying #508 (Caret and Replace annotations): its text-edit strikes are written in reading direction with an appearance stream and display correctly on all four rotations in both renderers. The same approach can be applied to ordinary text markups.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions