php save什么意思,PHP PDF_save 用法 手册 | 示例代码

这篇博客通过示例代码解释了如何使用pdf_save()和pdf_restore()函数来管理和恢复PDF坐标系统的变化,如translate和rotate。通过在保存和恢复状态之间进行变换,可以确保这些变换只在特定区域内生效。示例中绘制了两个不同旋转和位置的小矩形,清晰地展示了这种方法的应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

By encapsulating the changes we make to the coordinate system

(pdf_translate() and pdf_rotate()) between pdf_save() and pdf_restore

we give these changes only local scope.

*/

/*

SMALL RECTANGLE

*/pdf_save($pdf);//move the origin of the coordinate system to (100,100)pdf_translate($pdf,100,100);//Rotate the coordinate system by 45 degrees.pdf_rotate($pdf,45);//Draw a samll rectanglepdf_rect($pdf,0,0,20,20);pdf_stroke($pdf);//Restore the graphics state to the way it was

//before we started to translate and rotatepdf_restore($pdf);/*

LARGER RECTANGLE

*/pdf_save($pdf);//move the origin of the coordinate system to (10,20)pdf_translate($pdf,10,20);//Rotate the coordinate system by 15 degrees.pdf_rotate($pdf,15);//Draw a larger rectanglepdf_rect($pdf,0,0,40,40);pdf_stroke($pdf);//Restore the graphics state to the way it was

//before we started to translate and rotatepdf_restore($pdf);//close it uppdf_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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值