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

assemblePdf() fails in Microsoft Edge #10

Open
Steve-OH opened this issue Sep 27, 2019 · 2 comments
Open

assemblePdf() fails in Microsoft Edge #10

Steve-OH opened this issue Sep 27, 2019 · 2 comments

Comments

@Steve-OH
Copy link

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

@nvs2
Copy link

nvs2 commented Dec 17, 2019

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!

@Steve-OH
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants