Query about PDF creator Plugin
5 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: September 19, 2011 (RSS)
By MickC - September 16, 2011
I have also bough the Cookbook, and scoured the forum and the cookbook for an answer for this:
I have a listing of used equipment, each record of which links to a detail page for each item. I also created another detail page which will be converted to PDF so the customer can print off, email etc.
Every time i put the code into the page i get the following issue:
If i put the createPDF code like this:
in the header
<?php if (@$_REQUEST['pdf']) { createPDF_fromOutput('inline', 'example.pdf'); } ?>
in the body
<a href="http://used.haeuslers.com.au/listing/listingInfoSheet.php?pdf=1&<?php echo $listingsRecord['num'] ?>">CLICK TO CONVERT THIS PAGE TO A PDF</a>
which id about halfway down the page, i get an error like this:
createPDF_display: Can't output PDF because headers already sent! Output started in /home/haeusler/public_html/used/listing/listingInfoSheetPrep.php line 125. Make sure you don't have any html or whitespace characters in your code before calls to createPDF_ functions.
If i move it up to the top of the page, it makes a PDF, but it is just a blank white page.
The only errors after i installed and tested it were ones that required me to add the switch to ignore errors.
Running the test in the admin section, the google page works correctly.
Re: [MickC] Query about PDF creator Plugin
By Jason - September 16, 2011
Could you attach listingInfoSheet.php to this thread along with a link to a page than demonstrates the problem? That way we'll be able to take a closer look into this
Hope this helps
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Query about PDF creator Plugin
By MickC - September 16, 2011
Thanks for you help mate, it ended up being a DNS problem, of all things!
The domain name it is running on only has entries in our local DNS server, not to the public. I got it to the stage where it would make PDFs of any public website, but all "internal" pages would just come up blank.
Anyway, I made the domain name public and the problem disappeared. Obviousy the PDF engine uses the DNS of the hosting provider to resolve the domain name, which is where i was coming unstuck. [crazy]
Re: [MickC] Query about PDF creator Plugin
By MickC - September 17, 2011
I even worked out a way to dynamically name the PDF file with a bit of trial and error.. [;)]
<?php require_once "lib/viewer_functions.php"; ?>
<?php
$filename= $listingsRecord['manufacturer']."-".$listingsRecord['Model'];
$num= $listingsRecord['num'];
$url = "listingInfoSheet.php?".$num;
$data = createPDF_fromUrl($url);
createPDF_display('attachment', $data, $filename.'.pdf');
?>
Now the customer's file is meaningfully named, instead of 4 different "example.pdf" files.
Now to play with a few switches and see what else I can do!
Re: [MickC] Query about PDF creator Plugin
By Jason - September 19, 2011
That's great! Glad to hear everything is working for you now. Please let us know if have any other questions.
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/