PDFlib
| From: | Kevin Ferron | Date: | Tue, 21 Nov 2000 06:27:04 +0000 |
| Subject: | PDFlib | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-4005@lists.php.net to get a copy of this message | ||
Ive been playing around with PDFlib for win32 today..
heres my problems:
this code is what i obtained from php.net:
<?php
$fp = fopen("test.pdf", "w");
$pdf = pdf_open($fp);
pdf_set_info($pdf, "Author", "Kevin Ferron");
pdf_set_info($pdf, "Title", "Test for PHP wrapper of PDFlib 2.0");
pdf_set_info($pdf, "Creator", "See Author");
pdf_set_info($pdf, "Subject", "Testing");
$pim = pdf_open_jpeg($pdf, "MWlogo.jpg");
pdf_place_image($pdf, $pim, 100, 100, 1);
pdf_close_image($pdf, $pim);
pdf_begin_page($pdf, 595, 842);
pdf_add_outline($pdf, "Page 1");
pdf_set_font($pdf, "Times-Roman", 30, "host");
pdf_set_value($pdf, "textrendering", 1);
pdf_show_xy($pdf, "OOOOOOO", 50, 750);
pdf_moveto($pdf, 50, 740);
pdf_lineto($pdf, 330, 740);
pdf_stroke($pdf);
pdf_end_page($pdf);
pdf_close($pdf);
fclose($fp);
echo "<A HREF=getpdf.php>finished</A>";
?>
It works except for i can't get ANY of the pdf_open_image_file()
pdf_open_jpeg()
pdf_open_gif()
To open the corresponding file type. I thought it was a path issure in the:
$pim = pdf_open_image_file($pdf, "jpeg", "MWlogo.jpg");
But none of my absolute path statements, nor moving around the image help
resolve the error:
Warning: Could not open image in c:\inetpub\wwwroot\metaworld\pdf\index.php
on line 8
I'm on win2k IIS5 with PHP4 and php_pdf.dll
Anyone else with this problem?
Problem #2:
On trying to send the created PDF to the enduser:
<?php
header( "Content-type: application/pdf" );
header( "Content-Disposition: attachment; filename=test.pdf" );
?>
Now this is strange.. When you visit this page, you get prompted to first
download the PHP file (a big no no) and then if you run it, THEN you get
prompted to download the PDF.. Any ideas on what to do?
phool
kevin@vcconcepts.com