- addBackgroundImage
- addFooter
- addHeader
- addLineNumbering
- addMacroFromDoc
- addPageBorders
- addProperties
- addSection
- createCharacterStyle
- createListStyle
- createParagraphStyle
- docxSettings
- importHeadersAndFooters
- importListStyle
- importStyles
- modifyPageLayout
- parseStyles
- removeFooters
- removeHeaders
- setBackgroundColor
- setDefaultFont
- setDocumentDefaultStyles
- setEncodeUTF8
- setLanguage
- setMarkAsFinal
pdx:protectPDF
Password protects the contents of a PDF document.
This element allows to password protect a PDF document. One may protect the PDF from being printed, copied, etcetera.
Notice that this element does not encrypt the contents of the PDF document. This element is not secure and can be easily overridden by an experienced user.
You may find a detailed description of this package in the Cryptophpdocx section of the API documentation.
src
Path to the PDF document we want to protect.
target
Path to the resulting protected PDF document.
options
The possible keys and values are (required options are shown with yellow background):
key | Description |
---|---|
permissionsBlocked |
|
passwordOwner | String to allow full access to the PDF file. |
config.xml
<pdx:document xmlns:pdx="http://www.phpdocx.com/main">
<pdx:config>
<pdx:output pdx:name="output" pdx:type="pdf" />
<pdx:crypto>
<pdx:protect pdx:password="xmldocx" pdx:src="/var/www/xmldocx/samples/files/Test.pdf" pdx:target="/var/www/xmldocx/samples/Crypto/protectPdf/Protected.pdf" pdx:type="print,annot-forms" />
</pdx:crypto>
</pdx:config>
</pdx:document>
content.xml
settings.xml
import os as os
import sys as sys
sys.path.append(os.path.abspath("wrappers/python/XmlDocx"))
import XmlDocx as XmlDocx
document = XmlDocx.XmlDocx("config.xml")
document.setDocumentProperties("settings.xml")
document.addContent("content.xml")
document.setXmlDocxPath("xmldocx path")
document.render()