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

Significantly increased PDF file size after merging XML and PDF #211

Closed
IgitBuh opened this issue Dec 10, 2024 · 2 comments
Closed

Significantly increased PDF file size after merging XML and PDF #211

IgitBuh opened this issue Dec 10, 2024 · 2 comments
Assignees
Labels
question Further information is requested

Comments

@IgitBuh
Copy link

IgitBuh commented Dec 10, 2024

First of all, please allow me to express my sincere gratitude for your work. Thank you very much!

Your question
I've been using tFPDF for a long time now and I would like to continue using it.
To meet the new tax requirements, I would like to use your library to create the required XML and merge it with my PDF invoices.
I have implemented your basic sample code and the XML creation works fine and is valid.
I have then merged it with my PDF and although it works as well, I am very confused about the resulting file size.

The original PDF is 52 KB.
The sample XML is about 1 KB.
The merged ZUGFeRD PDF from these two files is 116 KB.

Is this normal? This seems to be a huge overhead. Would it be possible to keep the file size at a minimum? I would expect the result to be 53 KB, but even with some additional header data not larger than 60 KB.

Sample Code

    $pdf_string = $pdf->Output($outFileName,'S');
    $pdfMerger = new ZugferdDocumentPdfMerger($xml, $pdf_string);
    $pdfMerger->generateDocument();
    $pdfFileStream = $pdfMerger->downloadString($outFileName);
@IgitBuh IgitBuh added the question Further information is requested label Dec 10, 2024
@horstoeko
Copy link
Owner

Good morning @IgitBuh,

First of all, please allow me to express my sincere gratitude for your work. Thank you very much!

Thank you very much for the kind words and the appreciation.

I have then merged it with my PDF and although it works as well, I am very confused about the resulting file size.

I will look into this. Stay tuned.. ;-)

Kind regards

@horstoeko
Copy link
Owner

Hi @IgitBuh,

I have found the problem: The embedded ICC profile was a bit large at 60KB... :-) I switched to a smaller profile by default.

Kind regards

horstoeko added a commit that referenced this issue Dec 11, 2024
#211 Significantly increased PDF file size
Repository owner locked as resolved and limited conversation to collaborators Dec 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants