creating pdf's using php

This is a discussion on creating pdf's using php within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi i wrote the following, which causes the script to terminate any help is greatly appreciated, thanks so much in ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-16-2005
Amir
 
Posts: n/a
Default creating pdf's using php

Hi
i wrote the following, which causes the script to terminate

any help is greatly appreciated,

thanks so much in advance!

=======================

<?
$pdf = pdf_new();
pdf_open_file($pdf);
pdf_set_info($pdf, "author", "test auth");
pdf_set_info($pdf, "title", "test page");
pdf_set_info($pdf, "creator", "test creator");
pdf_set_info($pdf, "subject", "Online test");
pdf_begin_page($pdf, 450, 450);

$font = pdf_findfont($pdf, "Times-Roman", "winansi",0);

pdf_setfont($pdf, $font, 12);
pdf_show_xy($pdf, "test text", 5, 20);

pdf_end_page($pdf);
pdf_close($pdf);
$buffer = pdf_get_buffer($pdf);
header("Content-type: application/pdf");
header("Content-Length: ".strlen($buffer));
header("Content-Disposition: inline; filename=test.pdf");

echo $buffer;
pdf_delete($pdf);

?>



Reply With Quote
  #2 (permalink)  
Old 05-16-2005
John Murtari
 
Posts: n/a
Default Re: creating pdf's using php

"Amir" <n@a.com> writes:

> i wrote the following, which causes the script to terminate


> <?
> $pdf = pdf_new();
> pdf_open_file($pdf);
> pdf_set_info($pdf, "author", "test auth");
> pdf_set_info($pdf, "title", "test page");
> pdf_set_info($pdf, "creator", "test creator");
> pdf_set_info($pdf, "subject", "Online test");
> pdf_begin_page($pdf, 450, 450);
>
> $font = pdf_findfont($pdf, "Times-Roman", "winansi",0);
>
> pdf_setfont($pdf, $font, 12);
> pdf_show_xy($pdf, "test text", 5, 20);
>
> pdf_end_page($pdf);
> pdf_close($pdf);
> $buffer = pdf_get_buffer($pdf);
> header("Content-type: application/pdf");
> header("Content-Length: ".strlen($buffer));
> header("Content-Disposition: inline; filename=test.pdf");
>
> echo $buffer;
> pdf_delete($pdf);
>
> ?>


We have a demo of PDF creation with source code
that may help in getting started (May use a different library
package), http://www.thebook-demo.com/php

Hope it helps!
--
John
__________________________________________________ _________________
John Murtari Software Workshop Inc.
jmurtari@following domain 315.635-1968(x-211) "TheBook.Com" (TM)
http://thebook.com/
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:58 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0