Skip to content

[Bug]: Annotation editor preview does not match the final rendered PDF #21401

Description

@ifurnadjiev

Attach (recommended) or Link to PDF file

Annotation editor preview renders Ink annotations below Stamp/Image annotations, but saved PDF renders correctly

Web browser and its version

Chrome, Firefox, Edge

Operating system and its version

Windows 11 Pro 25H2

PDF.js version

PDF.js version: 6.0.122 (also reproducible in 5.4.394)

Is the bug present in the latest PDF.js version?

Yes

Is a browser extension

No

Steps to reproduce the problem

Steps:

  1. Open web/viewer.html.
  2. Insert an image using the Image tool.
  3. Draw an ink annotation that overlaps the image.
  4. Observe that the image is rendered above the ink annotation in the editor.
  5. Save/download the PDF.
  6. Reopen the saved PDF.
  7. Observe that the ink annotation is rendered above the image, which matches the expected annotation order.

What is the expected behavior?

The editor preview should match the final PDF rendering. Since the ink annotation was created after the image annotation, the ink stroke should appear above the image both in the editor and in the saved PDF.

What went wrong?

While editing, the image is rendered above the ink annotation, making the stroke appear underneath the image. After saving and reopening the PDF, the rendering is correct and the ink annotation appears above the image.

Therefore, the annotation editor preview does not match the final PDF output.

Link to a viewer

https://mozilla.github.io/pdf.js/web/viewer.html

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions