sprain / php-swiss-qr-bill

A PHP library to create Swiss QR bills | QR-Rechnung in PHP erstellen
MIT License
276 stars 81 forks source link

New library to generate PDF documents using TCPDF #50

Closed sdespont closed 4 years ago

sdespont commented 4 years ago

In my point of view, this library must not depend on any library to output payment slips. Therefore, #32 should never be merged.

I have created a new library compatible with Sprain\SwissQrBill\PaymentPart\Output\OutputInterface and Sprain\SwissQrBill\PaymentPart\Output\AbstractOutput to extend this one in order to generate mass-mailing QR-Bill documents using TCPDF library.

https://github.com/sdespont/php-swiss-qr-bill-tcpdf

@sprain What do you think about it? @Franco2911, this could be useful for you

Franco2911 commented 4 years ago

Hello, I am sorry for this, I am on a big project and don't had time to make changes on the FPDF parts. We use FPDF for printing and downloading pdf bills in GestiClub, what you did could be useful for other and I think is a good thing if you pull this on the main library.

I will work on FPDF part ASAP. Best regards

sprain commented 4 years ago

Thanks for your work! I'll be happy to have a look at it.

In my point of view, this library must not depend on any library to output payment slips. Therefore, #32 should never be merged.

It shoud only be suggested dependencies in composer.json, then I would not see an issue with that. An integrated solution which directly creates pdfs would definitely be a major benefit for many developers.

sdespont commented 4 years ago

Thanks for your work! I'll be happy to have a look at it.

@sprain Code is here : https://github.com/sdespont/php-swiss-qr-bill-tcpdf

I have significant improvements using SVG QR-Code image instead of PNG : documents are about 6 times smaller! But, the swiss cross is not displayed... perhaps because it is an embedded SVG image in the SVG image and TCPDF cannot handle that. Tell me if you have an idea to solve this, like merging the 2 SVG together?

Because the PNG image is very big, mass-mailing documents size is very hight too. Is it mandatory to use an image with a resolution of 300 dpi? I don't find any requirements about this.

sprain commented 4 years ago

But, the swiss cross is not displayed... perhaps because it is an embedded SVG image in the SVG image and TCPDF cannot handle that.

I have the same issue when using PrinceXML to generate the PDF from html. So it's likely a problem with the qr code generator. There is now an issue for that: #51

Because the PNG image is very big, mass-mailing documents size is very hight too. Is it mandatory to use an image with a resolution of 300 dpi? I don't find any requirements about this.

I am aware of that. There is a seperate issue for this: https://github.com/sprain/php-swiss-qr-bill/issues/17

sdespont commented 4 years ago

@sprain OK, but where the 300dpi comes from?

sprain commented 4 years ago

but where the 300dpi comes from?

Best practice for printing.

Of course a vector-based solution would be better.

sdespont commented 4 years ago

OK, so it is not a SIX requirement. I will continue to work on it.

sprain commented 4 years ago

@sdespont In #53 I created a pull request which would include your TcPdfOutput directly into this library, with tecnickcom/tcpdf as a suggested dependency only. I think this library would gain a lot if a pdf-creating solution was integrated right into it.

What do you think about it?

sdespont commented 4 years ago

@sprain Yeah, sure. I would have created a pull request after some stabilization period in any way.

timyyo commented 4 years ago

@sdespont Thanks for your changes, I also use tcpdf for mass mailing invoices. It works all good so far. Though one issue i have, the qr slip needs around 6-8x longer than the creation of ES/ESR payment slip. Is that just for me the case, or do you have the same behaviour?

The time loss is for me happening in this part: $this->tcPdf->$method("@".$img, $xPosQrCode, $yPosQrCode, 46, 46);

With the PNG QrCode File Format, it can create it around 30% quicker. Any idea how to speed this up?

sprain commented 4 years ago

Though one issue i have, the qr slip needs around 6-8x longer than the creation of ES/ESR payment slip

@timyyo I am no expert on TcPDF, but unfortunately I suppose that calculating and placing a qr code will always be slower than just placing text as in the old ESRs.

However, TcPDF seems to have some performance issues when placing images under some circumstances.

Since you mentioned mass creation of pdfs, maybe this could help? https://stackoverflow.com/a/58203421