Skip to content

# PDFFixedDocument

Namespace: O2S.Components.PDF4NET

Defines a PDF document.

    public class PDFFixedDocument : PDFDocument

Inheritance Object → PDFDocument → PDFFixedDocument

## Constructors

### PDFFixedDocument()

Initializes a new PDFDocument object.

    public PDFFixedDocument()

### PDFFixedDocument(String)

Initializes a new PDFFixedDocument object.

    public PDFFixedDocument(string fileName)

Parameters

`fileName` String
A string that contains the name of the file from which to create the document.

### PDFFixedDocument(String, PDFDocumentFeatures)

Initializes a new PDFFixedDocument object.

    public PDFFixedDocument(string fileName, PDFDocumentFeatures documentFeatures)

Parameters

`fileName` String
A string that contains the name of the file from which to create the document.

`documentFeatures` PDFDocumentFeatures
Features to load from the PDF file.

### PDFFixedDocument(String, String)

Initializes a new PDFFixedDocument object.

    public PDFFixedDocument(string fileName, string password)

Parameters

`fileName` String
A string that contains the name of the file from which to create the document.

`password` String
Password required to open the PDF file.

### PDFFixedDocument(String, String, PDFDocumentFeatures)

Initializes a new PDFFixedDocument object.

    public PDFFixedDocument(string fileName, string password, PDFDocumentFeatures documentFeatures)

Parameters

`fileName` String
A string that contains the name of the file from which to create the document.

`password` String
Password required to open the PDF file.

`documentFeatures` PDFDocumentFeatures
Features to load from the PDF file.

### PDFFixedDocument(Stream)

Initializes a new PDFDocument object from a PDF stream.

    public PDFFixedDocument(Stream stream)

Parameters

`stream` Stream
Stream that contains PDF content.

### PDFFixedDocument(Stream, PDFDocumentFeatures)

Initializes a new PDFDocument object from a PDF stream with the specified features.

    public PDFFixedDocument(Stream stream, PDFDocumentFeatures documentFeatures)

Parameters

`stream` Stream
Stream that contains PDF content.

`documentFeatures` PDFDocumentFeatures
Features to load from the PDF file.

### PDFFixedDocument(Stream, String)

Initializes a new PDFDocument object from a PDF stream.

    public PDFFixedDocument(Stream stream, string password)

Parameters

`stream` Stream
Stream that contains PDF content.

`password` String
Password required to open the PDF file.

### PDFFixedDocument(Stream, String, PDFDocumentFeatures)

Initializes a new PDFDocument object from a PDF stream with the specified features.

    public PDFFixedDocument(Stream stream, string password, PDFDocumentFeatures documentFeatures)

Parameters

`stream` Stream
Stream that contains PDF content.

`password` String
Password required to open the PDF file.

`documentFeatures` PDFDocumentFeatures
Features to load from the PDF file.

## Properties

### AfterPrintAction

Gets or sets the javascript action to execute after the document is printed.

    public PDFJavaScriptAction AfterPrintAction { get; set; }

Property Value

PDFJavaScriptAction
A PDFJavaScriptAction object specifying the action to be executed after the document is printed.

### AfterSaveAction

Gets or sets the javascript action to execute after the document is saved.

    public PDFJavaScriptAction AfterSaveAction { get; set; }

Property Value

PDFJavaScriptAction
A PDFJavaScriptAction object specifying the action to be executed after the document is saved.

### BeforeCloseAction

Gets or sets the javascript action to execute before the document is closed.

    public PDFJavaScriptAction BeforeCloseAction { get; set; }

Property Value

PDFJavaScriptAction
A PDFJavaScriptAction object specifying the action to be executed before the document is closed.

### BeforePrintAction

Gets or sets the javascript action to execute before the document is printed.

    public PDFJavaScriptAction BeforePrintAction { get; set; }

Property Value

PDFJavaScriptAction
A PDFJavaScriptAction object specifying the action to be executed before the document is printed.

### BeforeSaveAction

Gets or sets the javascript action to execute before the document is saved.

    public PDFJavaScriptAction BeforeSaveAction { get; set; }

Property Value

PDFJavaScriptAction
A PDFJavaScriptAction object specifying the action to be executed before the document is saved.

### CosDictionary

Gets the COS dictionary asssociated with this object.

    public PDFCosDictionary CosDictionary { get; }

Property Value

PDFCosDictionary
The internal COS dictionary.

Remarks

Incorrect manipulation of the information in the COS dictionary can lead to invalid PDF files.

### DisplayMode

Gets or sets how the document should be displayed when opened in the viewer.

    public PDFDisplayMode DisplayMode { get; set; }

Property Value

PDFDisplayMode
A PDFDisplayMode enumeration member specifying how the viewer should display the document.

### DocumentInformation

Gets or sets the document information.

    public PDFDocumentInformation DocumentInformation { get; set; }

Property Value

PDFDocumentInformation
The document's metadata.

### DocumentSecurityStore

Gets or sets the document security store.

    public PDFDocumentSecurityStore DocumentSecurityStore { get; set; }

Property Value

PDFDocumentSecurityStore
A PDFDocumentSecurityStore object.

Remarks

The document security store includes relevant information for validating digital signatures.
It supports the ability to add this critical information after the signed document has been created and before this information is no longer available.

### FileAttachments

Gets the list of file attachments embedded in this document.

    public PDFDocumentFileAttachmentCollection FileAttachments { get; }

Property Value

PDFDocumentFileAttachmentCollection
PDFDocumentFileAttachmentCollection object specifying the list of document attachments.

Remarks

When a PDF file is imported into a PDFDocument object, this collection is populated automatically with the attachments in the file.

### Form

Gets the PDF form included in the document.

    public PDFForm Form { get; }

Property Value

PDFForm
A PDFForm object representing the PDF form included in the document.

### ID

Gets or sets the document ID.

    public Byte[] ID { get; set; }

Property Value

Byte[]
The PDF identifier of this document.

### JavaScriptBlocks

Gets the JavaScript source code blocks.

    public PDFJavaScriptBlockCollection JavaScriptBlocks { get; }

Property Value

PDFJavaScriptBlockCollection
The collection of JavaScript source code block that are embedded in the document.

### Language

Gets or sets the document language.

    public string Language { get; set; }

Property Value

String
A language identifier that shall specify the natural language for all text in the document except where overridden by language specifications for structure elements or marked content.

### MarkInformation

Gets or sets the document mark information.

    public PDFMarkInformation MarkInformation { get; set; }

Property Value

PDFMarkInformation
A PDFMarkInformation object specifying whether the document conforms to Tagged PDF specification.

### NamedDestinations

Gets the list of named destination included in the document.

    public PDFNamedDestinationCollection NamedDestinations { get; }

Property Value

PDFNamedDestinationCollection
The list of named destinations included in the document.

### OpenAction

Gets or sets the action to execute when the document is opened.

    public PDFAction OpenAction { get; set; }

Property Value

PDFAction
A PDFAction object specifying the action to be executed when documents opens in the viewer.

### OptionalContentProperties

Gets the optional content properties for this document.

    public PDFOptionalContentProperties OptionalContentProperties { get; set; }

Property Value

PDFOptionalContentProperties
The properties related to optional content included in the document.

### Outline

Gets the document outline.

    public PDFOutlineItemCollection Outline { get; }

Property Value

PDFOutlineItemCollection
A tree-structured hierarchy of outline items.

### OutputIntents

Gets or sets the collection of output intents.

    public PDFOutputIntentCollection OutputIntents { get; set; }

Property Value

PDFOutputIntentCollection
A collection of PDFOutputIntent objects describing the color characteristics of output devices on which the document might be rendered.

### PageLabelingRanges

Gets the list of page labeling ranges in the PDF document.

    public PDFPageLabelingRangeCollection PageLabelingRanges { get; }

Property Value

PDFPageLabelingRangeCollection
The list of page labeling ranges in the document.

### PageLayout

Gets or sets the document's page layout specifying how the pages should be displayed when opened.

    public PDFPageLayout PageLayout { get; set; }

Property Value

PDFPageLayout
The document's page layout.

### Pages

Gets the list of pages in the document;

    public PDFPageCollection Pages { get; }

Property Value

PDFPageCollection
The document's pages.

### PDFVersion

Gets or sets the PDF version of this PDFDocument object.

    public PDFVersion PDFVersion { get; set; }

Property Value

PDFVersion
A PDFFixedDocument.PDFVersion enumeration member specifying the PDF version of this PDFDocument object.

### SecurityHandler

Gets the document security handler.

    public PDFSecurityHandler SecurityHandler { get; }

Property Value

PDFSecurityHandler
A PDFSecurityHandler that represents the handler used to encrypt the file loaded in this PDFDocument.

Remarks

Both RC4 and AES security handlers are supported.

### StructureTree

Gets or sets the document structure tree.

    public PDFStructureTree StructureTree { get; set; }

Property Value

PDFStructureTree
The root of the document structure tree.

### VersionExtension

Gets or sets the version extension.

    public PDFVersionExtension VersionExtension { get; set; }

Property Value

PDFVersionExtension
The extended PDF version this document implements.

### ViewerPreferences

Gets or sets the document's viewer preferences.

    public PDFViewerPreferences ViewerPreferences { get; set; }

Property Value

PDFViewerPreferences
The viewer preferences for displaying the document.

### XmpMetadata

Gets or sets the XMP document metadata.

    public PDFXmpMetadata XmpMetadata { get; set; }

Property Value

PDFXmpMetadata
The XMP document metadata.

## Methods

### AppendFile(String)

Appends a PDF file at the end of the document.

    public void AppendFile(string fileName)

Parameters

`fileName` String
Path to PDF file to append.

### AppendFile(Stream)

Appends a PDF file at the end of the document.

    public void AppendFile(Stream stream)

Parameters

`stream` Stream
Stream with the file to append.

### BeginSave(Stream)

Initializes a save procedure for the PDF file.

    public void BeginSave(Stream stream)

Parameters

`stream` Stream
Destination stream where the PDF file will be saved.

### BeginSave(Stream, PDFSecurityHandler)

Initializes a save procedure for the PDF file.

    public void BeginSave(Stream stream, PDFSecurityHandler securityHandler)

Parameters

`stream` Stream
Destination stream where the PDF file will be saved.

`securityHandler` PDFSecurityHandler
Security handler for encrypting the saved file.

### BeginSave(Stream, PDFStandardFormatter)

Initializes a save procedure for the PDF file.

    public void BeginSave(Stream stream, PDFStandardFormatter standardFormatter)

Parameters

`stream` Stream
Destination stream where the PDF file will be saved.

`standardFormatter` PDFStandardFormatter
Formatter for saving the PDF file according to a specific PDF standard.

### CertifyDocument(PDFSignatureField, PDFDigitalSignatureAllowedChanges)

Certifies the document with the given signature.

    public void CertifyDocument(PDFSignatureField signatureField, PDFDigitalSignatureAllowedChanges allowedChanges)

Parameters

`signatureField` PDFSignatureField
The field that stores the certifying signature.

`allowedChanges` PDFDigitalSignatureAllowedChanges
The changes allowed by the signature.

Remarks

This method transforms the signature in the field from an approval signature into a certifying (author) signature. This method should be called only once as a PDF document supports only one certifying signature.

### EndSave()

Finishes the save procedure initiated by PDFFixedDocument.BeginSave(Stream) method.

    public void EndSave()

### GetCosObjectByNumber(UInt32, Boolean)

Gets the specified COS object.

    public PDFCosObject GetCosObjectByNumber(uint objectNumber, bool loadStreamContent)

Parameters

`objectNumber` UInt32
The object number of the specified COS object.

`loadStreamContent` Boolean
If true then the stream content is also loaded when the object number specifies a stream object. Otherwise only the dictionary part of the stream is loaded.

Returns

PDFCosObject
The COS object if exists, null otherwise.

Remarks

This method should be used with PDFFixedDocument objects created from existing PDF files. For newly created document this method returns null.

### GetCosObjectCount()

Gets the total number of COS objects in the document.

    public int GetCosObjectCount()

Returns

Int32
The total number of COS objects in the document.

Remarks

This method should be used with PDFFixedDocument objects created from existing PDF files. For newly created documents this method returns 0.

### GetDocumentFonts(Boolean, Boolean)

Gets the set of fonts included in the document.

    public HashSet<PDFCosDictionary> GetDocumentFonts(bool includeEmbeddedFont, bool includeNonEmbeddedFonts)

Parameters

`includeEmbeddedFont` Boolean
True if the set should include the embedded fonts.

`includeNonEmbeddedFonts` Boolean
True if the set should include the non-embedded fonts.

Returns

HashSet<PDFCosDictionary>
A set of PDFCosDictionary objects representing the fonts used by this document.

### InsertFile(Int32, Int32, String)

Inserts a PDF file in the document.

    public void InsertFile(int pageIndex, int outlineIndex, string fileName)

Parameters

`pageIndex` Int32
Position in the PDFFixedDocument.Pages collection where the pages from the file are inserted.

`outlineIndex` Int32
Position in the PDFFixedDocument.Outline collection where the outlines from the file are inserted.

`fileName` String
Path to PDF file to append.

### InsertFile(Int32, Int32, Stream)

Inserts a PDF file in the document.

    public void InsertFile(int pageIndex, int outlineIndex, Stream stream)

Parameters

`pageIndex` Int32
Position in the PDFFixedDocument.Pages collection where the pages from the file are inserted.

`outlineIndex` Int32
Position in the PDFFixedDocument.Outline collection where the outlines from the file are inserted.

`stream` Stream
Stream with the file to insert.

### Save(String, PDFSecurityHandler, Boolean)

Saves the document to the specified file.

    public void Save(string fileName, PDFSecurityHandler securityHandler, bool enableObjectCompression)

Parameters

`fileName` String
A string that contains the name of the file where the document is saved.

`securityHandler` PDFSecurityHandler
Security handler for encrypting the saved file.

`enableObjectCompression` Boolean
When set to true, the structure of the PDF objects is also compressed. Supported when PDF version >= 1.5

### Save(Stream, PDFSecurityHandler, Boolean)

Saves the PDF document to the specified stream.

    public void Save(Stream stream, PDFSecurityHandler securityHandler, bool enableObjectCompression)

Parameters

`stream` Stream
Destination stream.

`securityHandler` PDFSecurityHandler
Security handler for encrypting the saved file.

`enableObjectCompression` Boolean
When set to true, the structure of the PDF objects is also compressed. Supported when PDF version >= 1.5