Skip to content

PDFFlowDocument

Namespace: O2S.Components.PDF4NET.FlowDocument

Defines a PDF document that formats flow content.

public class PDFFlowDocument : O2S.Components.PDF4NET.PDFDocument

Inheritance ObjectPDFDocumentPDFFlowDocument

Constructors

PDFFlowDocument()

Initializes a new PDFFlowDocument object.

public PDFFlowDocument()

PDFFlowDocument(PDFFlowDocumentDefaults)

Initializes a new PDFFlowDocument object.

public PDFFlowDocument(PDFFlowDocumentDefaults documentDefaults)

Parameters

documentDefaults PDFFlowDocumentDefaults
Default values for the document.


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.


HeadersFooters

Gets the document headers and footers.

public PDFFlowDocumentHeadersFooters HeadersFooters { get; }

Property Value

PDFFlowDocumentHeadersFooters
The headers and footers defined 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.


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.


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.


ParentStructureElementForContent

Gets or sets the structure element that serves as parent for the structure elements in the flow content objects.

public PDFStructureElement ParentStructureElementForContent { get; set; }

Property Value

PDFStructureElement
A PDFStructureElement object representing the parent structure element for the flow content objects added to the document.

Remarks

By default the PDFFlowDocument create a PDFStandardStructureTypes.Part as parent for structure elements defined by the flow content objects. This PDFStandardStructureTypes.Part element is a direct child of the PDFStandardStructureTypes.Document structure element which represents the document and is the root of the structure tree.
The new parent applies only to flow content objects added to the document after this property has been set.
The structure element used as parent must be included explicitly in the document' structure tree.


PDFVersion

Gets or sets the PDF version of this PDFDocument object.

public PDFVersion PDFVersion { get; set; }

Property Value

PDFVersion
A PDFFlowDocument.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

AddContent(PDFFlowContent)

Adds new content to the document.

public void AddContent(PDFFlowContent flowContent)

Parameters

flowContent PDFFlowContent
New content to be added to the document.

Remarks

The content is laid out automatically in the available space and subsequent changes on the content have no effect.


AddSpace(Double)

Adds a space after the last flow content.

public void AddSpace(double height)

Parameters

height Double
The height of the space to add.


CloseCurrentPage()

Closes the current page no matter how much content has been added to it. Next content added to document will start on a new page.

public void CloseCurrentPage()

GenerateTableOfContents()

Generates the document's table of contents.

public void GenerateTableOfContents()

GenerateTableOfContents(PDFFlowDocumentTOCSettings)

Generates the document's table of contents.

public void GenerateTableOfContents(PDFFlowDocumentTOCSettings tocSettings)

Parameters

tocSettings PDFFlowDocumentTOCSettings
Settings for generating the table of contents.


GetAvailableSpace()

Gets the available space on current page.

public PDFSize GetAvailableSpace()

Returns

PDFSize
The available space on current page where the next flow content object will be placed.


GetFixedDocument()

Converts the flow document to a fixed document and returns it.

public PDFFixedDocument GetFixedDocument()

Returns

PDFFixedDocument
The fixed document that represents this document.


Save(Stream, PDFSecurityHandler, Boolean)

Saves the 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


StartNewPage()

Starts a new page no matter how much content has been added to current page.

public void StartNewPage()

Events

AfterContentDraw

Gets or sets the event that is fired after a flow content object is drawn on the page.

public event EventHandler<PDFFlowContentDrawEventArgs> AfterContentDraw;

BeforeContentDraw

Gets or sets the event that is fired before a flow content object is drawn on the page.

public event EventHandler<PDFFlowContentDrawEventArgs> BeforeContentDraw;

PageCompleted

Gets or sets the event that is fired when a page has been completed and it can be closed for adding content.

public event EventHandler<PDFFlowPageEventArgs> PageCompleted;

PageCreated

Gets or sets the event that is fired when a new page has been created.

public event EventHandler<PDFFlowPageCreatedEventArgs> PageCreated;