Skip to content

assemblePdf() fails in Microsoft Edge #10

Open

Description

@Steve-OH

The attached project uses PDFAssembler to open an existing minimal PDF and then immediately reassemble it and download it. This works fine in Chrome and Firefox, but fails in Edge with the console error message "0: Function expected."

To run: npm install followed by npm start; navigate to localhost:5002/dist and click the Test button.
pdfAssemblerTest.zip

Activity

  1. nvs2 commented on Dec 17, 2019

    @nvs2

    Hey @Steve-OH , I had this same problem. It was driving me crazy. I found the advice on this stackoverflow post to be the key. It turns out Edge doesn't support the File() declaration on line 577 of src/pdfassembler.ts. If you replace that line with:

    resolve(new Blob([pdfData], { type: 'application/pdf' }));

    It worked like a charm! I'd submit a PR if I had more time. I ended up importing the entire source of this project into my Angular 8 project as a service with the following additional, small correction. On line 132 I needed the typecast. It wasn't liking this return type without it:

    fileReader.onload = () => resolve(<ArrayBuffer>fileReader.result);

    I hope this helps!

  2. Steve-OH commented on Dec 18, 2019

    @Steve-OH
    Author

    @nvs2 Thanks for the info. In our case, the use of PDFAssembler was always going to be an interim solution to do client-side patching of PDFs, until we finished moving all of our PDF generation to the client. The number of affected users is small (for now), so we had the luxury of telling people, "Don't use Edge."

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions