Query about PDF creator Plugin

By MickC - September 16, 2011

I have just bought the PDF creator plugin and installed it, after a few fixes it is working.
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

Hi,

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

Hi jason.

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 tidied a few things up and get it working perfectly,

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!