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

PDF Merge Issue: Downloaded File Contains No Content #58

Closed
MZubairNaeem opened this issue Oct 25, 2024 · 1 comment
Closed

PDF Merge Issue: Downloaded File Contains No Content #58

MZubairNaeem opened this issue Oct 25, 2024 · 1 comment

Comments

@MZubairNaeem
Copy link

I'm experiencing an issue when attempting to merge PDF files using the IlovePDF API. Although my credits are being deducted each time I run the code, the downloaded PDF file ends up being empty (no content).

Here is the code I am using for the merge operation:

`$ilovepdf = new Ilovepdf(env('ILOVEPDF_PUBLIC_KEY'), env('ILOVEPDF_SECRET_KEY'));

// Start a merge task
$merger = $ilovepdf->newTask('merge');

// Add the tender PDF to the merge task
$merger->addFile(storage_path('app/files/toc/tender/bid/Tender_'.$tender->bid_no.'.pdf'));

// Rest of Documents
foreach ($TocsWithDocumentsAttached as $key => $section) {
foreach ($section as $serial => $toc) {
$merger->addFile(storage_path('app/'.$toc->file));
}
}

// Execute the merge task
$merger->execute();
$merger->download();
`
Steps to Reproduce:

Initialize the IlovePDF client with valid API keys.
Start a merge task and add multiple PDF files.
Execute the merge and attempt to download the resulting PDF.
Expected Behavior: The merged PDF should contain the content of all added files.

Actual Behavior: The downloaded PDF file is empty.

Additional Information:

I've verified that the file paths are correct and the files exist before merging.
No errors are thrown during the execution of the merge task.
Any help in resolving this issue would be greatly appreciated! Thank you.

@maztch
Copy link
Collaborator

maztch commented Dec 5, 2024

In some cases we found that a mix of pdf version 1.4 and 2.0, makes merge empty result or missing pages. We are working on it and make it fully compatible with newer versions

@maztch maztch closed this as completed Dec 5, 2024
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
@maztch @MZubairNaeem and others