Re: PDFLib to generate 2+ page with same content
| From: | Rasmus Lerdorf | Date: | Thu, 06 Sep 2001 19:55:31 +0000 |
| Subject: | Re: PDFLib to generate 2+ page with same content | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-66266@lists.php.net to get a copy of this message | ||
> I have used the PDFLib to generate a pdf by myself. I would like to
> know how to make a page break and then draw second page which the
> content is exactly the first page.
> I need to repeat this step 9 times so I can use printer function to
> print 9-in-1 page.
Why not just put a loop around your code?
ie.
<?
$pdf = pdf_new();
pdf_open_file($pdf);
...
$i=0;
while($i<9) {
pdf_begin_page($pdf, $x, $y);
...
pdf_end_page($pdf);
$i++;
}
pdf_close($pdf);
$data = pdf_get_buffer($pdf);
header('Content-type: application/pdf');
header("Content-disposition: inline; filename=foo.pdf");
header("Content-length: " . strlen($data));
echo $data
?>
-Rasmus