Table of Contents

Class PdfCopyFields

Namespace
iTextSharp.text.pdf
Assembly
iTextSharp.LGPLv2.Core.dll

Concatenates PDF documents including form fields. The rules for the form field concatenation are the same as in Acrobat. All the documents are kept in memory unlike PdfCopy. @author Paulo Soares (psoares@consiste.pt)

public class PdfCopyFields : IPdfViewerPreferences, IPdfEncryptionSettings
Inheritance
PdfCopyFields
Implements
Inherited Members

Constructors

PdfCopyFields(Stream)

Creates a new instance. @throws DocumentException on error @throws IOException on error

public PdfCopyFields(Stream os)

Parameters

os Stream

the output stream

PdfCopyFields(Stream, char)

Creates a new instance. @throws DocumentException on error @throws IOException on error

public PdfCopyFields(Stream os, char pdfVersion)

Parameters

os Stream

the output stream

pdfVersion char

the pdf version the output will have

Properties

FullCompression

Gets the 1.5 compression status.

public bool FullCompression { get; }

Property Value

bool

true if the 1.5 compression is on

Outlines

Sets the bookmarks. The list structure is defined in {@link SimpleBookmark}.

public IList<INullValueDictionary<string, object>> Outlines { set; }

Property Value

IList<INullValueDictionary<string, object>>

ViewerPreferences

@see com.lowagie.text.pdf.interfaces.PdfViewerPreferences#setViewerPreferences(int)

public int ViewerPreferences { set; }

Property Value

int

Writer

Gets the underlying PdfWriter.

public PdfWriter Writer { get; }

Property Value

PdfWriter

the underlying PdfWriter

Methods

AddDocument(PdfReader)

Concatenates a PDF document. @throws DocumentException on error

public void AddDocument(PdfReader reader)

Parameters

reader PdfReader

the PDF document

AddDocument(PdfReader, ICollection<int>)

Concatenates a PDF document selecting the pages to keep. The pages are described as a List of Integer . The page ordering can be changed but no page repetitions are allowed. @throws DocumentException on error

public void AddDocument(PdfReader reader, ICollection<int> pagesToKeep)

Parameters

reader PdfReader

the PDF document

pagesToKeep ICollection<int>

the pages to keep

AddDocument(PdfReader, string)

Concatenates a PDF document selecting the pages to keep. The pages are described as ranges. The page ordering can be changed but no page repetitions are allowed. @throws DocumentException on error

public void AddDocument(PdfReader reader, string ranges)

Parameters

reader PdfReader

the PDF document

ranges string

the comma separated ranges as described in {@link SequenceList}

AddJavaScript(string)

Adds JavaScript to the global document

public void AddJavaScript(string js)

Parameters

js string

the JavaScript

AddViewerPreference(PdfName, PdfObject)

@see com.lowagie.text.pdf.interfaces.PdfViewerPreferences#addViewerPreference(com.lowagie.text.pdf.PdfName, com.lowagie.text.pdf.PdfObject)

public void AddViewerPreference(PdfName key, PdfObject value)

Parameters

key PdfName
value PdfObject

Close()

Closes the output document.

public void Close()

Open()

Opens the document. This is usually not needed as AddDocument() will do it automatically.

public void Open()

SetEncryption(X509Certificate[], int[], int)

@see com.lowagie.text.pdf.interfaces.PdfEncryptionSettings#setEncryption(java.security.cert.Certificate[], int[], int)

public void SetEncryption(X509Certificate[] certs, int[] permissions, int encryptionType)

Parameters

certs X509Certificate[]
permissions int[]
encryptionType int

SetEncryption(bool, string, string, int)

Sets the encryption options for this document. The userPassword and the ownerPassword can be null or have zero length. In this case the ownerPassword is replaced by a random string. The open permissions for the document can be AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. The permissions can be combined by ORing them. @throws DocumentException if the document is already open

public void SetEncryption(bool strength, string userPassword, string ownerPassword, int permissions)

Parameters

strength bool

true for 128 bit key length. false for 40 bit key length

userPassword string

the user password. Can be null or empty

ownerPassword string

the owner password. Can be null or empty

permissions int

the user permissions

SetEncryption(byte[], byte[], int, bool)

Sets the encryption options for this document. The userPassword and the ownerPassword can be null or have zero length. In this case the ownerPassword is replaced by a random string. The open permissions for the document can be AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. The permissions can be combined by ORing them. @throws DocumentException if the document is already open

public void SetEncryption(byte[] userPassword, byte[] ownerPassword, int permissions, bool strength128Bits)

Parameters

userPassword byte[]

the user password. Can be null or empty

ownerPassword byte[]

the owner password. Can be null or empty

permissions int

the user permissions

strength128Bits bool

true for 128 bit key length, false for 40 bit key length

SetEncryption(byte[], byte[], int, int)

@see com.lowagie.text.pdf.interfaces.PdfEncryptionSettings#setEncryption(byte[], byte[], int, int)

public void SetEncryption(byte[] userPassword, byte[] ownerPassword, int permissions, int encryptionType)

Parameters

userPassword byte[]
ownerPassword byte[]
permissions int
encryptionType int

SetFullCompression()

Sets the document's compression to the new 1.5 mode with object streams and xref streams. It can be set at any time but once set it can't be unset. If set before opening the document it will also set the pdf version to 1.5.

public void SetFullCompression()