backdrop-contrib / print

Generate printer-friendly, PDF, EPub, and/or email versions of site content.
GNU General Public License v2.0
1 stars 4 forks source link

PDF: bundle libraries? #13

Closed laryn closed 9 months ago

laryn commented 2 years ago

Can we bundle PDF libraries in the related submodules? Or make wrapper modules for these libraries and add as dependencies?

laryn commented 2 years ago

RE: Licensing between GPL and LGPL, see here. And further in the comments some simplified math for people like me: LGPL + GPL → GPL but LGPL-3.0 + GPL-2.0-or-later → GPL-3.0-or-later.

bugfolder commented 1 year ago

TCPDF is now a Backdrop module.

argiepiano commented 9 months ago

But it seems like print can't see the TCPDF library wrapped by that module? https://forum.backdropcms.org/forum/tcpdf

After enabling the TCPDF wrapper, and this module's:

The site still says "No PDF generation tool found! Please download a supported PHP PDF generation tool. Check this module's INSTALL.txt for more details."

bugfolder commented 9 months ago

The Webform2PDF module uses TCPDF module to create its PDFs; maybe look at that module to see how to include the library in another module.

laryn commented 9 months ago

There is likely some integration work needed to find the new wrapper module and use that library, but I doubt it would take too much effort.

argiepiano commented 9 months ago

Yes, the integration is pretty simple, but there are some issues with all the pdf related functions, mostly product of coder_upgrade. See for example this line (!!!)

argiepiano commented 9 months ago

@laryn, PR provided.

There were some confusing handlings of config files (originally handled by variables in D7). This affected the display of the PDF version link. In D7, the text for the link was stored in a variable such as print_html_link_text and print_pdf_link_text. In Backdrop, previous work moved the value of the HTML printer friendly version text into config print.settings. The problem is that the text for PDF version is being stored in print_pdf.settings. So, I had to insert an if statement to find it in the correct location. Otherwise, the other option might be to store the HTML text in print_html.settings, but that would required lots of changes, plus an upgrade hook, since it would need to change existing installations.

laryn commented 9 months ago

Thanks @argiepiano for that PR, I had a chance to test it today and it's a big improvement. Thanks @bugfolder for the wrapper module!

laryn commented 9 months ago

I don't actually have a site that's using this module currently, but I think merging your improvement and leaving further cleanup to config files as a sometime-future project makes sense.