pdf trouble on XP

Problems with the Windows version of XAMPP, questions, comments, and anything related.

pdf trouble on XP

Postby EnglishRocker » 12. September 2008 12:03

Hi.
I've been trying to learn from http://hudzilla.org/phpwiki/index.php?title=Creating_a_PDF_with_PHP, but his code gives me errors on Xampp 1.6.7. I realised some of the code was deprecated, so I researched a bit and got this far:
Code: Select all
<?php
$filename = 'pdf\\testpdf.pdf';
$pdf = pdf_new();
/* open new PDF file; insert a file name to create the PDF on disk */
if (PDF_open_file($pdf, "") == 0) {
die("Error: " . PDF_get_errmsg($p));
}

$font = pdf_load_font($pdf, "Helvetica", "host", "");
pdf_setfont($pdf, $font, 10);
PDF_begin_page($pdf, 595, 842); /* start a new page */

?>


The pdf_setfont line gives me this:

Fatal error: Uncaught exception 'PDFlibException' with message 'Function must not be called in 'document' scope' in K:\xampp\htdocs\hudzilla\multimedia\mypdf.php:10 Stack trace: #0 K:\xampp\htdocs\hudzilla\multimedia\mypdf.php(10): pdf_setfont() #1 {main} thrown in K:\xampp\htdocs\hudzilla\multimedia\mypdf.php on line 10

Hopefully yours
Dazed & Confused
:?
EnglishRocker
 
Posts: 25
Joined: 12. September 2008 11:07

Return to XAMPP for Windows

Who is online

Users browsing this forum: rkontominas and 54 guests