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

  • SEARCH
  • Home
  • 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 8961725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:57:39+00:00 2026-06-15T15:57:39+00:00

So I am implementing a specific type of PDF editor for the iPad, for

  • 0

So I am implementing a specific type of PDF editor for the iPad, for personal use.
I have already implemented the PDF viewer, and now i am stuck in the editing part. Here is the deal:
I display each page of the document in a UIView, and then create another view, with the exact same size of the page inside it. I then let the user draw on the view

Now, say i want to print that UIVIiew in the exact page of the PDF file it was drawn.
I am aware of a way to do this, but it is taking too long for bigger documents.
I was doing it like this (simplified the code for better understanding):

UIGraphicsBeginPDFContextToFile(file, pageSize, nil);

for (size_t currentPage = 1; currentPage <= pageCount; currentPage++) {

    UIGraphicsBeginPDFPageWithInfo(pageSize, nil);
    CGContextRef ctx = UIGraphicsGetCurrentContext();
    //translates context, copies doc page to the new pdf, translates back
    CGContextTranslateCTM(ctx, 0, pageSize.size.height);
    CGContextScaleCTM(ctx, 1.0, -1.0); 
    CGPDFPageRef page = CGPDFDocumentGetPage (document, currentPage);
    CGContextDrawPDFPage (ctx, page);
    CGContextScaleCTM(ctx, 1.0, -1.0);
    CGContextTranslateCTM(ctx, 0, -pageSize.size.height);
    //custom drawing goes here
    if(currentPage == desiredPage) [imageFromView drawInRect:pageSize];
}
UIGraphicsEndPDFContext();

The problem here is that this procedure recreates the entire PDF, and for larger documents, this can take minutes to finish.

I needed a solution that prints the UIView (that the user drew on) in a page of the PDF document, without having to recreate the whole document.

Any links, tips and other useful information are very appreciated. Thanks in advance

  • 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-06-15T15:57:40+00:00Added an answer on June 15, 2026 at 3:57 pm

    On iOS there is only CGPDF and this does not support mutability as the Mac’s PDFDocument partially does.

    You would have to write your own solution to take the PDF streams of unmodified pages and combine these with one for the new page that you are creating. I began an open-source project for a DTPDFDocument wrapper modeled after the one on Mac, but I didn’t do any work so far in moving or modifying pages: https://github.com/Cocoanetics/DTPDF

    Or you could use one of the many available PDF frameworks. PSPDFKit is the first that comes to mind.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do I get all types that implementing a specific open generic type? For
Implementing a simple Login screen using JSF and Spring and Hibernate. I have written
when implementing a recursive function during development, i will use a counter and exit
I am having a specific problem implementing a parametrised class Parameter, but this is
I am implementing a Windows-based web server handling multiple specific HTTP requests from clients
I am implementing something like an object factory in PHP. I have: class Factory{
I have ControlA which accepts an IInterfaceB which has a property of type List<unknownType>
inspired by Clojure, and Peter Norvig I have been trying my hand at implementing
I have a Visual Studio 2008 C# 2.0 CF project where I am implementing
I hope this isn't too specific. I have created an XML Schema which i

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.