Skip to content

Partial Appearance Left Behind After Field Removal #1001

Description

@Trapfether

What were you trying to do?

I was attempting to remove a field I had added previously using pdf-lib from a pdf and display that pdf with pdf.js in the browser.

I am using pdf-lib for the pdf alterations, and I am using pdf.js for displaying the pdf in-browser.

Why were you trying to do this?

I am building a web tool that allows individuals to place / remove / adjust fields within a pdf. This is part of an automation system in a larger project.

How did you attempt to do it?

I had previously added a field using pdf-lib to the pdf and saved it.

I then removed the field (can be textbox, checkbox, doesn't matter) and displayed the resulting pdf with pdf.js.

What actually happened?

the default rectangle and border are still shown on the pdf. When I open the same pdf in Chrome pdf viewer or Acrobat, those appearances are not there. This leads me to suspect that something is being left behind when removing a field and that Chrome and Acrobat are intelligently ignoring whatever was still there. Pdf.js seems to still see this remnant and display it though.

What did you expect to happen?

When the field is deleted and the pdf is reloaded into pdf.js, I would expect any visual trace of the field to be removed.

How can we reproduce the issue?

I have attached a zip file with a single simple HTML document that creates a pdf document, adds some text and fields to said document, then removes a single field from that document before finally rendering that document to a canvas using pdf.js

You can see that the border & background for the field that should have been removed is still showing. Although the actual text and interactive items have been removed as expected.

test.zip

Version

1.16.0

What environment are you running pdf-lib in?

Browser

Required Reading

Additional Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions