Some test text!
You have a few options to open a document such as with a document view controller, tabbed document view controller or an embedded view.
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:
PTTabbedDocumentViewController. (It is accessible via the
Add a PDF to your project, by dragging it into the project's left side panel. Ensure that it will be copied into the bundle's resources by checking that it is listed under the Copy Bundle Resources section of the project's Build Phases. (If it is not present here, add it using the '+' button.)
sample.pdfhas been added to the project, and will be copied into the bundle.
Instantiate a new
// Get the path to document in the app bundle. NSString* pdfPath = [[NSBundle mainBundle] pathForResource:@"sample" ofType:@"pdf"]; // Instantiate a new PDFDoc with the path to the file. PTPDFDoc* docToOpen = [[PTPDFDoc alloc] initWithFilepath:pdfPath];
Create a new
PTPDFViewCtrl and add it as a child to the current view:
// Create a new PDFViewCtrl PTPDFViewCtrl* pdfViewCtrl = [[PTPDFViewCtrl alloc] init]; // Set the document to display [pdfViewCtrl SetDoc:docToOpen]; // Add the PDFViewCtrl to the current view controller's root view. [self.view addSubview:pdfViewCtrl]; // Set the size of the PDFViewCtrl to that of its superview. // (Auto Layout is fully supported as well) pdfViewCtrl.frame = self.view.bounds; pdfViewCtrl.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
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.framework. To add support for annotations and text selection you need to incorporate the tools framework.
Get the answers you need: Support
Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.
Select a platform to get started with your free trial.
Unlimited usage. No email address required.