Skip to content

PDFDocument

Namespace: O2S.Components.PDF4NET

Defines an abstract PDF document.

public abstract class PDFDocument

Inheritance ObjectPDFDocument

Properties

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.


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.


ID

Gets or sets the document ID.

public Byte[] ID { get; set; }

Property Value

Byte[]
The PDF identifier of this 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.


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.


Methods

Load(String)

Loads a PDF file and returns either a fixed document or a portfolio depending on the PDF file type.

public static PDFDocument Load(string fileName)

Parameters

fileName String
Path to source PDF file

Returns

PDFDocument
A PDFFixedDocument object or a PDFPortfolio object depending on the PDF file type.


Load(String, String)

Loads a PDF file and returns either a fixed document or a portfolio depending on the PDF file type.

public static PDFDocument Load(string fileName, string password)

Parameters

fileName String
Path to source PDF file

password String
Password for decrypting the PDF file

Returns

PDFDocument
A PDFFixedDocument object or a PDFPortfolio object depending on the PDF file type.


Load(Stream)

Loads a PDF file and returns either a fixed document or a portfolio depending on the PDF file type.

public static PDFDocument Load(Stream stream)

Parameters

stream Stream
Stream that contains the PDF file.

Returns

PDFDocument
A PDFFixedDocument object or a PDFPortfolio object depending on the PDF file type.


Load(Stream, String)

Loads a PDF file and returns either a fixed document or a portfolio depending on the PDF file type.

public static PDFDocument Load(Stream stream, string password)

Parameters

stream Stream
Stream that contains the PDF file.

password String
Password for decrypting the PDF file

Returns

PDFDocument
A PDFFixedDocument object or a PDFPortfolio object depending on the PDF file type.


Save(String)

Saves the PDF document to a file.

public void Save(string fileName)

Parameters

fileName String
File where the PDF document is saved.


Save(String, PDFSecurityHandler)

Saves the PDF document to a file.

public void Save(string fileName, PDFSecurityHandler securityHandler)

Parameters

fileName String
File where the PDF document is saved.

securityHandler PDFSecurityHandler
Security handler for encrypting the saved file.


Save(String, Boolean)

Saves the PDF document to a file.

public void Save(string fileName, bool enableObjectCompression)

Parameters

fileName String
File where the PDF document is saved.

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


Save(String, PDFSecurityHandler, Boolean)

Saves the PDF document to a file.

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

Parameters

fileName String
File where the PDF 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)

Saves the PDF document to the specified stream.

public void Save(Stream stream)

Parameters

stream Stream
Destination stream.


Save(Stream, PDFSecurityHandler)

Saves the PDF document to the specified stream.

public void Save(Stream stream, PDFSecurityHandler securityHandler)

Parameters

stream Stream
Destination stream.

securityHandler PDFSecurityHandler
Security handler for encrypting the saved file.


Save(Stream, Boolean)

Saves the PDF document to the specified stream.

public void Save(Stream stream, bool enableObjectCompression)

Parameters

stream Stream
Destination stream.

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