Hi, I would like to have a link at the bottom on every detailpage like: "Print page as PDF"
When clicked the detailpage will become available as PDF.
Can anybody put me in the right direction with a short example on how this is done pls, what code to use ??
I've been looking in the documentation and forum but can't figure out how to code this...
Thanks, any help is much appreciated !!
Okay I found the info in the readme.txt file... sorry.
But now I get this error message when I click the link to display the page as PDF:
/home/vdwproje/public_html/beheer/plugins/wkhtmltopdf/wkhtmltopdf-i386: symbol lookup error: /home/vdwproje/public_html/beheer/plugins/wkhtmltopdf/wkhtmltopdf-i386: undefined symbol: FcFreeTypeQueryFace
Any ideas what this is all about pls ??
It sounds like it's related to this bug related to the wkhtmltopdf linux binary program that createPDF uses to create PDFs: https://code.google.com/p/wkhtmltopdf/issues/detail?id=352
- Can you see if the error happens even on simple pages without CSS? Or is it just on pages with CSS?
- If you have CSS like this loaded by your page such as this "@font-face" try and remove it, or don't load that when displaying PDFs
- If neither of those things work, see if your server admin can upgrade fontconfig with this command: yum install fontconfig
Hope that helps, let me know what you find out. Thanks!
OK Dave thanks for your help.
I've deleted the CSS lines and now the error seems to be gone, but I still don't get a PDF page...
I think I'm having this problem with coding now:
The page I want to create as a PDF = http://www.vdwprojects.be/new/pandenDetail.php?LOT-3-80
My link to create the PDF ("Click to view as PDF"): <a href="?pdf=1"><img src="images/pdf.jpg" width="34" height="32"></a>
But then I get this URL as a result : http://www.vdwprojects.be/new/pandenDetail.php?pdf=1 ( without LOT-3-80 )
What am I doing wrong, or how should the link be coded to get the correct URL pls ??
You can use some code like this:
<a href="?pdf=1&<?php echo @$_SERVER['QUERY_STRING']; ?>">
To generate a link like this:
But that still seems to just pause for a long time and then return HTML code when I type in that URL directly on your server.
When you go to the Create PDF Examples under the plugins menu here: /cmsAdmin/admin.php?_pluginName=createPDF&_pluginAction=examples
Do those examples work?
Let me know, thanks!
The Test Server Requirements are all fine, but the Examples return this error in Admin:
Warning: require_once(../../../lib/viewer_functions.php) [function.require-once]: failed to open stream: No such file or directory in /home/vdwproje/public_html/beheer/plugins/examples/output_as_inline_pdf.php on line 1
Fatal error: require_once() [function.require]: Failed opening required '../../../lib/viewer_functions.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/vdwproje/public_html/beheer/plugins/examples/output_as_inline_pdf.php on line 1
Can you try updating the examples to have ../../ instead of ../../../ (remove one of the ../). That error is because the plugin is expecting itself to be in /plugins/createPDF/examples/.
Anyways, the approach I'd suggest is to get a simple page working and then work from there. So if either the "Test Server Requirements" or the examples generate a PDF than you know PDF generation is working.
So for the next step I'd recommend creating a copy of pandenDetail.php such as pandenDetail_test.php and removing large blocks of the HTML code until you can find the HTML/CSS that is causing the PDF generation to fail. PDFs can be a bit more picky then a regular web page about coding.
If you want a hand with it feel free to email me FTP login details to firstname.lastname@example.org and I can take a look at that page (email, don't post login details to the forum).
Hope that helps!
Hi Dave, thx for the help.
The example is working now, after the update.
I' ve sent you the ftp settings by mail.
Hi Dave, thanks for your great support.
Somehow the new jquery code is breaking up the design of my site :( So I will have to find a different solution.
In your comment you said: "If not, create a simpler "printer page" type of page and create your PDF from that."
I assume I can build a simpler page with less information and simpler css and create a PDF from that, but can you show me what the link should be in pandenDetail.php to print let's say pandenDetail-simple.php ?