Some test text!
Xamarin / Guides
PTDocumentController
. The PTPDFViewCtrl
is a low-level control that may be used when a higher level of customization is required.
The PTPDFViewCtrl
is a UIView
that displays a PDF.
If your app is displaying a PDF, a PTPDFViewCtrl
will be used in one of two ways:
PTDocumentController
or PTTabbedDocumentViewController
. (It is accessible via the pdfViewCtrl
property.)Add a PDF to your project:
Resources
Add
> Add Files
sample.pdf
) and confirm addBuild Action
of the file is set to BundleResource
Instantiate a new PDFDoc
:
var pdfPath = "sample.pdf";
var docToOpen = new pdftron.PDF.PDFDoc(pdfPath);
Create a new PDFViewCtrl
and add it as a child to the current view:
// Create a new PDFViewCtrl
var pdfViewCtrl = new pdftron.PDF.PDFViewCtrl();
// Set the document to display
pdfViewCtrl.Doc = TypeConvertHelper.ConvPDFDocToNative(docToOpen);
// Add the PDFViewCtrl to the current view controller's root view.
View.AddSubview(pdfViewCtrl);
// Auto Layout
pdfViewCtrl.TranslatesAutoresizingMaskIntoConstraints = false;
NSLayoutConstraint.ActivateConstraints(new NSLayoutConstraint[] {
pdfViewCtrl.LeadingAnchor.ConstraintEqualTo(this.View.LeadingAnchor),
pdfViewCtrl.WidthAnchor.ConstraintEqualTo(this.View.WidthAnchor),
pdfViewCtrl.TopAnchor.ConstraintEqualTo(this.View.LayoutMarginsGuide.TopAnchor),
pdfViewCtrl.BottomAnchor.ConstraintEqualTo(this.View.BottomAnchor)
});
Running the app will now display the PDF sample.pdf
. However, it will not support annotation creation, editing, text selection, or any other UI aspect that is handled by Tools package . To add support for annotations and text selection you need to incorporate the tools package .
Trial setup questions? Ask experts on Discord
Need other help? Contact Support
Pricing or product questions? Contact Sales