phpdftk API Documentation

PdfEncrypt
in package

FinalYes

Apply, change, or remove encryption on existing PDFs.

Usage: PdfEncrypt::open('doc.pdf') ->encrypt('user', 'owner', EncryptionMethod::Aes256) ->save('encrypted.pdf');

PdfEncrypt::open('encrypted.pdf', 'password') ->decrypt() ->save('decrypted.pdf');

Table of Contents

Methods

changePasswords()  : self
decrypt()  : self
encrypt()  : self
getPageCount()  : int
getReader()  : PdfReader
getVersionWarnings()  : array<int, string>
isEncrypted()  : bool
open()  : self
openString()  : self
save()  : void
setPermissions()  : self
toBytes()  : string

Methods

changePasswords()

public changePasswords(string $newUserPassword, string $newOwnerPassword) : self
Parameters
$newUserPassword : string
$newOwnerPassword : string
Return values
self

decrypt()

public decrypt() : self
Return values
self

getPageCount()

public getPageCount() : int
Return values
int

getVersionWarnings()

public getVersionWarnings() : array<int, string>
Return values
array<int, string>

isEncrypted()

public isEncrypted() : bool
Return values
bool

open()

public static open(string $path[, string $password = '' ]) : self
Parameters
$path : string
$password : string = ''
Return values
self

openString()

public static openString(string $pdfBytes[, string $password = '' ]) : self
Parameters
$pdfBytes : string
$password : string = ''
Return values
self

save()

public save(string $path) : void
Parameters
$path : string

setPermissions()

public setPermissions(int $permissions) : self
Parameters
$permissions : int
Return values
self

toBytes()

public toBytes() : string
Return values
string

        
On this page

Search results