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

All Invoice PDFs are Corrupt #511

Open
smartinec opened this issue Apr 10, 2024 · 4 comments
Open

All Invoice PDFs are Corrupt #511

smartinec opened this issue Apr 10, 2024 · 4 comments

Comments

@smartinec
Copy link

$dataService->DownloadPDF($invoice) results in a corrupt PDF file. The files are 15KB and appear to be fine, but appear blank in Chrome/Safari and MacOS preview says the file is damaged and won't open. I can provide sample files privately. Here is first few and last few lines:

%PDF-1.7
4 0 obj
<</Type /Page/Parent 3 0 R/Contents 5 0 R/MediaBox [0 0 612 792]/Resources<</Font<</FAAAAH 7 0 R/FAAAAJ 9 0 R/FAAABC 12 0 R>>/XObject<</X1 14 0 R>>>>/Group <</Type/Group/S/Transparency/CS/DeviceRGB>>>>
endobj
5 0 obj
<</Length 15 0 R/Filter /FlateDecode>>stream
...
endstream
endobj
startxref
15102
%%EOF
@smartinec
Copy link
Author

I should note that the DownloadPDF seems to be working in PHP 7.2, but not in PHP 8.3. It appears that the binary encoding of the file is lost.

@smartinec
Copy link
Author

Looks like curl is broken in PHP 8.3. This fixed it: $dataService->setClientName('guzzle');

@jasminmistry
Copy link

@smartinec Same way $dataService->setClientName('guzzlehttp'); also works on PHP 8.3. seems problem with curl.

@bch36
Copy link

bch36 commented Oct 10, 2024

I posted the issue and solution before I found this already-posted issue--but if you want to know what's going on and a quick fix, check out the issue I just posted: #522

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

3 participants