Home  >  Article  >  Backend Development  >  PHP generates PDF format files and encrypts them_PHP tutorial

PHP generates PDF format files and encrypts them_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 09:49:071331browse

php generates PDF format files and encrypts them

This article will introduce to you how to use php to generate pdf files, and encrypt the files or set access passwords, if necessary Friends can refer to it.

Project requirements: PHP generates pdf files, and encrypts the files or sets access passwords

The open source TCPDF is a set of class libraries based on PHP, which can generate documents in PDF format very well. It also supports file encryption and is widely used in current open source PHP frameworks, systems, and applications. Here is the method prototype for setting the relevant properties of a PDF document, in which you can set a password

 ?

1

2

3

4

5

6

7

8

TCPDF::SetProtection

(

$permissions = array('print', 'modify', 'copy', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-high'),

$user_pass = '',

$owner_pass = null,

$mode = 0,

$pubkeys = null

)

1

2 3

45 6 7 8
TCPDF::SetProtection ( $permissions = array('print', 'modify', 'copy', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-high'),
$user_pass = '', $owner_pass = null, $mode = 0, $pubkeys = null )
After setting through the SetProtection() method, the generated PDF document is encrypted, and the user will be asked to enter the access password when opening the PDF document http://www.bkjia.com/PHPjc/1020280.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1020280.htmlTechArticlephp generates PDF format files and encrypts them. This article introduces how to use php to generate pdf files and encrypt the files. For methods of encrypting or setting access passwords, friends in need can refer to...
Statement:
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