Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotations duplicated on addAnnotationsInPDF function #58

Open
AndresCrowdComfort opened this issue Mar 13, 2024 · 4 comments
Open

Annotations duplicated on addAnnotationsInPDF function #58

AndresCrowdComfort opened this issue Mar 13, 2024 · 4 comments

Comments

@AndresCrowdComfort
Copy link

Since latest release today 13th of March using the pdfEmbedAPI using addAnnotationsInPDF function results in the annotation added twice on any given PDF, issue happening on all browsers and accross operating systems (tested on Macos, Linux, Windows)

Every type of PDF is causing the issue and its consistent on both our application and the example repository provided by Adobe https://github.com/adobe/pdf-embed-api-samples

Expected Behaviour

Using addAnnotationsInPDF adds an annotation a single time

Screen Shot 2024-03-13 at 1 40 10 PM

Actual Behaviour

addAnnotationsInPDF is adding the annotation twice

Screen Shot 2024-03-13 at 1 40 23 PM

Reproduce Scenario (including but not limited to)

Original.pdf

Steps to Reproduce

Code to replicate:

  • Pull the latest release of the PDFEmbed api sample

  • On https://github.com/adobe/pdf-embed-api-samples/blob/master/More%20Samples/React%20Samples/src/sample... override this function to delete and all back all markers

    onFileUpload = event => {
    event.persist();
    this.viewSDKClient.ready().then(() => {
    const files = event.target.files;
    if (files.length > 0 && this.isValidPDF(files[0])) {
    const fileName = files[0].name;
    const reader = new FileReader();
    reader.onloadend = e => {
    const filePromise = Promise.resolve(e.target.result);
    /* Helper function to render the file using PDF Embed API. */
    viewSDKClient
    .previewFileUsingFilePromise(
    "pdf-div",
    filePromise,
    fileName,
    previewConfig
    )
    .then((adobeViewer) => {
    adobeViewer.getAnnotationManager().then((annotationManager) => {
    annotationManager
    .removeAnnotationsFromPDF()
    .then((result) => {
    annotationManager
    .addAnnotationsInPDF(result["annotations"])
    .then((result) => {
    console.log(result);
    })
    .catch((error) => console.log(error));
    })
    .catch((error) => console.log(error));
    });
    });
    };
    reader.readAsArrayBuffer(files[0]);
    }
    });
    }

  • Upload the provided PDF

  • Make a simple change to trigger download

  • Download new PDF with duplicated annotations

Platform and Version

Latest version all platforms and modern web browsers

Logs taken while reproducing problem

None observerd

@jfitz1
Copy link

jfitz1 commented Mar 13, 2024

+1

3 similar comments
@GuillaumeCrowdcomfort
Copy link

👍

@ppearsonCrowdComfort
Copy link

+1

@J-layland89
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants