[PHP-users 13621] PDF$B$G(B must not be called in 'object' scope $B%(%i!<(B

php-users@php.gr.jp php-users@php.gr.jp
Fri, 28 Feb 2003 11:09:20 +0900


$B=i$a$F$^$7$F!#9S0f$H$$$$$^$9!#(B

$B!!(BWindwos2000$B!&(BIIS5.0$B!&(BPHP4.3.0$B!&(BPDFLib$B$G!"(BPDF$B$N:n@.$G<ALd$,$"$j$^$9!#(B

$B!!(Bpdf_open_file$B$G!"%U%!%$%kL>$r;XDj$9$k$H!"%(%i!<$,H/@8$7$^$9!#(B

$B%(%i!<!'(BFatal error: PDFlib error: function 'PDF_set_info' must not be called
in 'object' scope in c:\inetpub\wwwroot\php\pdf\test1.php on line 4

$B!!(Bpdf_open_file$B$G!"%U%!%$%kL>$r6u$K$7$F%a%b%j>e$K:n@.$9$k$H!"(B
$BLdBj$J$/:n@.$5$l$^$9!#(B

$B!!%(%i!<$N860x$HBP=hJ}$r65$($F2<$5$$!#(B

$B!!59$7$/$*4j$$$7$^$9!#(B

$B%(%i!<$NH/@8$9$k%3!<%I!J(BPHP$B$N%^%K%e%"%k$N%5%s%W%k$=$N$^$^$G$9!#!K(B
<?php
$pdf = pdf_new();
pdf_open_file($pdf, "test.pdf");
pdf_set_info($pdf, "Author", "Uwe Steinmann");
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");
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, "Times Roman outlined", 50, 750);
pdf_moveto($pdf, 50, 740);
pdf_lineto($pdf, 330, 740);
pdf_stroke($pdf);
pdf_end_page($pdf);
pdf_close($pdf);
pdf_delete($pdf);
echo "<A HREF=getpdf.php>$B40N;$7$^$7$?(B</A>";
?>

$B@5$7$/F0:n$9$k%3!<%I!#(B
<?php
$pdf = pdf_new();
pdf_open_file($pdf, "test.pdf");
pdf_set_info($pdf, "Author", "hogohogo");
pdf_begin_page($pdf, 595, 842);
pdf_add_bookmark($pdf, "Page 1");

$font = pdf_findfont($pdf, "Times New Roman","winansi",0);
pdf_setfont($pdf, $font, 20);
pdf_set_value($pdf, "textrendering", 1);
pdf_show_xy($pdf, "test1", 50, 750);

$font = pdf_findfont($pdf, "HeiseiKakuGo-W5","Ext-RKSJ-H",0);
pdf_setfont($pdf, $font, 40);
pdf_set_value($pdf, "textrendering", 1);
pdf_show_xy($pdf, "test1", 50, 600);

//pdf_set_text_pos($pdf,50,800);
//pdf_continue_text($pdf,"test");
pdf_end_page($pdf);
pdf_close($pdf);
$buf = PDF_get_buffer($pdf);
$buflen = strlen($buf);
header("Content-type: application/pdf");
header("Content-Length: ".$buflen);
header("Accept-Ranges: bytes");
header("Content-Disposition: inline; filename=test.pdf");
print($buf);
pdf_delete($pdf);
?>