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 generation of large PDFs #779

Closed
wants to merge 53 commits into from
Closed

Fix generation of large PDFs #779

wants to merge 53 commits into from

Conversation

clementmas
Copy link
Contributor

Browsershot can not currently save PDFs that are over 512 MB.

Browsershot::url('https://page-containing-large-images.com')->save('large-file.pdf');

The issue is described quite well here: microsoft/playwright#14675

The error Cannot create a string longer than 0x1fffffe8 characters occurs at output.toString('base64') which can not handle very large output (see Stack Overflow thread).

However, we don't need to convert the output to base64 when saving PDF files to disk. If we did, we should serialize the output to buffer but I don't think this is necessary.

Fixes #642 and #745.

@freekmurze
Copy link
Member

Thanks! It seems like the tests are failing, could you take a look at that?

clementmas and others added 10 commits October 11, 2023 12:00
Bumps [stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action) from 4 to 5.
- [Release notes](https://github.com/stefanzweifel/git-auto-commit-action/releases)
- [Changelog](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/CHANGELOG.md)
- [Commits](stefanzweifel/git-auto-commit-action@v4...v5)

---
updated-dependencies:
- dependency-name: stefanzweifel/git-auto-commit-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
@clementmas
Copy link
Contributor Author

The test "can evaluate page" was failing because it still needs to receive the encoded the output.

So I moved the encoding condition inside the getOutput function. All the tests are now passing. I should have checked earlier.

I also added node_modules inside .gitignore to make it easier to run npm i puppeteer locally before submitting PRs.

@clementmas
Copy link
Contributor Author

I adapted my PR to support the new getOutput() method from #780

@rw152
Copy link

rw152 commented Mar 6, 2024

Will this be merged? Seems like a helpful addition.

@freekmurze
Copy link
Member

Could you rebase this with main?

@clementmas
Copy link
Contributor Author

I rebased with main (v4). The tests are failing though but it's unrelated to this update.

@freekmurze
Copy link
Member

There are still some conflicts that prevent me from merging. Could you rebase again with main?

clementmas and others added 24 commits March 12, 2024 10:40
Bumps [stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action) from 4 to 5.
- [Release notes](https://github.com/stefanzweifel/git-auto-commit-action/releases)
- [Changelog](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/CHANGELOG.md)
- [Commits](stefanzweifel/git-auto-commit-action@v4...v5)

---
updated-dependencies:
- dependency-name: stefanzweifel/git-auto-commit-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
This reverts commit a582204.
@clementmas
Copy link
Contributor Author

I rebased with main again. If this doesn't work, I'll open a new fresh PR.

@freekmurze
Copy link
Member

Best to open a new PR. Unfortunately, GitHub still detects conflicts, and won't let me merge this.

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

Successfully merging this pull request may close these issues.

5 participants