Samples

PDF Viewer Component - PDFView

C#
VB
Viewing

This sample shows how to customize the viewer control by implementing a number of custom tools (such as freehand tool, link creation tool, rectangular zoom etc) and custom GUI elements (such as custom navigation and printing). For a more introductory example of how to use PDFViewCtrl, please see PDFViewSimple sample project.

Add Image to PDF - AddImage

C#
C++
Editing
Go
Images
Java
JavaScript
PHP
Python
Ruby
VB

This sample illustrates how to embed various raster image formats (e.g. TIFF, JPEG, JPEG2000, JBIG2, GIF, PNG, BMP, etc.) in a PDF document.

Barcode Extraction

C#
C++
Extraction
Go
Java
JavaScript
PHP
Python
Ruby
VB

This sample shows how to use the Apryse Barcode Module to detect and extract barcodes from PDF documents.

Build, Write and Embed Elements in PDF

C#
C++
Generation
Go
Java
JavaScript
PHP
Python
Ruby
VB

Illustrates how to use PDFNet page writing API, how to embed fonts and images and how to copy graphical elements from one page to another.

Change PDF Media Box - Rect

C#
C++
Extraction
Go
Java
JavaScript
PHP
Python
Ruby
VB

Shows how to change Page's MediaBox using Rect class.

Combine PDFs with Page Imposition - Imposition

C#
C++
Editing
Go
Java
JavaScript
PHP
Python
Ruby
VB

The sample illustrates how multiple pages can be combined/imposed using PDFNet. Page imposition can be used to arrange/order pages prior to printing or to assemble a 'master' page from several 'source' pages. Using PDFNet API it is possible to write applications that can re-order the pages such that they will display in the correct order when the hard copy pages are compiled and folded correctly.

Compress - Optimizer

C#
C++
Go
Java
JavaScript
Optimization
PHP
Python
Ruby
VB

The sample shows how to use 'pdftron.PDF.Optimizer' to reduce PDF file size by removing redundant information and compressing data streams using the latest in image compression technology. 'pdftron.PDF.Optimizer' is an optional Add-On to PDFNet Core SDK.

Compress PDF Image JBIG2 - JBIGTest

C#
C++
Go
Java
JavaScript
Optimization
PHP
Python
Ruby
VB

The sample project illustrates how to recompress bitonal (black and white) images in existing PDF documents using JBIG2 compression. The sample is intended to show how to specify hint information for image encoder and is not meant to be a generic PDF optimization tool. PDFNet supports both lossless and lossy JBIG2 compression. To give you a feeling of compression rates possible with PDFNet we re-compressed a document containing 17 scanned pages. The original input document is ~1.4MB and is using standard CCITT Fax compression. Loss-less JBIG2 compression shrunk down the file to 641KB. Lossy JBIG2 compression shrunk down the file to 176KB.

Convert Between File Types - PDF, SVG, XPS, SVG, TIFF, PNG, JPEG

C#
C++
Conversion
Go
Images
Java
JavaScript
PHP
Python
Ruby
VB

This sample shows how to use PDFNet Convert Add-on (i.e. 'pdftron.PDF.Convert' namespace) for direct, high-quality conversion between PDF, XPS, EMF, SVG, TIFF, PNG, JPEG, and other image formats. The sample also shows how to convert MS Office files using our built in conversion

Convert CAD to PDF - CAD2PDF

C#
C++
Conversion
Go
Java
JavaScript
PHP
Python
Ruby
VB

This sample shows how to use the Apryse CAD module for direct, high-quality conversion from DWG, DXF, DGN, DWF, and RVT to PDF.

Convert DICOM to PDF - AdvancedImaging

C#
C++
DICOM
Java
JavaScript
Python
VB
Viewing

This sample shows how to use the Apryse Advanced Imaging module for direct, high-quality conversion from DICOM and other formats such as AAI, ARW, DCR and RAF to PDF.

Convert File Types with Virtual Printer on Windows - ConvertPrint

C#
C++
Conversion
Go
Java
JavaScript
Python
VB

The sample shows how to convert any printable document (e.g. RTF, MS Office, TXT, etc) to PDF or XPS using virtual printer on Windows.

Convert PDF to DOCX, XSLX - PDF2Office

C#
C++
Conversion
Go
Java
JavaScript
Office
PHP
Python
Ruby
VB

This example illustrates how to convert generic PDF documents to Word, Excel, PowerPoint format

Convert PDF to HTML - PDF2Html

C#
C++
Conversion
Go
Java
JavaScript
PHP
Python
Ruby
VB

This example illustrates how to convert generic PDF documents to HTML format

Convert XAML to PDF - Xaml2Pdf

C#
Conversion

This example shows how to use PDFNet Convert Add-on (i.e. 'pdftron.PDF.Convert' namespace) to dynamically generate PDF or XPS directly from a FlowDocument, XAML, or WPF. Converting XAML/FlowDocument to PDF is not only easy, but is also very flexible in terms of how content is paginated and flowed into a fixed document such as PDF or XPS.

Convert to PDF to PNG, JPG, BMP or TIFF - PDFDraw

C#
C++
Generation
Go
Java
JavaScript
PHP
Python
Ruby
VB

This sample illustrates how to use the built-in rasterizer in order to render PDF images on the fly and how to save resulting images in PNG and JPEG format.

Convert to PDF/A

C#
C++
Conversion
Go
Java
JavaScript
PDF/A
PHP
Python
Ruby
VB

This sample illustrates how to validate existing PDF documents for PDF/A compliance as well as to convert generic PDF documents to PDF/A format.

Convert to PDF/UA

C#
C++
Go
Java
JavaScript
PDF/UA
PHP
Python
Ruby
VB

This sample illustrates how to validate existing PDF documents for PDF/UA compliance, requires DataExtractionModule.

Create New Document - DocumentCreation

C#
C++
Generation
Java
JavaScript
PHP
Python
Ruby

This sample shows how to use the Document Layout Engine to easily create reflowable PDF documents programmatically using Apryse SDK.

Create Unicode Text, Embed CID in PDFs - UnicodeWrite

C#
C++
Editing
Go
Java
JavaScript
PHP
Python
Ruby
VB

An example illustrating how to create Unicode text and how to embed composite fonts.

DOCX, XSLX to PDF Conversion - OfficeToPDF

C#
C++
Conversion
Go
Java
JavaScript
Office
PHP
Python
Ruby
VB

This sample illustrates how to convert MS Office files (Word, Excel, PowerPoint) to PDF.

Digitally Sign PDF Files - DigitalSignatures

C#
C++
Go
Java
JavaScript
PHP
Python
Ruby
Signing
VB

Demonstrates the basic usage of high-level digital signature API to digitally sign and/or certify PDF documents.

Edit PDF - ElementEdit

C#
C++
Editing
Go
Java
JavaScript
PHP
Python
Ruby
VB

The sample code shows how to edit the page display list and how to modify graphics state attributes on existing Elements. In particular the sample program strips all images from the page and changes text color to blue.

Embed 3D Models (U3D) in PDF

C#
C++
Editing
Go
Java
JavaScript
PHP
Python
Ruby
VB

This example illustrates how to embed U3D content (3 dimensional models) in PDF.

Encrypt & Decrypt PDFs - Encryption

C#
C++
Go
Java
JavaScript
PHP
Python
Ruby
Security
VB

Illustrates encryption support in PDFNet. The sample code reads an encrypted document and sets a new SecurityHandler.

Extract Image from PDFs - ImageExtract

C#
C++
Extraction
Go
Java
JavaScript
PHP
Python
Ruby
VB

This sample illustrates couple of approaches to PDF image extraction.

Extract Text, Read, Parse PDF - TextExtract

C#
C++
Extraction
Go
Java
JavaScript
PHP
Python
Ruby
VB

The sample illustrates the basic text extraction capabilities of PDFNet.

Flatten, Create, Modify PDF Forms - InteractiveForms

C#
C++
Forms
Go
Java
JavaScript
PHP
Python
Ruby
VB

The sample illustrates some basic PDFNet capabilities related to interactive forms (also known as AcroForms).

Generate Document via Office Template - OfficeTemplate

C#
C++
Generation
Go
Java
JavaScript
Office
PHP
Python
Ruby
VB

This sample shows how to dynamically generate PDF from an MS Office template file and content supplied via JSON.

HTML to PDF Conversion - HTML2PDF

C#
C++
Conversion
Go
Java
JavaScript
PHP
Python
Ruby
VB

Sample code to use Apryse SDK for directly converting HTML pages to PDF by using 'pdftron.PDF.HTML2PDF'. The HTML2PDF converter supports HTML conversion from a string or URL and offers many options to control page size and formatting.

Intelligent Data Extraction

C#
C++
Extraction
Go
Java
JavaScript
PHP
Python
Ruby
VB

This sample shows how to use the Apryse Data Extraction module to extract tabular data, document structure and form fields from PDF documents.

Multithreaded PDF Reading - Multithreaded

C#
Optimization

Illustrates how to use PDFDoc locking mechanisms to access the document concurrently. PDFDoc uses a recursive shared lock model. Multiple threads can read the document at the same time, but only one thread can write to the document. A given thread can acquire as many locks of the same type as it wants, in a recursive fashion.

OCR to search PDFs and Extract Text

C#
C++
Extraction
Go
Java
JavaScript
PHP
Python
Ruby
VB

This sample shows how to use the Apryse OCR module on scanned documents in multiple languages. The OCR module can make searchable PDFs and extract scanned text for further indexing.

PDF Annotation - Add/Edit

Annotations
C#
C++
Go
Java
JavaScript
PHP
Python
Ruby
VB

Shows how to add or edit PDF annotations (e.g. hyperlink, intra-document link, stamp, rubber stamp, file attachment, sound, text, free-text, line, circle, square, polygon, polyline, highlight, squiggly, caret, and ink).

PDF Bookmarks and Outlines - Add/Edit/Read

C#
C++
Generation
Go
Java
JavaScript
PHP
Python
Ruby
VB
Viewing

The sample code illustrates how to read and edit existing outline items and create new bookmarks using the high-level API.

PDF Data Extraction - Images, Text, Paths - ElementReaderAdv

C#
C++
Editing
Extraction
Go
Java
JavaScript
PHP
Python
Ruby
VB

The sample shows how to use some of more advanced PDFNet features. The sample code illustrates how to extract text, paths, and images. The sample also shows how to do color conversion, image normalization, and how to process changes in the graphics state.

PDF Device Context - PDFDC

C#
C++
Generation
VB

This sample shows how to create and use PDFDC (i.e. a PDF Device Context). Windows developers can use standard GDI or GDI+ API-s to write on PDFDC and to generate PDF documents based on their existing drawing functions. PDFDC can also be used to implement file conversion from any printable file format to PDF.

PDF Form Fill, Form Data Extraction with Forms Data Format (FDF)

Annotations
C#
C++
Forms
Go
Java
JavaScript
PHP
Python
Ruby
VB

PDFNet includes full support for FDF (Forms Data Format) and capability to merge/extract forms data (FDF) with/from PDF. The sample illustrates basic FDF merge/extract functionality available in PDFNet.

PDF Layers (OCG) - Add, Show, Hide - PDFLayers

C#
C++
Extraction
Generation
Go
Java
JavaScript
PHP
Python
Ruby
VB
Viewing

This sample demonstrates how to create PDF layers (also known as Optional Content Groups - OCGs). The sample also shows how to extract and render PDF layers.

PDF Logical Structure Reader - LogicalStructure

C#
C++
Extraction
Go
Java
JavaScript
PHP
Python
Ruby
VB

This sample explores the structure and content of a tagged PDF document and dumps the structure information to the console window.

PDF Page Labels - PageLabels

C#
C++
Extraction
Go
Java
JavaScript
PHP
Python
Ruby
VB

This example illustrates how to work with PDF page labels. 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).

PDF Page Manipulation - Merge, Copy, Delete, Rearrange - PDFPage

C#
C++
Editing
Go
Java
JavaScript
PHP
Python
Ruby
VB

The sample illustrates how to copy pages from one document to another, how to delete, and rearrange pages and how to use ImportPages() method for very efficient copy and merge operations.

PDF Patterns & Shading - Pattern

C#
C++
Generation
Go
Java
JavaScript
PHP
Python
Ruby
VB

This example illustrates how to create various PDF patterns and shadings.

PDF Stamp in C# (.Net) - Stamper

C#
C++
Editing
Go
Java
JavaScript
PHP
Python
Ruby
VB

The sample shows how to use 'pdftron.PDF.Stamper' utility class to stamp PDF pages with text, images, or with other PDF pages. ElementBuilder and ElementWriter should be used for more complex PDF stamping operations.

PDF Viewer - PDFViewWPF

C#
Viewing

This sample shows how to use PDFViewWPF class.

Portfolio/PDF Packages - PDFPackage

C#
C++
Extraction
Generation
Go
Java
JavaScript
PHP
Python
Ruby
VB

This sample illustrates how to create, extract, and manipulate PDF Packages (also known as PDF Portfolios).

C#
C++
Go
Java
PHP
Python
Ruby
VB

This sample illustrates how to print a PDF document using the currently selected default printer. It is possible to use PDFNet printing functionality in both client and server applications without dependence on any third party components.

Read & Write PDF in Memory Buffer - PDFDocMemory

C#
C++
Go
Java
JavaScript
PHP
Python
Ruby
VB
Viewing

The sample illustrates how to read/write a PDF document from/to memory buffer. This is useful for applications that work with dynamic PDFdocuments that don't need to be saved/read from a disk.

Read PDF Elements - ElementReader

C#
C++
Extraction
Go
Java
JavaScript
PHP
Python
Ruby
VB

Illustrates how to traverse page display list using ElementReader.

Redact PDFs - PDFRedact

C#
C++
Go
Java
JavaScript
PHP
Python
Redaction
Ruby
VB

The sample shows how to use 'pdftron.PDF.Redactor' to remove potentially sensitive content within PDF documents. Apryse Redactor makes sure that if a portion of an image, text, or vector graphics is contained in a redaction region, that portion is destroyed and is not simply hidden with clipping or image masks.

SDF API for PDF Editing

C#
C++
Extraction
Go
Java
JavaScript
PHP
Python
Ruby
VB

The sample illustrates how to use basic Cos/SDF API to edit an existing document.

Search & Replace PDF String, Text, Images - ContentReplacer

C#
C++
Editing
Go
Java
JavaScript
PHP
Python
Ruby
Search
VB

This sample shows how to use pdftron.PDF.ContentReplacer to search and replace text strings and images in existing PDF (e.g. business cards and other PDF templates). Unlike PDF forms, the ContentReplacer works on actual PDF content and is not limited to static rectangular annotation regions.

Search PDF for Text / String - TextSearch

C#
C++
Go
Java
JavaScript
PHP
Python
Ruby
Search
VB

This sample shows how to use TextSearch to search text on PDF pages using regular expressions. TextSearch utility class builds on functionality available in TextExtractor to simplify most common search operations.

Simple PDF Viewer Component - PDFViewWPFSimple

C#
Viewing

This sample shows how to use PDFViewWPF class.

Simple PDF Viewer Control - PDFViewSimple

C#
C++
VB
Viewing

This sample shows how to use PDF viewer control in a basic project. The sample uses a number of built-in features from PDFViewCtrl to implement document navigation, text highlighting, markup, and editing. If you are looking for a sample showing how to further customize the viewer (e.g. by implementing custom tools or custom GUI elements), please take a look at PDFView sample project.

Undo/Redo PDF Edits - UndoRedoTest

C#
C++
Go
Java
JavaScript
PHP
Python
Ruby
Undo/Redo
VB

The sample applies to any edits made to a particular document (not just annotations). It shows how to walk back and forth on a fully general, bit-exact list of document states.

WebViewer Integration - JavaScript PDF Viewer

C#
C++
Conversion
Go
Java
JavaScript
PHP
Python
Ruby
VB
Viewing

These samples shows how to integrate PDFNet WebViewer into any HTML5, Silverlight, or Flash web application. The sample is using 'pdftron.PDF.Convert.ToXod()' to convert/stream PDF, XPS, MS Office, RTF, HTML and other document formats to WebViewer 'pdftron.PDF.Convert.ToXod()' is an optional Add-On to the Core SDK and is part of PDFNet WebViewer Publishing Platform.