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

PR for a PDF writer welcome? #256

Closed
JanSlabon opened this issue Jun 18, 2020 · 5 comments
Closed

PR for a PDF writer welcome? #256

JanSlabon opened this issue Jun 18, 2020 · 5 comments

Comments

@JanSlabon
Copy link

I'm not sure if this is already planed or why ever nobody did this before, so I ask before we would start:

We would use FPDF under the hood and the QR codes will be created as simple vector based PDF files. Simliar to the EPS output + logo. We would left the labels because this can be done in the PDF generation class that imports the resulting PDF later on (FPDF, TCPDF, tFPDF,...) with FPDI.

I'm not sure if the dependency to FPDF should be hard (in the composer.json) or optional.

The class name would be Endroid\QrCode\Writer\FpdfWriter. The getName() method would return "pdf" or "fpdf"?

What do you think? :-)

PS: This will also make the SVG interpretation of TCPDF obsolete which seems to be buggy as noted in #255.

@sprain
Copy link
Contributor

sprain commented Jun 18, 2020

This will also make the SVG interpretation of TCPDF obsolete which seems to be buggy as noted in #255.

Please note that #255 is about using the qr code in pdfs unrelated to the pdf generator in use. For example, the current issue also exists with PrinceXML which turns html input into a pdf.

So your idea might be a good use-case for some people, but is not a replacement for #255.

@JanSlabon
Copy link
Author

So your idea might be a good use-case for some people, but is not a replacement for #255.

Ok! :-)

@endroid endroid self-assigned this Jun 19, 2020
@endroid
Copy link
Owner

endroid commented Jun 19, 2020

Hi @JanSlabon I don't think there is really a demand for this feature at the moment as there are already some very compatible formats and I think including a PDF generator / dependency is not desirable. If you can keep it very small it is ok, but otherwise I would prefer a separate library providing the PDF Writer (which you can still easily use with this library).

@JanSlabon
Copy link
Author

Ok, what a pitty.

I don't want to impose something here but simply thought it would be a good feature addition.

Because the only way to get a vector based output is EPS or SVG. Both formats needs to be re-interpreted and converted to PDF later on. So the PDF generation library needs to be able to interpret these formats (not all libraries support this - and some have problems as seen in #255).
Having a PDF output would mean to only import the page but not to interpret EPS or SVG.
Importing pages of existing PDFs is possible with FPDI which is available for FPDF, TCPDF, tFPDF and mPDF.

A writer is not big or complicated. We just did this here, too: https://github.com/chillerlan/php-qrcode/blob/main/src/Output/QRFpdf.php

Feel free to ping me if there's a demand for it in the future.

@endroid
Copy link
Owner

endroid commented Jun 20, 2020

I do think it is useful so if you think it is not too big or complicated and we can keep additional dependencies optional (via composer suggest) such a feature is more than welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants