If you have integrated the document viewer previously in your app (i.e. DocumentActivity or PdfViewCtrlTabHostFragment), you can easily migrate to use the new UI with a couple of simple steps.
ViewerBuilder to ViewerBuilder2. This new builder will create the new viewer fragment PdfViewCtrlTabHostFragment2, which contains the new UI.PdfViewCtrlTabHostFragment to PdfViewCtrlTabHostFragment2 in your project.PdfViewCtrlTabFragment to PdfViewCtrlTabFragment2 in your project.CustomAppTheme style to customize your theme, you will need to change this style to extend PDFTronAppTheme and pass it into ViewerBuilder2 as described in our customize viewer theme guide.DocumentActivity.openDocument(...).DocumentActivity.IntentBuilder as described in this guide.CustomAppTheme style to customize your theme, you will need to change this style to extend PDFTronAppTheme.In version 8.0.0, we introduced a new version of the main viewing component. The new class, PTDocumentController, is a near drop-in replacement for the old PTDocumentViewController.
The new UI's API is almost entirely additive, so migrating will in many cases be a case of changing only the class name of the instantiated view controller. If you have implemented delegate methods or accessed a select few APIs, some other code changes will need to be made, as explained below.
PTDocumentViewControllerPTDocumentViewController to PTDocumentController.Delegate methods
The class' delegate type has been changed from PTDocumentViewControllerDelegate to PTDocumentControllerDelegate.
Required change: If you have implemented delegate methods, must update the protocol you implement and the method signatures:
PTDocumentViewControllerDelegate to PTDocumentControllerDelegate.PTDocumentController, both in method name and parameter type, eg:is now
PTTabbedDocumentViewControllerAs of version 8.0.2, the PTTabbedDocumentViewController will by default create tabs which host instances of PTDocumentController rather than legacy PTDocumentViewController objects. No changes to accomplish this are needed on your part.
(To revert to the old legacy UI, set the viewControllerClass property of the tabbed document view controller to PTDocumentViewController).
The PTTabbedDocumentViewController's property types (e.g. selectedViewController) and method signatures (e.g. documentViewControllerAtIndex:) have changed to reference the PTDocumentBaseViewController abstract base class, from which both the PTDocumentController and legacy PTDocumentViewController inherit.
Delegate methods
The type of the documentViewController parameter of the tabbedDocumentViewController:willAddDocumentViewController: delegate method has changed from PTDocumentViewController to the abstract base class PTDocumentBaseViewController.
PTTabbedDocumentViewControllerDelegate protocol. In Swift if the parameter type in your implementation does not match the type declared in the protocol then your implementation of the method will not be called.The table below lists APIs that have changed.
Most properties operate as before. These are the ones that have been removed, and how to accomplish the same thing with a PTDocumentController.
Removed | How to achieve the same functionality with a |
|---|---|
| One-touch access to freehand annotations is now found in the toolbar. It (and any other tool's button) can be hidden as described in the customize guide. |
| The visibility of the toolbar is now controlled via the toolbar switcher. The switcher can be hidden as described in the customize guide. |
| A freehand button no longer exists by default in the the navigation items, but one can be added described in the customize guide. |
| The toolbar's visibility is now controlled by a |
| This property is now part of |
| This property is now part of |
| The customize guide shows how to programmatically customize the new annotation toolbar. The old annotation toolbar class, |
| The customize guide shows how to hide and show the new annotation toolbar. |
The PTAnnotationToolbar is no longer used, as the new classes are far more versatile and customizable. The old class is available for direct integration if your app requires it.
Did you find this helpful?
Trial setup questions?
Ask experts on DiscordNeed other help?
Contact SupportPricing or product questions?
Contact Sales