encryptPDF
- addBibliography
- addBookmark
- addBreak
- addChart
- addCitation
- addComment
- addCrossReference
- addDateAndHour
- addEndnote
- addExternalFile
- addFootnote
- addFormElement
- addHeading
- addImage
- addLink
- addList
- addMathEquation
- addMergeField
- addOLE
- addOnlineVideo
- addPageNumber
- addShape
- addSimpleField
- addSource
- addStructuredDocumentTag
- addSVG
- addTab
- addTable
- addTableContents
- addTableFigures
- addText
- addTextBox
- addWordFragment
- addWordML
- embedHTML
- addBackgroundImage
- addFooter
- addFooterSection
- addHeader
- addHeaderSection
- addLineNumbering
- addMacroFromDoc
- addPageBorders
- addProperties
- addSection
- createDocx
- createDocxAndDownload
- createCharacterStyle
- createListStyle
- createParagraphStyle
- createTableStyle
- docxSettings
- embedFont
- importChartStyle
- importHeadersAndFooters
- importListStyle
- importStyles
- importStylesWordDefault
- modifyPageLayout
- parseStyles
- removeFooters
- removeHeaders
- setBackgroundColor
- setDecimalSymbol
- setDefaultFont
- setDocumentDefaultStyles
- setEncodeUTF8
- setLanguage
- setMarkAsFinal
- setRTL
- clearBlocks
- cloneBlock
- deleteBlock
- getTemplateVariables
- getTemplateVariablesType
- modifyInputFields
- modifyMergeFields
- processTemplate
- removeTemplateVariable
- removeTemplateVariableImage
- replaceBlock
- replaceListVariable
- replacePlaceholderImage
- replaceTableVariable
- replaceVariableByExternalFile
- replaceVariableByHtml
- replaceVariableByText
- replaceVariableByWordFragment
- replaceVariableByWordML
- setTemplateSymbol
- setTemplateBlockSymbol
- tickCheckboxes
encryptPDF
PREMIUM
TRIAL / ADVANCED
Encrypts a PDF file.
Description
public function encryptPDF (string $source, string $target, array $options)
This method allows to encrypt a PDF file. The final user will be prompted to introduce the password included in the $options array to access the contents of the resulting PDF file.
You may find a detailed description of this package in the cryptophpocx section of the API documentation.
Parameters
source
Path to the PDF document that you want to encrypt.
target
Path to the resulting encrypted PDF document.
options
The possible keys and values are:
Key | Type | Description |
---|---|---|
annotations | bool | Import annotations (links, comments and others). Default as false. |
password | string | String of 15 or less characters. |
mode | int |
Default as 0. |
Exceptions
File does not exist.
Password not set.
Release notes
- phpdocx 15.5:
- cast to int object stream content indexes.
- improved annotations support.
- phpdocx 12.0:
- improved annotations support.
- phpdocx 10.0:
- annotations option.