
Laurens Ramandt - 2010-11-16 08:33:31 -
In reply to message 2 from Freddie Leeman
Hello,
I enhanced the script in a way that it's possible to input a file contents string
You can find the new version in the file `class.pdffile-loadContents.php`
Similar to the 'normal' example script, you can use the enhanced class as follows:
<?php
require("class.pdffile-loadContents.php");
//adapt this line to your likings ; assign the pdf contents you got from elsewhere, to the variable $pdfContents.
$pdfContents = file_get_contents("...pdf");
//example A: insert javascript and save as new file
$obj = new pdfFile("", $pdfContents);
$obj->insertPrintCode();
$obj->saveAs("example-print.pdf");
//example B: insert javascript and output the file
$obj = new pdfFile("", $pdfContents);
//sets the header information, automatically inserts print code
//and echos the pdf contents (cfr. __toString method)
echo $obj;
?>
Good luck!