signPDF
- 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
sign (for PDF files)
Digitally signs a PDF document.
SignPDF
public sign (string $target, [array $optionsSignature, array $optionsImage, array $options])SignPDFPlus
public sign (string $target, [array $optionsSignature, array $optionsImage])These methods allow you to digitally sign a PDF document.
phpdocx includes two classes to sign PDF documents:
- SignPDF: allows to sign a PDF using one signature.
- SignPDFPlus: allows to sign a PDF using one or more signatures. This class requires well-formed PDF documents. The conversion plugin based on LibreOffice generates well-formed PDF documents when transforming DOCX documents, but other tools such as MS Word may generate not well-formed PDF documents. A not well-formed PDF can be fixed easily, on Repair PDF documents is available more information about this task.
target
Path to save the PDF output.
optionsSignature
The possible keys and values are:
key | Type | Description |
---|---|---|
x | float | Abscissa of the upper-left corner. 180 as default. |
y | float | Ordinate of the upper-left corner. 60 as default |
w | float | Width of the signature area. 15 as default. |
h | float | Height of the signature area. 15 as default |
page | int | Page number (if < 0 the last page is used). -1 as default |
accessPermission | int |
Access permissions granted for this document:
|
info | array |
Signature information:
|
optionsImage
The possible keys and values are:
key | Type | Description |
---|---|---|
src | string | Image file path. |
x | float | Abscissa of the upper-left corner (LTR) or upper-right corner (RTL). 180 as default. |
y | float | Ordinate of the upper-left corner (LTR) or upper-right corner (RTL). 60 as default. |
w | float | Width of the image in the page. If not set, it's automatically calculated. 15 as default. |
h | float | Height of the image in the page. If not set, it's automatically calculated. 15 as default. |
page | int | Page number (if < 0 the last page is used). -1 as default. |
link | string | URL. Empty as default. |
options
The possible keys and values are (required options are shown with yellow background):
key | Type | Description |
---|---|---|
annotations | bool | Import annotations (links, comments and others). Default as false. |
useFixedAnnotationPositions | bool | Force annotation page link IDs. Useful when using PDF readers that don't detect all PDF contents automatically. Default as false. |
The file does not exist.
target
Path to save the PDF output.
optionsSignature
The possible keys and values are:
key | Type | Description |
---|---|---|
x | float | Abscissa of the upper-left corner. 0 as default. |
y | float | Ordinate of the upper-left corner. 0 as default. |
w | float | Width of the signature area. x option + image width as default. |
h | float | Height of the signature area. y option + image height as default. |
page | int | Page number. |
info | array |
Signature information:
|
optionsImage
The possible keys and values are:
key | Type | Description |
---|---|---|
src | string | Image file path. |
Example #1
Example #2
- phpdocx 15.5:
- info option.
- cast to int object stream content indexes.
- improved annotations support.
- phpdocx 14.0:
- useFixedAnnotationPositions option.
- phpdocx 13.0:
- improved working with indirect objects.
- phpdocx 12.0:
- SignPDFPlus class.
- improved annotations support.
- phpdocx 10.0:
- annotations and page options.
- phpdocx 7.0:
- supported PDF 1.5, 1.6 and 1.7 versions.