Click or drag to resize

pdftron.PDF Namespace

Classes to work with Portable Document Format (PDF) files and constructs.
Classes
  ClassDescription
Public classAction
Action that is triggered when the document is opened. The returned action can be either a destination or some other kind of Action (see Section 8.5, 'Actions' in PDF Reference Manual).
Public classActionEventArgs
Class for Transporting the OnAction event
Public classActionParameter
Container for parameters used in handling various actions
Public classAnnot
Public classAnnotBorderStyle
BorderStyle structure specifies the Characteristics of the annotation’s border. The border is specified as a rounded rectangle.
Public classBitmapInfo
Represents a raw bitmap returned by PDFDraw.GetRawBitmapAsync.
Public classBookmark
Gets the first bookmark
Public classCharData
CharData is a data structure returned by CharIterator that is used to provide extra information about a Character within a text run. The extra information includes positioning information, the Character data and a number of bytes taken by the Character.
Public classCharIterator
CharIterator is an iterator type that can be used to traverse CharData in the current e_text element. For a sample use case, please take a look at ElementReaderAdv sample project.
Public classColorPt
ColorPt is an Array of colorants (or tint values) representing a color point in an associated color space.
Public classColorSpace
This abstract class is used to serve as a color space tag to identify the specific color space of a Color object. It contains methods that transform colors in a specific color space to/from several color space such as DeviceRGB and DeviceCMYK. For purposes of the methods in this class, colors are represented as Arrays of color components represented as doubles in a normalized range defined by each ColorSpace. For many ColorSpaces (e.g. DeviceRGB), this range is 0.0 to 1.0. However, some ColorSpaces have components whose values have a different range. Methods are provided to inquire per component minimum and maximum normalized values.
Public classCode exampleContentReplacer
ContentReplacer is a utility class for replacing content (text and images) in existing PDF (template) documents. Users can replace content in a PDF page using the following operations: - Replace an image that exists in a target rectangle with a replacement image. - Replace text that exists in a target rectangle with replacement text. - Replace all instances of a specially marked string with replacement string.
Examples
The following code replaces an image in a target region. It also replaces the text "[NAME]" and "[JOB_TITLE]" with "John Smith" and "Software Developer" respectively. Notice the square braces ('[' and ']') on the target strings in the original PDFDoc. These square braces are not included in the actual function calls below, as they're implicitly added.
PDFDoc doc("../../TestFiles/BusinessCardTemplate.pdf");
doc.InitSecurityHandler();
ContentReplacer replacer;
Page pg = doc.GetPage(1);
Image img = Image::Create(doc, "../../TestFiles/peppers.jpg");
replacer.AddImage(page.GetMediaBox(), img.GetSDFObj());
replacer.AddString("NAME", "John Smith");
replacer.AddString("JOB_TITLE", "Software Developer");
replacer.Process(page);
Public classConversionMonitor
Allows for progress reporting of a conversion
Public classCode exampleConvert
Converter is a utility class used to convert documents and files to PDF. Conversion of XPS, EMF and image files to PDF documents is performed internally. Other document formats are converted via native application and printing.
Public classCubicCurveBuilder
Creates Cubic Curves from linear points
Public classDate
Gets the creation date.
Public classCode exampleDestination
A utility method used to set the fist page displayed after the document is opened. This method is equivalent to PDFDoc::SetOpenAction(goto_action) If OpenAction is not specified the document should be opened to the top of the first page at the default magnification factor.
Public classDiffOptions
Public classDigitalSignatureField
A class representing a digital signature form field.
Public classDigitalSignatureFieldIterator
DigitalSignatureFieldIterator is an iterator type that can be used to traverse a list of digital signature form fields in a PDF document.
Public classDocumentConversion
Encapsulates the conversion of a single document from one format to another.
Public classDocumentPreviewCache
DocumentPreviewCache is a persistent cache that provides thumbnails for browsing in PDFNet. The cache is placed in the sub - directory 'trn_DocumentPreviewCache' of the PDFNet Resources folder, which can be set by calling PDFNet::SetPersistentCachePath.In the case the PersistentCachePath is not set the files will be stored in the system temp path (PDFNet::GetSystemTempPath()).The cache will be used by any PDFNet process that uses the resource path.If more than one PDFNet process is running concurrently, the first process to acquire a lock on the cache will use it.Subsequent processes will not read or modify the cache. DocumentPreviewCache will store references to generated JPG thumbnails and keeps track of the dimensions of the thumbnail and the filesize of the specific pdf documents. Furthermore it takes care that the size constraints(max_cache_bytes, max_disk_percentage) are met and it cleans the oldest(in terms of last request) thumbs from the cache in case of a overflow. If the user requests a file that is already in the cache and the requested thumb dimensions are smaller or equal than the ones of the cache - version the URL of the cached thumb is given back.If the dimensions are bigger the thumb gets rendered again, the old thumb gets replaced and the URL is given back. If the size of the pdf document changes the thumb will be rendered again even when there is a version of that thumbnail in the cache.In case that the user wants to suppress the re-rendering of that specific thumb(e.g.when the change on the pdf document was made on another page than the first page which is used for the thumb), IrrelevantChangeMade has to be called.
Remarks
Note: Always call the DocumentPreviewCache from the UI thread.
Public classElement
Element is the abstract interface used to access graphical elements used to build the display list. Just like many other classes in PDFNet (e.g. ColorSpace, Font, Annot, etc), Element class follows the composite design pattern. This means that all Elements are accessed through the same interface, but depending on the Element type (that can be obtained using GetType()), only methods related to that type can be called. For example, if GetType() returns e_image, it is illegal to call a method specific to another Element type (i.e. a call to a text specific GetTextData() will throw an Exception).
Public classElementBuilder
ElementBuilder is used to build new PDF.Elements (e.g. image, text, path, etc) from scratch. In conjunction with ElementWriter, ElementBuilder can be used to create new page content.
Public classCode exampleElementReader
ElementReader can be used to parse and process content streams. ElementReader provides a convenient interface used to traverse the Element display list of a page. The display list representing graphical elements (such as text-runs, paths, images, shadings, forms, etc) is accessed using the intrinsic iterator. ElementReader automatically concatenates page contents spanning multiple streams and provides a mechanism to parse contents of sub-display lists (e.g. forms XObjects and Type3 fonts).
Public classElementWriter
ElementWriter can be used to assemble and write new content to a page, Form XObject, Type3 Glyph stream, pattern stream, or any other content stream.
Public classCode exampleField
Flatten/Merge existing form field appearances with the page content and remove widget annotation. Form 'flattening' refers to the operation that changes active form fields into a static area that is part of the PDF document, just like the other text and images in the document. A completely flattened PDF form does not have any widget annotations or interactive fields.
Public classFieldIterator
FieldIterator is an iterator type that can be used to traverse a list form fields in a PDF document. For more information, please PDFDoc.getFieldIterator().
Public classCode exampleFileSpec
Associates a file attachment with the document. The file attachment will be displayed in the user interface of a viewer application (in Acrobat this is File Attachment tab). The function differs from Annot.CreateFileAttachment() because it associates the attachment with the whole document instead of an annotation on a specific page.
Public classFont
A font that is used to draw text on a page. It corresponds to a Font Resource in a PDF file. More than one page may reference the same Font object. A Font has a number of attributes, including an Array of widths, the Character encoding, and the font’s resource name. PDF document can contain several different types of fonts and Font class represents a single, flat interface around all PDF font types. There are two main classes of fonts in PDF: simple and composite fonts. Simple fonts are Type1, TrueType, and Type3 fonts. All simple fonts have the following properties:
  • Glyphs in the font are selected by single-byte Character codes obtained from a string that is shown by the text-showing operators. Logically, these codes index into a table of 256 glyphs; the mapping from codes to glyphs is called the font’s encoding. Each font program has a built-in encoding. Under some circumstances, the encoding can be altered by means described in Section 5.5.5 "Character Encoding" in PDF Reference Manual.
  • Each glyph has a single set of metrics. Therefore simple fonts support only horizontal writing mode.
A composite font is one whose glyphs are obtained from a font like object called a CIDFont (e.g. CIDType0Font and CIDType0Font). A composite font is represented by a font dictionary whose Subtype value is Type0. The Type 0 font is known as the root font, while its associated CIDFont is called its descendant. CID-keyed fonts provide a convenient and efficient method for defining multiple-byte Character encodings and fonts with a large number of glyphs. These capabilities provide great flexibility for representing text in writing systems for languages with large Character sets, such as Chinese, Japanese, and Korean (CJK).
Public classFontCharCodeIterator
FontCharCodeIterator is an iterator type that can be used to traverse a list of visible Char codes in a font embedded in PDF. For more information, please take a look at Font.getCodeIterator().
Public classFunction
Although PDF is not a programming language it provides several types of function object that represent parameterized classes of functions, including mathematical formulas and sampled representations with arbitrary resolution. Functions are used in various ways in PDF, including device-dependent rasterization information for high-quality printing (halftone spot functions and transfer functions), color transform functions for certain color spaces, and specification of colors as a function of position for smooth shadings. Functions in PDF represent static, self-contained numerical transformations. PDF::Function represents a single, flat interface around all PDF function types.
Public classGeometryCollection
A Preprocessed PDF geometry collection
Public classGSChangesIterator
GSChangesIterator is an iterator type that can be used to traverse a list of changes in the graphics state between subsequent graphical elements on the page. For a sample use case, please take a look at ElementReaderAdv sample project.
Public classGState
GState is a class that keeps track of a number of style attributes used to visually define graphical Elements. Each PDF::Element has an associated GState that can be used to query or set various graphics properties.
Public classHighlights
Highlights is used to store the necessary information and perform certain tasks in accordance with Adobe's Highlight standard, whose details can be found at: http://partners.adobe.com/public/developer/en/pdf/HighlightFileFormat.pdf In a nutshell, the Highlights class maintains a set of highlights. Each highlight contains three pieces of information: page: the number of the page this Highlight is on; position: the start position (text offset) of this Highlight; length: the length of this Highlight. Possible use case scenarios for Highlights include:
  • Load a Highlight file (in XML format) and highlight the corresponding texts in the viewer (e.g., if the viewer is implemented using PDFViewCtrl, it can be achieved simply by calling PDFViewCtrl::SelectByHighlights() method);
  • Save the Highlight information (e.g., constructed by the TextSearch class) to an XML file for external uses.
Note:
  • The Highlights class does not maintain the corresponding PDF document for its highlights. It is the user's responsibility to match them up.
  • The Highlights class ensures that each highlight it maintains is unique (no two highlights have the same page, position and length values).
  • The current implementation of Highlights only supports the 'Characters' encoding for 'units' as described in the format; the 'words' encoding is not supported at this point.
Public classHTTPRequestOptions
Class for customizing network requests.
Public classImage
The Image class provides common methods for working with PDF images.
Public classKeyStrokeActionResult
A class that contains information from a KeyStrokeAction.
Public classKeyStrokeEventData
KeyStrokeEventData contains information for executing KeyStrokeAction
Public classOfficeToPDFOptions
Public classOptimizer

The Optimizer class provides functionality for optimizing/shrinking output PDF files.

'pdftron.PDF.Optimizer' is an optional PDFNet Add-On utility class that can be used to optimize PDF documents by reducing the file size, removing redundant information, and compressing data streams using the latest in image compression technology. PDF Optimizer can compress and shrink PDF file size with the following operations:

  • Remove duplicated fonts, images, ICC profiles, and any other data stream.
  • Optionally convert high-quality or print-ready PDF files to small, efficient and web-ready PDF.
  • Optionally down-sample large images to a given resolution.
  • Optionally compress or recompress PDF images using JBIG2 and JPEG2000 compression formats.
  • Compress uncompressed streams and remove unused PDF objects.
Public classOptimizerImageSettings
A class that stores downsampling/recompression settings for color and grayscale images.
Public classOptimizerMonoImageSettings
A class that stores image downsampling/recompression settings for monochrome images.
Public classOptimizerOptimizerSettings
A class that stores settings for the optimizer
Public classOptimizerTextSettings
A class that stores text optimization settings.
Public classOptionsHelpers
Public classPage
Page is a high-level class representing PDF page object (see 'Page Objects' in Section 3.6.2, 'Page Tree,' in PDF Reference Manual). Among other associated objects, a page object contains:
  • A series of objects representing the objects drawn on the page (See Element and ElementReader class for examples of how to extract page content).
  • A list of resources used in drawing the page
  • Annotations
  • Beads, private metadata, optional thumbnail image, etc.
Public classPageIterator
PageIterator is an iterator type that can be used to traverse a list pages in a PDF document. For more information, please PDFDoc::GetPageIterator().
Public classCode examplePageLabel

PDF page labels can be used to describe a page. This is used to allow for non-sequential page numbering or the addition of arbitrary labels for a page (such as the inclusion of Roman numerals at the beginning of a book). PDFNet PageLabel object can be used to specify the numbering style to use (for example, upper- or lower-case Roman, decimal, and so forth), the starting number for the first page, and an arbitrary prefix to be pre-appended to each number (for example, "A-" to generate "A-1", "A-2", "A-3", and so forth.)

PageLabel corresponds to the PDF Page Label object (Section 8.3.1, 'Page Labels' in the PDF Reference Manual.

Each page in a PDF document is identified by an integer page index that expresses the page’s relative position within the document. In addition, a document may optionally define page labels to identify each page visually on the screen or in print. Page labels and page indices need not coincide: the indices are fixed, running consecutively through the document starting from 1 for the first page, but the labels can be specified in any way that is appropriate for the particular document. For example, if the document begins with 12 pages of front matter numbered in roman numerals and the remainder of the document is numbered in Arabic, the first page would have a page index of 1 and a page label of i, the twelfth page would have index 12 and label xii, and the thirteenth page would have index 13 and label 1.

For purposes of page labeling, a document can be divided into labeling ranges, each of which is a series of consecutive pages using the same numbering system. Pages within a range are numbered sequentially in ascending order. A page's label consists of a numeric portion based on its position within its labeling range, optionally preceded by a label prefix denoting the range itself. For example, the pages in an appendix might be labeled with decimal numeric portions prefixed with the string "A-" and the resulting page labels would be "A-1", "A-2",

There is no default numbering style; if no 'S' (Style) entry is present, page labels consist solely of a label prefix with no numeric portion. For example, if the 'P' entry (Prefix) specifies the label prefix "Appendix", each page is simply labeled "Appendix" with no page number. If the 'P' entry is also missing or empty, the page label is an empty string.
Examples
Sample code (See PableLabelsTest sample project for examples): Create a page labeling scheme that starts with the first page in the document (page 1) and is using uppercase roman numbering style.
doc.SetPageLabel(1, PageLabel::Create(doc, PageLabel::e_roman_uppercase, "My Prefix ", 1));
Create a page labeling scheme that starts with the fourth page in the document and is using decimal arabic numbering style. Also the numeric portion of the first label should start with number 4 (otherwise the first label would be "My Prefix 1").
PageLabel L2 = PageLabel::Create(doc, PageLabel::e_decimal, "My Prefix ", 4);
doc.SetPageLabel(4, L2);
Create a page labeling scheme that starts with the seventh page in the document and is using alphabetic numbering style. The numeric portion of the first label should start with number 1.
PageLabel L3 = PageLabel::Create(doc, PageLabel::e_alphabetic_uppercase, "My Prefix ", 1);
doc.SetPageLabel(7, L3);
Read page labels from an existing PDF document.
PageLabel label = new PageLabel();
for (int i=1; i<=doc.GetPageCount(); ++i) {
label = doc.GetPageLabel(i);
if (label.IsValid()) {
string title = label.GetLabelTitle(i);
}
Public classPageSet
PageSet is a container of page numbers ordered following a linear sequence. The page numbers are integers and must be greater than zero. Duplicates are allowed.
Public classPathData
Contains the information required to draw the path. Contains an Array of PathSegmentType Operators and corresponding path data Points. A point may be on or off (off points are control points). The meaning of a point depends on associated id (or segment type) in the path segment type Array.
Public classPatternColor
Patterns are quite general, and have many uses; for example, they can be used to create various graphical textures, such as weaves, brick walls, sunbursts, and similar geometrical and chromatic effects. Patterns are specified in a special family of color spaces named Pattern, whose 'color values' are PatternColor objects instead of the numeric component values used with other spaces. Therefore PatternColor is to pattern color space what is ColorPt to all other color spaces. A tiling pattern consists of a small graphical figure called a pattern cell. Painting with the pattern replicates the cell at fixed horizontal and vertical intervals to fill an area. The effect is as if the figure were painted on the surface of a clear glass tile, identical copies of which were then laid down in an Array covering the area and trimmed to its boundaries. This is called tiling the area. The pattern cell can include graphical elements such as filled areas, text, and sampled images. Its shape need not be rectangular, and the spacing of tiles can differ from the dimensions of the cell itself. The order in which individual tiles (instances of the cell) are painted is unspecified and unpredictable; it is inadvisable for the figures on adjacent tiles to overlap.
Public classPDFDoc
PDFDoc is a high-level class describing a single PDF (Portable Document Format) document. Most applications using PDFNet will use this class to open existing PDF documents, or to create new PDF documents from scratch. The class offers a number of entry points into the document. For example,
  • To access pages use pdfdoc.getPageIterator() or pdfdoc.PageFind(page_num).
  • To access form fields use pdfdoc.GetFieldIterator() or pdfdoc.FieldFind(name).
  • To access document's meta-data use pdfdoc.GetDocInfo().
  • To access the outline tree use pdfdoc.GetFirstBookmark().
  • To access low-level Document Catalog use pdfdoc.GetRoot().
The class also offers utility methods to slit and merge PDF pages, to create new pages, to flatten forms, to change security settings, etc.
Public classPDFDocInfo
PDFDocInfo is a high-level utility class that can be used to read and modify document's metadata.
Public classPDFDocViewPrefs
PDFDocViewPrefs is a high-level utility class that can be used to control the way the document is to be presented on the screen or in print. PDFDocViewPrefs class corresponds to PageMode, PageLayout, and ViewerPreferences entries in the document’s catalog. For more details please refer to section 8.1 'Viewer Preferences' in PDF Reference Manual.
Public classPDFDraw
PDFDraw contains methods for converting PDF pages to images and to Bitmap objects. Utility methods are provided to export PDF pages to various raster formats.
Public classPDFNetInternalTools
Public classPDFPrintManager
The print class is used to register a print contract and set the standard print options. All of the callbacks are implemented internally for ease of development. It uses the efficent vector-based XPS print path when available. Note: Printing in Windows Store Apps is typically invoked using the Charms Bar. If you wish to implement a button that opens the print bar, call
await Windows.Graphics.Printing.PrintManager.ShowPrintUIAsync();
[Not available for Windows Phone]
Public classPDFPrintTask
Represents a printing operation using the PDFPrintManager Replaces Windows::Graphics::Printing::PrintTask to allow altered behaviour Note that PDFPrintTask does not provide a way to influence the printing, but just a way to notify of progress.
Public classPDFRasterizer
PDFRasterizer is a low-level PDF rasterizer. The main purpose of this class is to convert PDF pages to raster images (or bitmaps). PDFRasterizer is a relatively low-level class. If you need to convert PDF page to an image format or a Bitmap, consider using PDF::PDFDraw. Similarly, if you are building an interactive PDF viewing application use PDF::PDFViewCtrl instead.
Public classPDFViewCtrl
PDFViewCtrl is a utility class that can be used for interactive rendering of PDF documents. PDFViewCtrl is derived from Windows.UI.Xaml.Controls.ContentControl and it can be used like a regular Control (see PDFViewCtrlDemo for a concrete example). PDFViewCtrl defines several coordinate spaces and it is important to understand their differences: Page Space refers to the space in which a PDF page is defined. It is determined by a page itself and the origin is at the lower-left corner of the page. Note that Page Space is independent of how a page is viewed in PDFView and each page has its own Page space. Canvas Space refers to the tightest axis-aligned bounding box of all the pages given the current page presentation mode in PDFView. For example, if the page presentation mode is e_single_continuous, all the pages are arranged vertically with one page in each row, and therefore the Canvas Space is rectangle with possibly large height value. For this reason, Canvas Space is also, like Page Space, independent of the zoom factor. Also note that since PDFView adds gaps between adjacent pages, the Canvas Space is larger than the space occupied by all the pages. The origin of the Canvas Space is located at the upper-left corner. Screen Space (or Client Space) is the space occupied by PDFView and its origin is at the upper-left corner. Note that the virtual size of this space can extend beyond the visible region. Scrollable Space is the virtual space within which PDFView can scroll. It is determined by the Canvas Space and the current zoom factor. Roughly speaking, the dimensions of the Scrollable Space is the dimensions of the Canvas Space timed by the zoom. Therefore, a large zoom factor will result in a larger Scrollable region given the same Canvas region. For this reason, Scrollable Space might also be referred to as Zoomed Canvas Space. Note that since PDFView adds gaps between pages in Canvas Space and these gaps are not scaled when rendered, the scrollable range is not exactly what the zoom factor times the Canvas range. For functions such as SetHScrollPos(), SetVScrollPos(), GetCanvasHeight(), and GetCanvasWidth(), it is the Scrollable Space that is involved.
Remarks
Due to the Nature of C++/CX, subscribing to any event of the PDFViewCtrl will create a reference cycle. Therefore, it is important to unsubscibe to these events when the PDFViewCtrl is no longer needed. In general, this can be done in the OnNavigatedFrom function of a Windows.UI.Xaml.Controls.Page.
Public classPDFViewCtrlLinkInfo
PDFViewCtrlLinkInfo is an utility class that retains link information when used with GetLinkAt().
Public classPDFViewCtrlSelection
PDFViewCtrlSelection is a utility class that allows access to PDFViewCtrl's current selection.
Public classPDFViewCtrlThumbnailRequestHandler
Helper class that allows the equivalent of PDFViewCtrl.GetThumbAsync(int pageNumber) but without being forced to the captured Context of the PDFViewCtrl. When a thumbnail is requested using this class, the OnThumbnailGenerated in a secondary thread.
Public classPoint
A class that represents a point.
Public classQuadPoint
A class that represents four points.
Public classRect
Rect is a utility class used to manipulate PDF rectangle objects (refer to section 3.8.3 of the PDF Reference Manual). Rect can be associated with a SDF/Cos rectangle Array using Rect(Obj*) constructor or later using Rect::Attach(Obj*) or Rect::Update(Obj*) methods. Rect keeps a local cache for rectangle points so it is necessary to call Rect::Update() method if the changes to the Rect should be saved in the attached Cos/SDF Array.
Public classRedactor
Public classRedactorAppearance
Class used to customize the appearance of the optional redaction overlay.
Public classRedactorRedaction

PDF Redactor is a separately licensable Add-on that offers options to remove (not just covering or obscuring) content within a region of PDF. With printed pages, redaction involves blacking-out or cutting-out areas of the printed page. With electronic documents that use formats such as PDF, redaction typically involves removing sensitive content within documents for safe distribution to courts, patent and government institutions, the media, customers, vendors or any other audience with restricted access to the content.

The redaction process in PDFNet consists of two steps:

a) Content identification: A user applies redact annotations that specify the pieces or regions of content that should be removed. The content for redaction can be identified either interactively (e.g. using 'pdftron.PDF.PDFViewCtrl' as shown in PDFView sample) or programmatically (e.g. using 'pdftron.PDF.TextSearch' or 'pdftron.PDF.TextExtractor'). Up until the next step is performed, the user can see, move and redefine these annotations.

b) Content removal: Using 'pdftron.PDF.Redactor.Redact()' the user instructs PDFNet to apply the redact regions, after which the content in the area specified by the redact annotations is removed. The redaction function includes number of options to control the style of the redaction overlay (including color, text, font, border, transparency, etc.).

PDFTron Redactor makes sure that if a portion of an image, text, or vector graphics is contained in a redaction region, that portion of the image or path data is destroyed and is not simply hidden with clipping or image masks. PDFNet API can also be used to review and remove metadata and other content that can exist in a PDF document, including XML Forms Architecture (XFA) content and Extensible Metadata Platform (XMP) content.

Public classReflowProcessor
Public classSeparation
Separation contains a memory buffer and CMYK components' information about rasterized separations used in PDFDraw::GetSeparationBitmaps and PDFRasterizer::RasterizeSeparations
Public classShading
Shading is a class that represents a flat interface around all PDF shading types:
  • In Function-based (type 1) shadings, the color at every point in the domain is defined by a specified mathematical function. The function need not be smooth or continuous. This is the most general of the available shading types, and is useful for shadings that cannot be adequately described with any of the other types.
  • Axial shadings (type 2) define a color blend along a line between two points, optionally extended beyond the boundary points by continuing the boundary colors.
  • Radial shadings (type 3) define a color blend that varies between two circles. Shadings of this type are commonly used to depict three-dimensional spheres and cones.
  • Free-form Gouraud-shaded triangle mesh shadings (type 4) and lattice gouraud shadings (type 5) are commonly used to represent complex colored and shaded three-dimensional shapes. The area to be shaded is defined by a path composed entirely of triangles. The color at each vertex of the triangles is specified, and a technique known as Gouraud interpolation is used to color the interiors. The interpolation functions defining the shading may be linear or nonlinear.
Coons patch mesh shadings (type 6) are constructed from one or more color patches, each bounded by four cubic Bézier curves. A Coons patch generally has two independent aspects:
  • Colors are specified for each corner of the unit square, and bilinear interpolation is used to fill in colors over the entire unit square
  • Coordinates are mapped from the unit square into a four-sided patch whose sides are not necessarily linear. The mapping is continuous: the corners of the unit square map to corners of the patch and the sides of the unit square map to sides of the patch.
  • Tensor-product patch mesh shadings (type 7) are identical to type 6 (Coons mesh), except that they are based on a bicubic tensor-product patch defined by 16 control points, instead of the 12 control points that define a Coons patch. The shading Patterns dictionaries representing the two patch types differ only in the value of the Type entry and in the number of control points specified for each patch in the data stream. Although the Coons patch is more concise and easier to use, the tensor- product patch affords greater control over color mapping.
Public classStamper

Stamper is a utility class that can be used to PDF pages with text, images, or with other PDF content in only a few lines of code.

Although Stamper is very simple to use compared to ElementBuilder/ElementWriter it is not as powerful or flexible. In case you need full control over PDF creation use ElementBuilder/ElementWriter to add new content to existing PDF pages as shown in the ElementBuilder sample project.

Public classCode exampleTextExtractor
TextExtractor is used to analyze a PDF page and extract words and logical structures that are visible within a given region. The resulting list of lines and words can be traversed element by element or accessed as a string buffer. The class also includes utility methods to extract PDF text as HTML or XML. Possible use case scenarios for TextExtractor include:
  • Converting PDF pages to text or XML for content repurposing.
  • Searching PDF pages for specific words or keywords.
  • Indexing large PDF repositories for indexing or content.
retrieval purposes (i.e. implementing a PDF search engine).
  • Classifying or summarizing PDF documents based on their text content.
  • Finding specific words for content editing purposes (such as splitting pages.
The main task of TextExtractor is to interpret PDF pages and offer a simple to use API to:
  • Normalize all text content to Unicode.
  • Extract inferred logical structure (word by word, line by line, or paragraph by paragraph).
  • Extract positioning information for every line, word, or a glyph.
  • Extract style information (such as information about the font, font size, font styles, etc) for every line, word, or a glyph.
  • Control the content analysis process. A number of options (such as removal of text obscured by images) is available to let the user direct the flow of content recognition algorithms that will meet their requirements.
  • Offer utility methods to convert PDF page content to text, XML, or HTML.
Remarks

TextExtractor is analyzing only textual content of the page. This means that the rasterized (e.g. in scanned pages) or vectorized text (where glyphs are converted to path outlines) will not be recognized as text. Please note that it is still possible to extract this content using pdftron.PDF.ElementReader interface.

In some cases TextExtractor may extract text that does not appear to be on the visible page (e.g. when text is obscured by an image or a rectangle). In these situations it is possible to use processing flags such as 'e_remove_hidden_text' and 'e_no_invisible_text' to remove hidden text.

Examples
For full sample code, please take a look at TextExtract sample project.
//... Initialize PDFNet ...
PDFDoc doc = new PDFDoc(filein);
doc.initSecurityHandler();
Page page = doc.pageBegin().current();
TextExtractor txt = new TextExtractor();
txt.begin(page, 0, TextExtractor.ProcessingFlags.e_remove_hidden_text);
string text = txt.getAsText();
// or traverse words one by one...
TextExtractor.Word word;
for (TextExtractor.Line line = txt.GetFirstLine(); line.IsValid(); line=line.GetNextLine()) {
for (word=line.GetFirstWord(); word.IsValid(); word=word.GetNextWord()) {
string w = word.GetString();
}
}
Public classTextExtractorLine
TextExtractorLine object represents a line of text on a PDF page. Each line consists of a sequence of words, and each words in one or more styles.
Public classTextExtractorStyle
A class representing predominant text style associated with a given Line, a Word, or a Glyph. The class includes information about the font, font size, font styles, text color, etc.
Public classTextExtractorWord
TextExtractorWord object represents a word on a PDF page. Each word contains a sequence of characters in one or more styles (see TextExtractor.Style).
Public classCode exampleTextSearch
TextSearch searches through a PDF document for a user-given search pattern. The current implementation supports both verbatim search and the search using regular expressions, whose detailed syntax can be found at: http://www.boost.org/doc/libs/release/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html TextSearch also provides users with several useful search modes and extra information besides the found string that matches the pattern. TextSearch can either keep running until a matched string is found or be set to return periodically in order for the caller to perform any necessary updates (e.g., UI updates). It is also worth mentioning that the search modes can be changed on the fly while searching through a document. Possible use case scenarios for TextSearch include:
  • Guide users of a PDF viewer (e.g. implemented by PDFViewCtrl) to places where they are intersted in;
  • Find interested PDF documents which contain certain patterns;
  • Extract interested information (e.g., credit card numbers) from a set of files;
  • Extract Highlight information (refer to the Highlights class for details) from files for external use.
  • Since hyphens ('-') are frequently used in PDF documents to concatenate the two broken pieces of a word at the end of a line, for example "TextSearch is powerful for finding patterns in PDF files; yes, it is really pow- erful." a search for "powerful" should return both instances. However, not all end-of-line hyphens are hyphens added to connect a broken word; some of them could be "real" hyphens. In addition, an input search pattern may also contain hyphens that complicate the situation. To tackle this problem, the following conventions are adopted:
    1. When in the verbatim search mode and the pattern contains no hyphen, a matching string is returned if it is exactly the same or it contains end-of-line or start-of-line hyphens. For example, as mentioned above, a search for "powerful" would return both instances.
    2. When in verbatim search mode and the pattern contains one or multiple hyphens, a matching string is returned only if the string matches the pattern exactly. For example, a search for "pow-erful" will only return the second instance, and a search for "power-ful" will return nothing.
    3. When searching using regular expressions, hyphens are not taken care implicitly. Users should take care of it themselves. For example, in order to find both the "powerful" instances, the input pattern can be "pow-{0,1}erful".
Examples
For a full sample, please take a look at the TextSearch sample project.
   //... Initialize PDFNet ...
PDFDoc doc = new PDFDoc(filein);
doc.initSecurityHandler();
int mode = TextSearch.e_whole_word | TextSearch.e_page_stop;
UString pattern("joHn sMiTh");
TextSearch txt_search = new TextSearch();

//PDFDoc doesn't allow simultaneous access from different threads. If this
//document could be used from other threads (e.g., the rendering thread inside
//PDFView/PDFViewCtrl, if used), it is good practice to lock it.
//Notice: don't forget to call doc.Unlock() to avoid deadlock.
doc.Lock(); 
txt_search.Begin( doc, pattern, mode, -1, -1 );
while ( true )
{
    TextSearch.ResultCode result = txt_search.Run();
    if ( result.GetCode() == TextSearchResult.e_found )
    {
        Console.WriteLine("found one instance: " + result.GetResultStr());
    }
    else
    {
        break;
    }
}

//unlock the document to avoid deadlock.
doc.UnLock();
Public classViewChangeCollection
Class for collecting changes to a PDFDoc and/or viewer, which can be passed to various functions to act on. Allows for chaining of modifications, which can then be updated by PDFNet in the best possible way.
Public classWebFontDownloader
static interface to control the behaviour of PDFNet web font downloading
Public classWordToPDFOptions
Public classXODOutputOptions
A class containing options for ToXod functions
Public classXPSOutputOptions
A class containing options for ToXps functions
Interfaces
  InterfaceDescription
Public interfaceIAnnot
Public interfaceIConversionOptions
Public interfaceIOptionsBase
Delegates
Enumerations
  EnumerationDescription
Public enumerationActionFormActionFlag
Flags used by submit form actions. Exclude flag is also used by reset form action. No other action types use flags in the current version of PDF standard (ISO 2300).
Public enumerationActionType
Action types
Public enumerationAnnotAnnotationState
annotation appearances types
Public enumerationAnnotationOutputFlag
Public enumerationAnnotBorderStyleStyle
Various appearances of the BorderStyle
Public enumerationAnnotEventType
Event types for Annot
Public enumerationAnnotFlag
Flags specifying various Characteristics of the annotation.
Public enumerationAnnotType
Annotation types
Public enumerationColorSpaceType
Colorspace type
Public enumerationDestinationFitType
View Destination Fit Types
Public enumerationDigitalSignatureFieldDocumentPermissions
Public enumerationDigitalSignatureFieldFieldPermissions
Public enumerationDigitalSignatureFieldSubFilterType
Public enumerationDocumentConversionResult
Public enumerationDocumentPreviewCachePreviewResult
The result of requesting a thumbnail from DocumentPreviewCache
Public enumerationElementType
Element types
Public enumerationElementWriterWriteMode
Enumeration describing the placement of the element written to a page.
Public enumerationFieldEventType
Event types for field.
Public enumerationFieldFlag
Flags specifying various Characteristics of the fields.
Public enumerationFieldTextJustification
form of quadding (justification) to be used in displaying the text fields.
Public enumerationFieldType
Interactive form field type.
Public enumerationFlattenFlag
Flattening options.
Public enumerationFlattenThresholdFlag
Public enumerationFontEncoding
Public enumerationFontStandardType1Font
Public enumerationFontType
Font types
Public enumerationFunctionType
PDF functions types
Public enumerationGeometryCollectionSnappingMode
Public enumerationGStateBlendMode
The standard separable blend modes available in PDF.
Public enumerationGStateGStateAttribute
Public enumerationGStateLineCap
LineCap types
Public enumerationGStateLineJoin
LineJoin types
Public enumerationGStateRenderingIntent
Public enumerationGStateTextRenderingMode
Text Rendering modes
Public enumerationImageInputFilter
Image Input Filter types
Public enumerationInternalToolsLogBackend
Used for Internal Testing. Will do nothing for most builds
Public enumerationInternalToolsLogLevel
Used for Internal Testing. Will do nothing for most builds
Public enumerationJobRequestResultState
The result of requesting a reflowed page from ReflowProcessor
Public enumerationOptimizerImageSettingsCompressionMode
Color and grayscale image compression mode
Public enumerationOptimizerImageSettingsDownsampleMode
Color and grayscale image downsample mode
Public enumerationOptimizerMonoImageSettingsCompressionMode
mono-image compression mode
Public enumerationOptimizerMonoImageSettingsDownsampleMode
mono-image downsample mode
Public enumerationPageBox
PDF page can define as many as five separate boundaries to control various aspects of the imaging process (for more details please refer to Section 10.10.1 'Page Boundaries' in PDF Reference Manual).
Public enumerationPageEventType
Event types for Page
Public enumerationPageLabelStyle
The numbering style to be used for the numeric portion of page label.
Public enumerationPageRotate
Indicates the page rotations in degrees.
Public enumerationPageSetFilter
Public enumerationPathDataPathSegmentType
Enumeration used to indicate operator type.
Public enumerationPatternColorTilingType
Public enumerationPatternColorType
Public enumerationPDFDocEventType
Event types for PDFDoc
Public enumerationPDFDocExtractFlag
PDFDocExtractFlag
Public enumerationPDFDocInsertFlag
PDFDocInsertFlag
Public enumerationPDFDocViewPrefsPageLayout
PageLayout specifies the page layout to be used when the document is opened
Public enumerationPDFDocViewPrefsPageMode
PageMode specifies how the document should be displayed when opened
Public enumerationPDFDocViewPrefsViewerPref
ViewerPref enumeration specifies how various GUI elements should behave when the document is opened.
Public enumerationPDFPrintTaskCompletion
Enumerated values for status when printing completes [Not available for Windows Phone]
Public enumerationPDFRasterizerColorPostProcessMode
ColorPostProcessMode is used to modify colors after rendering.
Public enumerationPDFRasterizerOverprintPreviewMode
Public enumerationPDFRasterizerType
PDFNet includes two separate rasterizer implementations utilizing different graphics libraries. The default rasterizer is 'e_BuiltIn' which is a high-quality, anti-aliased and platform independent rasterizer. This rasterizer is available on all supported platforms. On Windows platforms, PDFNet also includes GDI+ based rasterizer. (deprecated and will be removed in a future version of PDFNet) This rasterizer is included mainly to provide vector output for printing, for EMF/WMF export, etc. For plain image rasterization we recommend using the built-in rasterizer.
Public enumerationPDFViewCtrlConversionType
ConversionType lists the events triggered by calling OpenUniversalDocument
Public enumerationPDFViewCtrlDownloadedType
DownloadedType lists the events triggered by calling OpenURLAsync.
Public enumerationPDFViewCtrlPagePresentationMode
PDFViewCtrlPagePresentationMode lists common modes of presenting PDF pages.
Public enumerationPDFViewCtrlPageViewMode
PDFViewCtrlPageViewMode lists common modes of viewing PDF pages.
Public enumerationPrinterContentTypes
Enumerated values for specifying the document content to print. [Not available for Windows Phone]
Public enumerationPrinterModeDuplexMode
Enumerated values for specifying how the printed pages are flipped when duplexing
Public enumerationPrinterModeNUp
Enumerated values for specifying the layout of multiple document pages onto output pages
Public enumerationPrinterModeNUpPageOrder
Enumerated values for specifying the ordering of document pages onto output pages
Public enumerationPrinterModeOrientation
Enumerated values for specifying the orientation of output pages
Public enumerationPrinterModeOutputColor
Enumerated values for specifying the color mode for printing
Public enumerationPrinterModeOutputQuality
Enumerated values for specifying the quality of the printing
Public enumerationPrinterModePaperSize
Paper sizes.
Public enumerationPrinterModePrintContentTypes
Enumerated values for specifying the document content to print
Public enumerationPrinterModeScaleType
Enumerated values for specifying the scaling of document pages
Public enumerationScaleType
Enumerated values for specifying the scaling of document pages. [Not available for Windows Phone]
Public enumerationShadingType
Shading types
Public enumerationStamperHorizontalAlignment
Stamper horizontal alignment
Public enumerationStamperSizeType
Stamper Size Types
Public enumerationStamperTextAlignment
Stamper text alignment
Public enumerationStamperVerticalAlignment
Stamper vertical alignment
Public enumerationTextExtractorProcessingFlags
Processing options that can be passed in Begin() method to direct the flow of content recognition algorithms.
Public enumerationTextExtractorXMLOutputFlags
Flags controlling the structure of XML output in a call to TextExtractor.GetAsXML().
Public enumerationTextSearchResultCode
The code indicating the reason when a search returns.
Public enumerationTextSearchSearchMode
Search modes that control how searching is conducted.
Public enumerationTextSelectionMode
TextSelectionMode lists different text selection modes that can be used to highlight text.
Public enumerationZoomLimitMode