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

Fix empty PDF issue #2833

Closed
wants to merge 1 commit into from
Closed

Fix empty PDF issue #2833

wants to merge 1 commit into from

Conversation

Joasper
Copy link

@Joasper Joasper commented Jan 14, 2025

Fixes #2829

Fix the issue of empty PDF when downloading.

  • Modify src/browser-extensions/OutputDocumentBrowser.js to add a check ensuring the content is correctly embedded before saving the file.
  • Modify src/base.js to add a verification step in the createPdf method to ensure the content is correctly embedded.
  • Update examples/basics.js to add a verification step to check the content of the generated PDF.
  • Update examples/columns_simple.js to add a verification step to check the content of the generated PDF.
  • Add a test case in tests/unit/Node-interface.spec.js to verify the content of the generated PDF.

For more details, open the Copilot Workspace session.

Fixes bpampuch#2829

Fix the issue of empty PDF when downloading.

* Modify `src/browser-extensions/OutputDocumentBrowser.js` to add a check ensuring the content is correctly embedded before saving the file.
* Modify `src/base.js` to add a verification step in the `createPdf` method to ensure the content is correctly embedded.
* Update `examples/basics.js` to add a verification step to check the content of the generated PDF.
* Update `examples/columns_simple.js` to add a verification step to check the content of the generated PDF.
* Add a test case in `tests/unit/Node-interface.spec.js` to verify the content of the generated PDF.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/bpampuch/pdfmake/issues/2829?shareId=XXXX-XXXX-XXXX-XXXX).
@liborm85
Copy link
Collaborator

liborm85 commented Jan 15, 2025

@Joasper Tests are failing.
Please add a test case to handle a scenario where an empty PDF is returned (getBuffer method returns a byteLength of 0).

@liborm85
Copy link
Collaborator

No reaction.

@liborm85 liborm85 closed this Jan 21, 2025
@peirens-bart
Copy link

Hi @liborm85 I posted the bug, can I help by adding a test case so this fix can be released?

@liborm85
Copy link
Collaborator

@peirens-bart Add runnable example for reproduce to issue #2829, because It works correctly for me, as mentioned in #2829 (comment).

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

Successfully merging this pull request may close these issues.

empty pdf when download
3 participants