[ADDON] PDF Print August 13, 2014, 09:28:53 pm This addon replaces the print button functionality (in a topic view) such that it creates a PDF suitable for saving or printing. There are no options, just install the addon and then when your select print it will generate and display a PDF instead of a bland print page.It only supports basic html tags (bold, italic, links, div, lists, paragraphs, etc) and will include image attachments in the PDF. So nothing to fancy but seems to work in basic topic testing, YMMV Print to PDFLicenseThis Elkarte addon is released under a BSD-3-Clause license.IntroductionThis addon replaces the print button action to instead create a PDF of the topic for viewing / saving.DependenciesUtilizes tFPDF by Ian Back, License: LGPL Requires DomDocument (PHP) Features o One-click creation of topic PDF's o Includes topic image attachments in the PDF o Maintains basic text formatting o No source edits, all done with hooks.Repohttps://bitbucket.org/spuds_/elk-pdfSourcehttps://bitbucket.org/spuds_/elk-pdf/srcDownloadhttps://addons.elkarte.net/enhancement/Print-PDF.html
Re: [ADDON] PDF Print Reply #1 – August 14, 2014, 03:48:05 am Coolnessssss! emanuele likes when Spuds does experiments! ^-^
Re: [ADDON] PDF Print Reply #2 – October 02, 2014, 05:37:26 am Supercool idea ideal for my forum. However, when installed, it doesn't work.On Chrome I get Cannot be displayed:Error code: ERR_CONTENT_DECODING_FAILED
Re: [ADDON] PDF Print Reply #3 – October 02, 2014, 05:54:57 am Searching the net it looks like a compression issue.I think Spuds should "copy" the attachments download code and add something like that:Code: [Select] if (!empty($modSettings['enableCompressedOutput']) && strlen($out) <= 4194304) ob_start('ob_gzhandler'); else { ob_start(); header('Content-Encoding: none'); }after the ob_end_clean loop the file creation at:https://bitbucket.org/spuds_/elk-pdf/src/327b68d7031f11dd8629fa3c17b6f5055474084d/sources/PDF.controller.php?at=master#cl-173 (line 173).
Re: [ADDON] PDF Print Reply #4 – October 02, 2014, 06:47:23 am Yep - disabling compression fixes the error. Nice.
Re: [ADDON] PDF Print Reply #5 – October 02, 2014, 09:08:04 am Cool, thanks for the debug, will make the update
Re: [ADDON] PDF Print Reply #6 – October 02, 2014, 05:38:58 pm meetdilip thinks it is a helpful add on
Re: [ADDON] PDF Print Reply #7 – February 05, 2015, 08:46:24 pm So, I'm back on forum conversion from SMF after finishing my book. This plugin is almost great but breaks if any image in the topic is missing or has any kind of error. Instead of a pdf you get lot of code and at the bottom something like:FPDF error: Unsupported image type FPDF error: can't find image xxxxxThis includes links to external images outside of the forum's control.Can't do that to my users, pity as the PDF output is nice when it works.At least trapping the error and saying "couldn't generate PDF due to missing images" would be essential.
Re: [ADDON] PDF Print Reply #8 – February 07, 2015, 08:20:45 am Removed... wrong tab when posting about ILA...
Re: [ADDON] PDF Print Reply #9 – February 07, 2015, 04:54:41 pm Quote from: overscan – February 05, 2015, 08:46:24 pmSo, I'm back on forum conversion from SMF after finishing my book. This plugin is almost great but breaks if any image in the topic is missing or has any kind of error. Instead of a pdf you get lot of code and at the bottom something like:FPDF error: Unsupported image type FPDF error: can't find image xxxxxThis includes links to external images outside of the forum's control.Can't do that to my users, pity as the PDF output is nice when it works.At least trapping the error and saying "couldn't generate PDF due to missing images" would be essential.I'll take a look to see what I can do ... If I can trap the error I may just be able to replace it with the link (even if its bad) ... All depends on what FPDF is doing.
Re: [ADDON] PDF Print Reply #10 – February 08, 2015, 05:40:00 pm Did some updates so it will better handle external images, give it a whirl (download at the OP link)
Re: [ADDON] PDF Print Reply #11 – March 10, 2017, 12:42:07 am I installed this addon today. Thanks for it! Is it possible to change the addon so the PDF is opened in a new tab/window? And maybe it's better if the button says "PDF" instead of "Print"?Edit: I get an error:QuoteFPDF error: Interlacing not supported: attachments/11377_087368c3070226df31fd8fbcd4a6c00814707a5c.elkThere are some PNG files in the thread.
Re: [ADDON] PDF Print Reply #12 – March 11, 2017, 10:07:43 pm Could you point me to the image that is causing the problem?
Re: [ADDON] PDF Print Reply #13 – March 13, 2017, 02:00:39 am Must be in this thread:http://forum-alternative-antriebe.de/index.php/topic,6580.0.htmlIf you try to make a PDF out of it (button is called "PDF"), the error appears.
Re: [ADDON] PDF Print Reply #14 – March 13, 2017, 09:23:23 am Strange ... I've copied all the images to my local and I can't duplicate the error. I know where in the code the error would occur, I just can't duplicate it What version of PHP and are you using GD or Imagick on your system?