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
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
d35be40
Fix generation of large PDFs
clementmas Sep 29, 2023
8b68f10
Merge branch 'spatie:main' into patch-1
clementmas Oct 11, 2023
e5e84b3
Test against php 8.3
sergiy-petrov Oct 5, 2023
c89b2e1
Update composer.json
freekmurze Oct 9, 2023
43e4605
Update run-tests.yml
freekmurze Oct 9, 2023
6c2602b
Add waitForSelector()
shadoWalker89 Mar 8, 2023
ce82a89
Bump stefanzweifel/git-auto-commit-action from 4 to 5
dependabot[bot] Oct 9, 2023
3ef4f6e
Bump actions/checkout from 3 to 4
dependabot[bot] Sep 11, 2023
0d86810
Update CHANGELOG
freekmurze Oct 9, 2023
1982df6
Fix large pdf generation #2
clementmas Oct 11, 2023
4c2ca19
Merge branch 'patch-1' of github.com:clementmas/browsershot into patch-1
clementmas Oct 11, 2023
e397aeb
Merge branch 'main' into patch-1
clementmas Nov 22, 2023
8e740d4
prevent encoding output when saving file
clementmas Nov 22, 2023
c8123d9
Merge branch 'main' into patch-1
clementmas Nov 29, 2023
4b27009
Fix large pdf generation #3
clementmas Nov 29, 2023
3cea090
Fix large pdf generation #3
clementmas Nov 29, 2023
d1088bc
Fix large pdf generation #4
clementmas Nov 29, 2023
cd32f37
Fix generation of large PDFs
clementmas Sep 29, 2023
625fc2c
Add waitForSelector()
shadoWalker89 Mar 8, 2023
a582204
Update CHANGELOG
freekmurze Oct 9, 2023
9158edf
Fix large pdf generation #2
clementmas Oct 11, 2023
13c9485
Fix large pdf generation #3
clementmas Nov 29, 2023
3acab7b
prevent encoding output when saving file
clementmas Nov 22, 2023
6a52200
Fix large pdf generation #4
clementmas Nov 29, 2023
5807756
Merge branch 'patch-1' of github.com:clementmas/browsershot into patch-1
clementmas Mar 11, 2024
e775e10
Revert "Update CHANGELOG"
clementmas Mar 11, 2024
12d5855
Revert "Fix generation of large PDFs"
clementmas Mar 11, 2024
fd60139
Fix large pdf generation #5
clementmas Mar 11, 2024
7c54a2f
Merge branch 'main' into patch-1
clementmas Mar 11, 2024
3b5a379
Fix generation of large PDFs
clementmas Sep 29, 2023
032418c
Add waitForSelector()
shadoWalker89 Mar 8, 2023
823e28d
Update CHANGELOG
freekmurze Oct 9, 2023
564a8a1
Fix large pdf generation #2
clementmas Oct 11, 2023
cdaa195
Fix large pdf generation #3
clementmas Nov 29, 2023
29f6955
prevent encoding output when saving file
clementmas Nov 22, 2023
3d2c2c2
Fix large pdf generation #4
clementmas Nov 29, 2023
7dd8ba7
Fix generation of large PDFs
clementmas Sep 29, 2023
1813aa7
Test against php 8.3
sergiy-petrov Oct 5, 2023
63edd40
Update composer.json
freekmurze Oct 9, 2023
a37b264
Update run-tests.yml
freekmurze Oct 9, 2023
a2ee51e
Add waitForSelector()
shadoWalker89 Mar 8, 2023
5a8a502
Bump stefanzweifel/git-auto-commit-action from 4 to 5
dependabot[bot] Oct 9, 2023
b5d806c
Bump actions/checkout from 3 to 4
dependabot[bot] Sep 11, 2023
c28fd97
Fix large pdf generation #2
clementmas Oct 11, 2023
8300bc4
Fix large pdf generation #3
clementmas Nov 29, 2023
67cc8d7
prevent encoding output when saving file
clementmas Nov 22, 2023
9471cbb
Fix large pdf generation #4
clementmas Nov 29, 2023
562a65d
Revert "Update CHANGELOG"
clementmas Mar 11, 2024
7afda67
Revert "Fix generation of large PDFs"
clementmas Mar 11, 2024
1642876
Fix large pdf generation #5
clementmas Mar 11, 2024
830fd3a
Merge branch 'patch-1' of github.com:clementmas/browsershot into patch-1
clementmas Mar 12, 2024
efd2e91
Fix large pdf generation #5
clementmas Mar 12, 2024
cd0715f
Fix large pdf generation #6
clementmas Mar 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
build
composer.lock
node_modules
vendor
.phpunit.result.cache
.php-cs-fixer.cache

11 changes: 6 additions & 5 deletions bin/browser.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ const getOutput = async (request, page = null) => {
if (request.action == 'evaluate') {
output.result = await page.evaluate(request.options.pageFunction);
} else {
output.result = (
await page[request.action](request.options)
).toString('base64');
const result = await page[request.action](request.options);

// Ignore output result when saving to a file
output.result = request.options.path ? '' : result.toString('base64');
}
}

Expand Down Expand Up @@ -388,14 +389,14 @@ const callChrome = async pup => {
await page.close();
}

await remoteInstance ? browser.disconnect() : browser.close();
await (remoteInstance ? browser.disconnect() : browser.close());
} catch (exception) {
if (browser) {
if (remoteInstance && page) {
await page.close();
}

(await remoteInstance) ? browser.disconnect() : browser.close();
await (remoteInstance ? browser.disconnect() : browser.close());
}

const output = await getOutput(request);
Expand Down
Loading