Click or drag to resize

SDFDoc Class

SDFDoc is a low-level document representing a graph of SDF.Obj nodes that can be used to build higher-level document models such as PDF(Portable Document Format) or FDF(Forms Document Format).

SDF Doc brings together document security, document utility methods, and all SDF objects.

Inheritance Hierarchy
SystemObject
  pdftron.SDFSDFDoc

Namespace:  pdftron.SDF
Assembly:  pdftron (in pdftron.dll) Version: 255.255.255.255
Syntax
public sealed class SDFDoc : IClosable

The SDFDoc type exposes the following members.

Constructors
  NameDescription
Public methodSDFDoc
Creates a new SDF document.
Public methodSDFDoc(Byte)
Creates a new SDF document from an array of bytes.
Public methodSDFDoc(String)
Creates a new SDF document from the specified full path of the file.
Public methodSDFDoc(IBuffer)
Creates a new SDF document from a buffer.
Public methodSDFDoc(IFilter)
Creates a new SDF document from an existing IFilter instance.
Public methodSDFDoc(PDFDoc)
Creates a new SDF document from an existing PDFDoc instance.
Top
Methods
  NameDescription
Public methodClearMarks
Removes 'marked' flag from all objects in cross reference table.
Public methodClose
Public methodCreateIndirectArray
Creates an indirect Array Obj.
Public methodCreateIndirectBool
Creates an indirect Bool Obj.
Public methodCreateIndirectDict
Creates an indirect Dict Obj.
Public methodCreateIndirectName
Creates an indirect Name Obj.
Public methodCreateIndirectNull
Creates an indirect Null Obj.
Public methodCreateIndirectNumber
Creates an indirect Number Obj.
Public methodCreateIndirectStream(Byte)
Creates an indirect stream.
Public methodCreateIndirectStream(FilterReader)
Creates an indirect stream.
Public methodCreateIndirectStream(Byte, IFilter)
Creates an indirect stream.
Public methodCreateIndirectStream(FilterReader, IFilter)
Creates an indirect stream.
Public methodCreateIndirectString(Byte)
Creates an indirect String Obj.
Public methodCreateIndirectString(String)
Creates an indirect String Obj.
Public methodDestroy
Closes/Destroys this document.
Public methodEnableDiskCaching
Sets this document to use a temporary file in order to cache new content streams.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodGetFileName
Gets the filename of this SDFDoc.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetHeader
Gets the PDF file header.
Public methodGetHintStream
Gets document's initial linearization hint stream if it is available.
Public methodGetLinearizationDict
Gets document's initial linearization dictionary if it is available.
Public methodGetObj
Gets the Obj specified by the object number.
Public methodGetTrailer
Gets the trailer of this document.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodHasRepairedXRef
Checks whether or not the underlying file has an XRef table that had to be repaired when the file was opened.If the document had an invalid XRef table when opened, PDFNet will have repaired the XRef table for its working representation of the document.
Public methodImportObj
Import an Obj to this document.
Public methodInitSecurityHandler
Initializes document's SecurityHandler. This version of InitSecurityHandler() works with Standard and Custom PDF security and can be used in situations where the password is obtained dynamically via user feedback. See EncTest sample for example code. This function should be called immediately after an encrypted document is opened. The function does not have any side effects on documents that are not encrypted. If the security handler was successfully initialized it can be later obtained using GetSecurityHandler() method.
Public methodInitStdSecurityHandler(Byte)
Initializes document's SecurityHandler. This version of InitSecurityHandler() works with Standard and Custom PDF security and can be used in situations where the password is obtained dynamically via user feedback. See EncTest sample for example code. This function should be called immediately after an encrypted document is opened. The function does not have any side effects on documents that are not encrypted. If the security handler was successfully initialized it can be later obtained using GetSecurityHandler() method.
Public methodInitStdSecurityHandler(String)
Initializes document's SecurityHandler. This version of InitSecurityHandler() works with Standard and Custom PDF security and can be used in situations where the password is obtained dynamically via user feedback. See EncTest sample for example code. This function should be called immediately after an encrypted document is opened. The function does not have any side effects on documents that are not encrypted. If the security handler was successfully initialized it can be later obtained using GetSecurityHandler() method.
Public methodIsEncrypted
Checks if this document is encrypted.
Public methodIsFullSaveRequired
Checks if is full save required.
Public methodIsLinearized
Call this function to determine whether the document is represented in linearized(fast web view) format.
Public methodIsModified
Checks if this document is modified.
Public methodLock
Locks the document to prevent competing threads from accessiong the document at the same time. Threads attempting to access the document will wait in suspended state until the thread that owns the lock calls doc.Unlock().
Public methodLockRead
Locks the document to prevent competing write threads (using Lock()) from accessing the document at the same time. Other reader threads however, will be allowed to access the document. Threads attempting to obtain write access to the document will wait in suspended state until the thread that owns the lock calls doc.UnlockRead().
Public methodSaveAsync(String, SDFDocSaveOptions, String)
Saves the document to a specified file.
Public methodSaveAsync(IFilter, SDFDocSaveOptions, String)
Saves all changes to the document and writes them to an output IFilter sink.
Public methodSaveToBufferAsync
Saves all changes to the document and writes them to a buffer
Public methodSwap
Gets the security handler.
Public methodTimedLock
Try locking the document, waiting no longer than specified number of milliseconds.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodTryLock
Try locking the document.
Public methodUnlock
Removes the lock from the document.
Public methodUnlockRead
Removes the read lock from the document.
Public methodXRefSize
Gets the size of the cross reference table.
Top
Remarks

Note that the examples above used doc.GetTrailer() in order to access document trailer, the starting SDF object(root node) in every document. Following the trailer links, it is possible to visit all low-level objects in a document(e.g. all pages, outlines, fonts, etc).

SDFDoc also provides utility methods used to import objects and object collections from one document to another. These methods can be useful for copy operations between documents such as a high-level page merge and document assembly.

Examples
A SDF document can be created from scratch using a default constructor:
SDFDoc mydoc = new SDFDoc();
Obj trailer = mydoc.GetTrailer();
SDF document can be also created from an existing file(e.g. an external PDF document):
SDFDoc mydoc = new SDFDoc("in.pdf");
Obj trailer = mydoc.GetTrailer();
SDF document can be also created from a memory buffer or some other Filter/Stream such as a HTTP Filter connection:
MemoryFilter memory = ....
SDFDoc mydoc = new SDFDoc(memory);
Obj trailer = mydoc.GetTrailer();
SDF document can be accessed from a high-level PDF document as follows:
PDFDoc doc = new PDFDoc("in.pdf");
SDFDoc mydoc = doc.GetSDFDoc();
Obj trailer = mydoc.GetTrailer();
See Also