Skip to main content
[ADDON] PDF Print Started by Spuds · · Read 71805 times 0 Members and 2 Guests are viewing this topic. previous topic - next topic

Re: [ADDON] PDF Print

Reply #30

The permission to use the PDF function is, critically, tied to the "send topics to friends".  Remove that permission and the PDF function should be disabled for those users.

I could easily add a feature to disable the images in the output, I'll see if I have time this weekend.  If you are in a rush you can edit the elk-pdf class and set the validImageTypes variable to an empty array.

Re: [ADDON] PDF Print

Reply #31

This ElkArte addon replaces the default print button with a create PDF.   Clicking the PDF button will output a PDF to the browser of the current topic, including images and links.  The user can then print or save the PDF.

The package file is large due to the included TTF fonts, so your server will need to support uploads of 4M ... if not use the download from addons site option as outlined below.

Here is what is new in V1.1.0

  • This new version only supports ElkArte 1.1+
  • Address various issues with PHP 8.1
  • Update tfdpf library to pull in the latest tpdf updates (as of 1.84)
  • Add support for WEBP attachments
  • Fix issue where a topic image could be reused in the wrong post due to naming reuse in the library (a PDF optimization error)
  • Fix issue where a normal below post attachment would cover the post text if preceded by a post with an ILA attachment
  • Improve line spacing in lists

To get the addon you can do one of two things:
  • You can download the file from the Addons site and then upload that file to your server
    • Admin > Packages > Upload > Select the zip file you just downloaded > Upload
  • Or Download it directly to your site
    • Admin > Packages > Download Package > click "Browse" by "ElkArte Third-party Add-ons Site", expand Enhancement > Print to PDF > [Download] (use the button)
Last Edit: November 06, 2022, 03:38:23 pm by Spuds

Re: [ADDON] PDF Print

Reply #32

This ElkArte addon replaces the default print button with a create PDF.   Clicking the PDF button will output a PDF to the browser of the current topic, including images, attachments, and links.  The user can then print or save the PDF.

The package file is large due to the included TTF fonts, so your server will need to support uploads of 5M ... if not use the download from addons site option as outlined below.

Here is what is new in V1.2.1

  • Address various issues with PHP 8.2
  • Update tfdpf library to the latest (improved PHP 8.2 support)
  • Improved processing / formatting of ILA and Gallery images
  • Change to use DomDocument instead of the simple dom php library

To get the addon you can do one of two things:
  • You can download the file from the Addons site and then upload that file to your server
    • Admin > Packages > Upload > Select the zip file you just downloaded > Upload
  • Or Download it directly to your site
    • Admin > Packages > Download Package > click "Browse" by "ElkArte Third-party Add-ons Site", expand Enhancement > Print to PDF > [Download] (use the button)
Last Edit: February 09, 2024, 11:45:37 am by Spuds

Re: [ADDON] PDF Print

Reply #33

Hi, I installed this latest version cause the version I had installed has an error when exporting one of my threads. I first uploaded via package manager, but it told me I had the latest version already. I didn't trust him, so I uploaded the files manually on the server. Big mistake!  :zipper_mouth:

And now I crashed the pdf export. I get this error message in every thread when I try to export to pdf:

Ein Fehler ist aufgetreten!
DOMDocument::loadHTML(): Tag time invalid in Entity, line: 1

Can you help me? If not I have to install a backup...

Re: [ADDON] PDF Print

Reply #34

Sorry I did not see this sooner ...

Must be due to the custom theme and DOMDocument not knowing what the HTML time tag is ... try the attached file, replacing the one in your subs directory.

Re: [ADDON] PDF Print

Reply #35

Thank you, that fixed the overall problem. But there's the error message in this particular thread, when export the thread to pdf:

https://forum-alternative-antriebe.de/index.php/topic,8730.0.html

Any idea? It seems an attachmend is the problem... I searched the attachment list in the backend of the forum, but there is no attachment with this name.

Re: [ADDON] PDF Print

Reply #36

Sounds like we are 1/2 way there then .... I don't have a login for the site so the pdf button just defaults to the old print page.  Can you post the error you are seeing?

Re: [ADDON] PDF Print

Reply #37

Sure:

Ein Fehler ist aufgetreten!
tFPDF error: 16-bit depth not supported: /www/htdocs/w00f21f1/hp_elkarte/attachments/20577_44fa87e2a1b7d2800628fe045e06a92b89c452ce.elk

I tried to find this attachment named "20577_44fa87e2a1b7d2800628fe045e06a92b89c452ce" in the backend, but it does not seem to be there with this name.

Re: [ADDON] PDF Print

Reply #38

That is easy, its the cell phone screen capture:mobile_phone:

I added a 16bit->8bit down-version for PNG files, so give the attached file a try by replacing the one in your subs directory.

Re: [ADDON] PDF Print

Reply #39

Works perfect, thank you!  :smiley:

Re: [ADDON] PDF Print

Reply #40

Any chance you can help again?  :sad:

I get this error message:

tFPDF error: Not a JPEG file: /www/htdocs/w00f21f1/hp_elkarte/attachments/352_b063eec556e21bb11605fe71d11297665cc60b7d.elk

...when trying to export this thread as pdf:

https://forum-alternative-antriebe.de/index.php/topic,8.0.html

Plus this error message:

tFPDF error: Interlacing not supported: elkimg://img4346100e010c99d278872a2245ec57a9

...when trying export to pdf with another thread (which is only internal).

Do you need an account?

Re: [ADDON] PDF Print

Reply #41

You are a trouble maker LOL

That one is what the error claims.  An attachment is saved with a JPG extension and for some reason the db also has the mime set as image/jpg,  but the image is in fact a PNG.

Here is another updated file which validates the image mime types, this will fix the first error and MAY fix the other one (my thought is that the other error is another PNG masquerading as a JPG which will bypass the de-interlacing function)

So give this one a try :D

Re: [ADDON] PDF Print

Reply #42

No, sorry, doesn't fix any of the problems.

But I can use the print as pdf feature of the chrome browser to save the threads. Does look different then but works. And you don't have to invest more time to fix this.

Re: [ADDON] PDF Print

Reply #43

Well there ya go:man_shrugging:

Minor update in case it was not finding the function on your server.  I know this fixes it on my setup with the bad image file I found on your site.

Re: [ADDON] PDF Print

Reply #44

Sorry, same error messages with this file.  :embarrassed: