COMING SOON: Fall 2025 Release
By Garry Klooesterman | 2025 Oct 08
4 min
Tags
annotation
iOS
swift
Summary: The ability to add annotations is key to a great collaboration experience. Having that capability accessible on your mobile device enhances that user-friendly experience even further. This blog will explore how to add annotations to PDFs using Swift and Apryse SDK. It will also cover some commonly asked questions.
PDF annotation capabilities are a key component of a great collaboration experience, supporting real-time teamwork and seamless document markup. Remote teams around the globe, employees working in the field, and multiple departments working on the same files are a few examples of when robust collaboration tools are required. Users need real-time access to the latest information to ensure the data they’re working with is accurate and not outdated, and to enable faster decision making.
For example, reviewing and providing feedback on lengthy documents can be tedious and disconnected, often involving multiple versions or lengthy email chains.
Annotation allows users to add context such as asking questions or clarifying points right where they need to without extra emails or threads. Users can easily communicate with other team members, even those who are offline at the time. Annotation can also be used to track a conversation to understand why something was done a certain way and can help reduce the back-and-forth conversations.
In this blog, we’ll look at adding highlight and link annotations to PDFs using Swift and the Apryse SDK while also covering some commonly asked questions.
Follow this guide to integrate the Apryse iOS SDK into your Xcode projects for iOS applications. Once you have that set up, we’ll move on to the heart of this guide — adding annotations to PDFs.
The Apryse SDK includes many annotation features, such as:
For this blog, we’ll look at adding highlight annotations and link annotations. For other examples and sample code, see the full documentation.
Adding highlight annotations is straightforward. We’ll use the following code to define the coordinates of the annotation and set the highlighting.
let doc: PTPDFDoc = PTPDFDoc(filepath: filename)
let page: PTPage = doc.getPage(1)
// Create a highlight
let hl: PTHighlightAnnot = PTHighlightAnnot.create(doc.getSDFDoc(), pos: PTPDFRect(x1: 100, y1: 490, x2: 150, y2: 515))
hl.setColor(PTColorPt(x: 0, y: 1, z: 0, w: 0), numcomp: 3)
hl.refreshAppearance()
page.annotPushBack(hl)
And done! Now let’s look at link annotations.
Adding link annotations, whether it’s to an external source or another page in the current document, is done with just a few lines of code. In the following code, we’ll see how to set up a hyperlink and an intra-document link. Like in the previous example, we’re defining the coordinates of the annotation and then setting the link. In this case, one link to “http://www.apryse.com” and one to “page 3” of the current document.
let doc: PTPDFDoc = PTPDFDoc(filepath: filename)
let page: PTPage = doc.getPage(1)
// Create a hyperlink
let hyperlink = PTLink.create(withAction: doc.getSDFDoc(), pos: PTPDFRect(x1: 85, y1: 570, x2: 503, y2: 524), action: PTAction.createURI(doc.getSDFDoc(), uri: "http://www.apryse.com"))
hyperlink.refreshAppearance()
page.annotPushBack(hyperlink)
// Create an intra-document link
let goto_page_3 = PTAction.createGoto(PTDestination.createFitH(doc.getPage(3), top: 0))
let link: PTLink = PTLink.create(withAction: doc.getSDFDoc(), pos: PTPDFRect(x1: 85, y1: 458, x2: 503, y2: 502), action: goto_page_3)
link.refreshAppearance()
page.annotPushBack(link)
That’s it. Now you have a PDF with 2 separate link annotations.
And that’s just how easy it is to set up both highlight and link annotations in a PDF with the Apryse iOS SDK.
Here are some commonly asked questions about annotations.
What annotation types are supported by the Apryse iOS SDK?
The Apryse iOS SDK supports many annotation types, including:
These give you flexibility to annotate documents in many styles, contexts, and with rich media.
What are the benefits of embedded annotations?
Annotation enables users to highlight important information for other readers and enhances collaboration in a single application, eliminating the need to switch between applications.
Does Apryse iOS SDK support real-time collaboration?
Yes. The Apryse iOS SDK supports real-time collaboration, allowing multiple users to easily synchronize annotations and messages on a document.
Can I customize the appearance of an annotation?
Yes. You can customize various style elements such as:
As you can see, adding annotation capabilities to your iOS app can be done with just a few lines of code with the Apryse iOS SDK. This allows you to easily give your users the tools they need for effective and efficient collaboration.
Apryse iOS SDK is a fully supported SDK with robust functionality, reliable high-performance rendering, and powerful annotation capabilities out-of-the–box. It also includes a highly customizable UI which gives you control over the look and feel of your app.
Try it out for yourself with our demo or get started now.
You can also contact our sales team for any questions and for support and discussions, check out our Discord community.
Tags
annotation
iOS
swift
Garry Klooesterman
Senior Technical Content Creator
Share this post
PRODUCTS
Platform Integrations
End User Applications
Popular Content