Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6022987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:56:19+00:00 2026-05-23T03:56:19+00:00

I have managed to implement a very basic PDF viewer within my application, but

  • 0

I have managed to implement a very basic PDF viewer within my application, but was wondering if it was possible to add annotations to the PDF. I have looked through the SDK docs, but not found anything. I have 2 questions really:

  1. Is it possible to do this?
  2. What is the best approach to take?
  3. Is there a framework or library that I can include to assist with this?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T03:56:20+00:00Added an answer on May 23, 2026 at 3:56 am

    You can do annotation by reading in a PDF page, drawing it onto a new PDF graphics context, then drawing extra content onto that graphic context. Here is some code that adds the words ‘Example annotation’ at position (100.0,100.0) to an existing PDF. The method getPDFFileName returns the path of the original PD. getTempPDFFileName returns the path of the new PDF, the one that is the original plus the annotation.

    To vary the annotations, just add in more drawing code in place of the drawInRect:withFont: method. See the Drawing and Printing Guide for iOS for more on how to do that.

    - (void) exampleAnnotation;
    {
        NSURL* url = [NSURL fileURLWithPath:[self getPDFFileName]];
    
        CGPDFDocumentRef document = CGPDFDocumentCreateWithURL ((CFURLRef) url);// 2
        size_t count = CGPDFDocumentGetNumberOfPages (document);// 3
    
        if (count == 0)
        {
            NSLog(@"PDF needs at least one page");
            return;
        }
    
        CGRect paperSize = CGRectMake(0.0,0.0,595.28,841.89);
    
        UIGraphicsBeginPDFContextToFile([self getTempPDFFileName], paperSize, nil);
    
        UIGraphicsBeginPDFPageWithInfo(paperSize, nil);
    
        CGContextRef currentContext = UIGraphicsGetCurrentContext();
    
        // flip context so page is right way up
        CGContextTranslateCTM(currentContext, 0, paperSize.size.height);
        CGContextScaleCTM(currentContext, 1.0, -1.0); 
    
        CGPDFPageRef page = CGPDFDocumentGetPage (document, 1); // grab page 1 of the PDF 
    
        CGContextDrawPDFPage (currentContext, page); // draw page 1 into graphics context
    
         // flip context so annotations are right way up
        CGContextScaleCTM(currentContext, 1.0, -1.0);
        CGContextTranslateCTM(currentContext, 0, -paperSize.size.height);
    
        [@"Example annotation" drawInRect:CGRectMake(100.0, 100.0, 200.0, 40.0) withFont:[UIFont systemFontOfSize:18.0]];
    
        UIGraphicsEndPDFContext();
    
        CGPDFDocumentRelease (document);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to implement a new feature in my existing JSF application. As it
I have a very simple subclass of UIViewController : @interface RoastChickenViewController : UIViewController {
I'm trying to learn big three in C++.. I managed to do very simple
I am trying to implement a very simple file transfer client in python using
I have a very simple object model with a base class Person and two
I managed to do almost all the way towards happiness with my custom form
I'm trying to find a way to implement file manager functionality in an mvc
Today i tried to implement the owner drawn menu item support in Cocoa and
I have had an idea. I want to create a software (desktop or web
So, very soon, I will be part of a migration that will move a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.