createPDF - save pdf to server and don't output

5 posts by 3 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: June 12, 2012   (RSS)

By rjbathgate - June 11, 2012

Hey

Further to my query on combining PDFs for whtmltopdf I have a possible solution, which lends itself to another question...

I can combine PDFs into one PDF via PHP, IF the PDFs are locally stored on the server.

i.e.
/pdfs/file.pdf

An external link like
http://www.blaa.com/pdfs/file.pdf won't work

So... is there a way to get the createPDF plugin to:

* Save the outputted PDF file (the one it'd normally output) to a folder, somewhere

* Present the filename (and/or filepath) as a variable

* And NOT present the generated PDF to the user (i.e. don't pop up with option to download/view)

Then I can collect the local file path of the generated PDF, and combine it into a bunch of them, and then run my PHP script to combine the lot.

Thanks :)
Rob

Re: [rjbathgate] createPDF - save pdf to server and don't output

By Jason - June 11, 2012

Hi Rob,

We could do some customization to the createPDF plugin to do this. Please contact consulting@interactivetools.com and we can go over some options.

Thanks,
---------------------------------------------------
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: [rjbathgate] createPDF - save pdf to server and don't output

By Dave - June 12, 2012

Hi Rob,

Also, have a look at the functions in createPDF.php and the examples, some of them return $data with the PDF content. You could just call:
file_put_contents('yourfile.pdf', $data);

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] createPDF - save pdf to server and don't output

By rjbathgate - June 12, 2012 - edited: June 12, 2012

5 stars to Dave.

$url = "http://www.google.com";
$data = createPDF_fromUrl($url);
file_put_contents('myfile.pdf', $data);

// my PDFMerger script below
$pdf->addPDF('myfile.pdf', '1')
->addPDF('myotherfile.pdf', '1-2')
->addPDF('myotherfile2.pdf', 'all')
->merge('download', 'myoutput.pdf');


works a treat, many thanks :)

Rob