PDF Security Options

Top Previous Topic Next Topic  Print this topic

The xf:security element can be used to specify advanced PDF security options.

 

Example of usage:

 

 

       <?xml version="1.0" encoding="utf-8" standalone="no"?>

       <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xf="http://www.ecrion.com/xf/1.0">

               <xf:security owner-password="ownerpass" user-password="userpass" encryption-strength="128" allow-printing="true" allow-modify-contents="true" allow-copy="true" allow-modify-annotations="true" allow-fill-in="true" allow-screen-readers="true" allow-assembly="true" allow-degraded-printing="true"/>

               <fo:layout-master-set>

                       <fo:simple-page-master master-name="all-pages" page-height="2in" page-width="6in">

                               <fo:region-body region-name="xsl-region-body" column-gap="0.25in" padding="6pt" margin="0.7in" />

                               <fo:region-before region-name="xsl-region-before" display-align="after" extent="0.7in" padding="6pt"/>

                               <fo:region-after region-name="xsl-region-after" display-align="before" extent="0.7in" padding="6pt"/>

                       </fo:simple-page-master>

                       <fo:page-sequence-master master-name="default-sequence">

                               <fo:repeatable-page-master-reference master-reference="all-pages"/>

                       </fo:page-sequence-master>

               </fo:layout-master-set>

               <fo:page-sequence master-reference="default-sequence">

                       <fo:flow flow-name="xsl-region-body">

                               <fo:block>Hello World!</fo:block>

                       </fo:flow>

               </fo:page-sequence>

       </fo:root>

 

 

The element must be placed inside the fo:root tag, before any fo:page-sequence elements.

 

The following attributes are supported:

The owner-password attribute allows setting an owner password for the PDF output file.
The user-password attribute allows setting a user password for the PDF output file.
The encryption-strength attribute allows specifying the encryption strength. Valid options are "40" and "128". The default value is "40".

 

 

PDF Permission Flags

 

Name

Description

allow-printing

If this flag is set, the user will be allowed to print the document.

allow-modify-contents

Specifies whether the user can modify the document's content.

allow-copy

Specifies whether the user can copy content from the document.

allow-modify-annotations

Specifies whether the user can modify the document's annotations.

allow-fill-in

Specifies whether the user can fill in the forms present in the document.

allow-screen-readers

Specifies whether the document can be read by Acrobat Reader.

allow-assembly

Allows the user to assemble the document (inserting, rotating, or deleting pages and creating bookmarks or thumbnail images).

allow-degraded-printing

Allows the user to print the document as a raster image.

 

Note:

If the xf:security element is present, then all flags default to false unless otherwise specified. If the element is absent, then no restrictions are enforced.