Some test text!

keyboard_arrow_down

Get started

Download PDFTron SDK
play_arrow

Quick start - view a document

Xamarin.AndroidXamarin.iOSIntegrate with NuGetIntegrate manuallyRun samplesAdd license keyUpdate to latest version
keyboard_arrow_down

Xamarin.Forms

Document viewerBasic viewer
keyboard_arrow_down

Fundamentals

Java binding (Android)Objective-C binding (iOS)Code sharingDocument lockingDocument saving
keyboard_arrow_down

FAQ

System requirementsPDFTron full vs. standardReduce size of APK
keyboard_arrow_down

Document Viewer

keyboard_arrow_down

Document Viewer components

Overview
play_arrow

PDFViewCtrl

play_arrow

Reflow

Quick menuCustomize quick menu
play_arrow

Annotation toolbar

play_arrow

Annotation style editor

play_arrow

Page slider

play_arrow

List container

play_arrow

Annotation list

play_arrow

Document outline

play_arrow

User bookmark list

play_arrow

Thumbnail browser

Add pages dialogCrop pages dialogRotate pages dialogView mode dialog
keyboard_arrow_down

Annotation and collaboration

OverviewToolManager setupRead only mode
play_arrow

Disable annotation creation and editing

play_arrow

Default annotation properties

play_arrow

Change tool mode

Xamarin.AndroidXamarin.iOS
play_arrow

Events

play_arrow

Override annotation handling

Show and hide existing annotationsRealtime collaboration
keyboard_arrow_down

Advanced customization

play_arrow

Add a custom view to a page

Xamarin.AndroidXamarin.iOSCreate a custom toolPage coloring modePage fit modePage layout modeScrolling direction
keyboard_arrow_down

Conversion

play_arrow

Convert documents to PDF

Xamarin.AndroidXamarin.iOS
play_arrow

Convert HTML to PDF

keyboard_arrow_down

Parsing and extraction

keyboard_arrow_down

Digital signatures

keyboard_arrow_down

Search

keyboard_arrow_down

Advanced topics

keyboard_arrow_down

Troubleshooting

keyboard_arrow_down

Reference

LocalizationIcon cheat sheet
keyboard_arrow_down

PDF Processing API

What is PDFNet?Opening a documentSerializing (saving) a documentWorking with pagesWorking with Page ContentWorking with BookmarksWorking with Interactive Forms (AcroForms)PDF SecurityLow-level PDF APIError handling

Convert documents to PDF

In this document
chevron_rightConvert a non-PDF file
chevron_rightConvert other non-PDF files
chevron_rightConvert HTML to PDF
This tutorial only applies to Xamarin.iOS.
Saving annotations back to non-PDF formats is not supported. You can instead save the annotated PDFDoc to a PDF file.

PDFTron has a powerful conversion system which allows you to convert many file formats to PDF. The PTConvert class handles the conversion process and supports the following file types:

  • Office files: .docx, .pptx, .xlsx, .doc (with the office conversion Add-On module)
  • Images: .bmp, .jpg, .tif, .png, .gif
  • Image collections (zip archives with any type of image listed above)
  • Markdown files: .md

linkConvert a non-PDF file

The easiest way to convert a file is through the Convert class's StreamingPDFConversion(String, ConversionOptions) method. The following code shows how to convert a non-PDF file using PDFTron's internal conversion:

var documentConversion = Convert.StreamingPDFConversion("my_file_path", null);
documentConversion.Convert();
var pdfDoc = documentConversion.GetDoc();

The result of the conversion will be contained in the provided PTPDFDoc, which can then be displayed.

linkConvert other non-PDF files

In addition to the file types supported by PDFTron's internal conversion, it is also possible to convert many other file types with an iOS-specific API. The PTConvert class's +convertOfficeToPDF:paperSize:completion: method can convert any file type supported by WKWebView to PDF. Some of the supported file types include:

  • iWork files: .pages, .key, .numbers
  • Binary office files: .doc, .ppt, .xls
  • Rich Text Format files: .rtf

The following code shows how to convert a file with the iOS-specific API:

linkConvert HTML to PDF

The platform-specific conversion API also supports HTML to PDF conversion, either with the +convertOfficeToPDF:paperSize:completion: method for .html files or the +convertHTMLStringToPDF:baseURL:paperSize:completion: for raw HTML text.

The following code shows how to convert an HTML string to PDF:

where baseURL is the URL to use as the page's base URL for resolving relative links in the document.