Document Interface

The Adobe PDF Library supplies the ability to create and manipulate one or more document objects. The Library may have any number of documents active at any given time. These documents may either be read into the Library from an external source, or have been created entirely within the Library. These document-interface routines follow the job interface. A document has a number of properties which describe:

  • how the document is to be written to an external form: either PDF, which may be read again, or PostScript, which may not be re-read
  • adding or removing pages in documents, or moving pages from one document to another
  • a number of related areas within the document to be identified and indexed, enabling rearrangement and output of these areas in a specified order
  • how the document should be seen in the initial view of a document browser (In addition, a hierarchical structure of the document can be created as a navigational device.)
  • permissions and document information obtained by flags which are carried in the page

The following tables identify the high-level functional specifications of the most significant document interface routines. These tables are categorized by property: Document File, Thread, Bookmark, Page Mode, Font List and Document Information.

Document File

Order Method Description
1  PDDocCreate() Creates a new document, saving the resulting   document handle.
2  PDDocOpen() Accesses an existing document by specifying a file name, a file system, a procedure to be used to test authorization (default is omitted), and a flag indicating if the document read is to be repaired if it appears damaged.
3  PDDocSave() Writes a document as a PDF by specifying a document object, save flags, a file name, and optionally a file system name, a procedure to function as a monitor (informing you of status as the save progresses) and a procedure to use as the monitor’s client.  The save flag declarations are PDFSaveIncremental, PDSaveFull, PDSaveCopy and PDSaveLinearized.
4  PDFLPrintPDF() Prints a document to PostScript by specifying a document object, a file name and a print parameter object. Refer to the SDK file PrintLib.h for the values of the print parameter object.
5  PDFLToPs() Writes a document to PostScript by specifying document, path, and control.
6  PDDocRelease() Permits a document to be moved out of memory when no longer needed for active processing (but leaves it in the Library’s cache).
7  PDDocAcquire() Moves a document back into active memory.
8  PDDocClose() Removes a document from cache and memory when there is no further use for it.
9  PDEnumDocs() For each currently existing document, calls the procedure named as its only parameter once for each document defined to the Library. The Library may have any number of active documents, either created or read. Pages may be added, removed, or moved from one document to another.

 Bookmark

The bookmark object is a collection of bookmark operators. Similar to a Table of Contents, bookmarks aid navigation by acting as live links within the displayed document. Bookmarks may be hierarchically nested; the hierarchy is presented as varying levels of indent when the bookmarks are displayed.

Order Method Description
1  PDDocGetBookmarkRoot() Obtains the root node for the bookmarks of a given document.

 Page Mode

The initial page viewing mode can be set to display one or a combination of the following:

  • bookmarks
  • thumbnails
  • document
Order Method Description
1  PDDocSetPageMode() Sets the value of the enumerated data type value of the PDPageMode. The mode choices are PDDontCare, PDUse-None, PDUseThumbs, PDUseBookmarks and PDFullScreen.
2  PDDocGetPageMode() Gets the value of the PDPageMode key.

 Font List

The font object describes a specific font and encoding to be used to image text.

Order Method Description
1  PDDocEnumFonts() Calls the specified procedure once for each font occurring in the specified document.

 Document Information

Information about the document’s file and its state are set by flags. The bit field, composed of the values of the flags, returns the requested information.

Order Method Description
1 PDDocSetFlags() Sets information about the document’s file and its state. The enumerated data type flags specify various file status attributes. These PDDocFlags declarations are:

  • PDDocRequiresFullSave
  • PDDocIsModified
  • PDDocDeleteOnClose
  • PDDocWasRepaired
  • PDDocNewMajorVersion
  • PDDocNewMinorVersion
  • PDDocOldVersion
  • PDDocSuppressErrors
  • PDDocIsEmbedded
  • PDDocIsLinearized
2  PDDocGetFlags() Gets information about the document’s file and its state.
3  PDDocClearFlags() Clears flags associated with a document.
4  PDDocGetFile() Gets the ASfile for a document which was read or written.
5  PDDocGetID() Gets the unique PDF file ID reference of a document.
6  PDDocGetNumPages Gets the number of pages in a document.
7  PDDocGetVersion Gets the major and minor PDF document versions, which are specified in the header of a PDF file.