Hi,
BACKGROUND
I am looking to create a series of Certificates and Brouchures etc and then
using the products Print/Acrobat Distiller option save the documents as
PDF(with some pre-built in <>, <>, <> variables
that can be automatically resolved
"on-the fly" using a PHP script using a PDF_REPACE(see below code) option or
something similar. This then allows me to Create Nice looking
Brouchures/Certificates etc with "variable <> markers" before
converting to PDF so my online user can have "personalised stationary"
without the need for them to EDIT any of the documents.
My attempts using PHP -> PDF on the fly
===
I am looking for guidance on whats the best method and am I on the right
track without using the long winded PDFLIB functions..
I wonder if you could help(I'm going round in circles!), I a looking to use
PHP -> PDF, probably with PDF templates instead of actual PDFLIB coding
techniques.
I have tried to create a simply script(before I move on)which will process a
"PDF pre-written" template and resolve variables on the fly(without using
any PDFLIB functions etc). I created a simple script to do this using
Microsoft RTF but obviously this would only work on PC's where users have
WORD etc...(I assume)
I have tried myself but keep getting the error msg "The file is damaged and
could not be repaired" when it trys to load the "amended " PDF file(see the
sample script below).
By the way, the script works fine if I comment out the PDF_REPLACE option. I
assume these are causing some type of error?? I tried updating the Acrobat
prefences/options to not load in a Browser but that just downloaded to my PC
and the same error message appeared after I double clicked on it...
The PDF template small script is attached as an example.
Rgds
Bev
Error:This page was called incorrectly';
}
else
{
//generate the headers to help a browser choose the correct application
$date = date( 'F d, Y' );
// open our template file
$filename = 'PHPCertification.pdf';
$fp = fopen ( $filename, 'r' );
//read our template into a variable
$output = fread( $fp, filesize( $filename ) );
header( 'Content-type: application/pdf' );
header( 'Content-Disposition: filename=cert.pdf');
fclose ( $fp );
// replace the place holders in the template with our data
$output = pdf_replace( '<>', strtoupper( $name ), $output );
$output = pdf_replace( '<>', $name, $output );
$output = pdf_replace( '<>', $score, $output );
$output = pdf_replace( '<>', $date, $output );
// send the generated document to the browser
echo $output;
}
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php