Home > php教程 > php手册 > php生成PDF格式文件并且加密,

php生成PDF格式文件并且加密,

WBOY
Release: 2016-06-13 09:00:09
Original
1771 people have browsed it

php生成PDF格式文件并且加密,

项目需求:php生成pdf文件,并且把该文件加密或设置访问密码

开源的TCPDF是基于PHP的一套类库,它能够很好的生成PDF格式的文档。并且支持文件加密,在目前的开源PHP框架、系统、应用中也使用得很广。这里是设置PDF文档的相关属性的方法原型,其中就可以设置密码

TCPDF::SetProtection 
(
$permissions = array('print', 'modify', 'copy', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-high'), 
$user_pass = '', 
$owner_pass = null, 
$mode = 0, 
$pubkeys = null 
)

Copy after login

通过SetProtection()方法设置后,生成的PDF文档就是加密过的,在用户打开PDF文档的时候就会要求输入访问密码

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template