Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 126.96.36.199 release ready!
In the article, I will discuss about the PDFKit framework and how we use PDFView in our swift project.
The PDFKit is a framework available in AppKit since iOS 11.0 and macOS 10.4. Please click here to read more about PDFKit.
PDFView is mainly used to show the pdf file in our application and also it allows users to set zoom level, select content, navigate through a document, and copy the textual content to the Pasteboard, and also keeps track of page history.
iOS, Mac Catalyst
Swift version: 5
iOS version: 13
First Create a project from Xcode.
File ▸ New ▸ Project…. Choose the iOS ▸ Application ▸ Single View App template and create a new project.
Then, we will create an object of PDFView and we will add this view inside the super view.
Now we load a pdf file from the app bundle.
We can Fit content in the pdfview set autoScales true
Now run code and it will display Demo.pdf file in our app.
Now we will add a watermark in the PDFView.
First we have to initializes a PDFDocument instance and sets its delegate to self.
Now, the delegate, of type PDFDocumentDelegate, implements a classForPage() method.
Now, implement WatermarkPage class and draw the watermark.
I hope this article helps you to display the pdf file in the project.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Many thanks for your help & BR
It was a successful collaboration. The Mobikul team provided the client everything they needed in a timely and high-quality manner. They were very professional, reliable, and accessible during the entire process. The client also saw no room for any improvements in the vendor's performance.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.