Include the api first:
include(api.php);
Sample 1
/*
* Crate a document and add parameter
*/
$doc = new PDF24Doc();
$doc->setCharset('ISO-8859-1');
$doc->setHeadline('This is the headline of the PDF');
$doc->setHeadlineUrl('http://www.pdf24.org');
$doc->setBaseUrl('http://www.pdf24.org');
$doc->setFilename('test');
$doc->setPageSize(210, 297);
$doc->setEmailTo('stefanz@pdf24.org');
$doc->setEmailFrom('stefanz@pdf24.org');
$doc->setEmailSubject('Here is your created PDF file');
$doc->setEmailBody('The created PDF file is attached to this email!');
$doc->setEmailBodyType('text');
$doc->setEmailCharset('ISO-8859-1');
/*
* Create one or more elements
*/
$element = new PDF24Element();
$element->setTitle('This is the title of the element');
$element->setUrl('http://www.pdf24.org');
$element->setAuthor('Stefan Ziegler');
$element->setDateTime('2010-04-15 8:00');
$element->setBody('The is the body of the element');
/*
* Add elements
*/
$doc->addElement($element);
/*
* Create the PDF. Print response if there has been an error.
*/
if(!$doc->createAndSend()) {
echo $doc->getResponse();
}
Beispiel 2
/*
* Create Document with parameter
*/
$doc = new PDF24Doc(array(
'charset' => 'UTF-8',
'headline' => 'This is a headline',
'headlineUrl' => 'http://www.pdf24.org',
'baseUrl' => 'http://www.pdf24.org',
'filename' => 'test',
'pageSize' => '210x297',
'emailTo' => 'stefanz@pdf24.org',
'emailFrom' => 'stefanz@pdf24.org',
'emailSubject' => 'Here is your created PDF file',
'emailBody' => 'The PDF file is attached to this email!',
'emailBodyType' => 'text'
));
/*
* Add an element without using PDF24Element
*/
$doc->addElement(array(
'title' => 'This is the title of the element',
'url' => 'http://www.pdf24.org',
'author' => 'Stefan Ziegler',
'dateTime' => '2010-04-15 8:00',
'body' => 'This is the body of the element'
));
/*
* Create the PDF. Print response if there has been an error.
*/
if(!$doc->createAndSend()) {
echo $doc->getResponse();
}