文字

PDF_save

(PHP 4, PECL pdflib >= 1.0.0)

PDF_saveSave graphics state

说明

bool PDF_save ( resource $p )

Saves the current graphics state. 成功时返回 TRUE , 或者在失败时返回 FALSE

用户评论:

[#1] bob at nijman dot de [2001-08-02 05:12:07]

By playing around with this you'll get a better understanding of what pdf_save and pdf_restore do.

<?php

//Create & Open PDF-Object
$pdf pdf_new();
pdf_open_file($pdf);
pdf_set_info($pdf"Author","Bob Nijman");
pdf_set_info($pdf"Title","Sponsored by www.nijman.de");
pdf_set_info($pdf"Creator""See Author");
pdf_set_info($pdf"Subject""pdf_restore");
pdf_begin_page($pdf300300);






pdf_save($pdf);
//move the origin of the coordinate system to (100,100)
pdf_translate($pdf100100);
//Rotate the coordinate system by 45 degrees.
pdf_rotate($pdf45);
//Draw a samll rectangle
pdf_rect($pdf002020);
pdf_stroke($pdf);
//Restore the graphics state to the way it was
//before we started to translate and rotate
pdf_restore($pdf);




pdf_save($pdf);
//move the origin of the coordinate system to (10,20)
pdf_translate($pdf1020);
//Rotate the coordinate system by 15 degrees.
pdf_rotate($pdf15);
//Draw a larger rectangle
pdf_rect($pdf004040);
pdf_stroke($pdf);
//Restore the graphics state to the way it was
//before we started to translate and rotate
pdf_restore($pdf);



//close it up
pdf_end_page($pdf);
pdf_close($pdf);
$data pdf_get_buffer($pdf);
header('Content-type: application/pdf');
header('Content-disposition: inline; filename=nijman.pdf');
header('Content-length: ' strlen($data));
echo 
$data;

?>


Thanx to:
http://www.dynamicwebpages.de/50.tutorials.php?dwp_tutorialID=11

上一篇: 下一篇: