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 8284907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:16:57+00:00 2026-06-08T11:16:57+00:00

I am making an app where the user can load up a pdf and

  • 0

I am making an app where the user can load up a pdf and view it page by page and annotate it. The user can draw on the screen with different colors and also place textfields on the screen and place their text.

There is one view for the pdf and one view for the annotations. The created UITextViews are added as subviews of the annotation view (theDrawingView in the code). These text views show up fine within the application but when the pdf gets generated to include the annotations, the textviews do not show (all the other annotations do).

I tried to call the drawRect of the textView with both its own bounds and the bounds the other views are using, neither worked. The only subviews of the drawing view are textviews.

Here is where I do the drawing to generate the pdf:

for (int i = 0; i < numPages; i++) {
    UIGraphicsBeginPDFPage();

    //set the current pages of the views to get each page

    [self nextPage];

    [thePDFView drawRect:bounds];
    [theDrawingView drawRect:bounds];
    for(UITextView *txt in [theDrawingView subviews]){
        [txt drawRect:txt.bounds];
    }
}

UIGraphicsEndPDFContext();

Any ideas on how to get the text views to get drawn on the pdf context? Thanks

EDIT: Originally was using UITextFields but I had to switch to UITextViews instead to solve a different issue. The UITextViews also won’t show on a generated pdf.

  • 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-08T11:16:59+00:00Added an answer on June 8, 2026 at 11:16 am
    for (int i = 0; i < numPages; i++) {
    UIGraphicsBeginPDFPage();
    
    //set the current pages of the views to get each page
    
    [self nextPage];
    
    [thePDFView drawRect:bounds];
    [theDrawingView drawRect:bounds];
    for(UITextView *txt in [theDrawingView subviews]){
        NSString *textToDraw = txt.text; 
        UIFont *font = txt.font; 
        CGRect renderingRect = txt.frame;
    
        [textToDraw drawInRect:renderingRect withFont:font lineBreakMode:UILineBreakModeWordWrap alignment:UITextAlignmentLeft];
    }
    

    Just to format that a little better, here is the code that makes a UITextView get rendered into the pdf as it is generated. This method seems to work for rendering any string object so I’m sure it would work fine for UILabels or UITextFields as well. I used UITextiews because they easily adapt to dynamic heights.

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

Sidebar

Related Questions

I'm making an app in which I open a BrowserField and the user can
I am making an app where the user can set an alarm based on
I'm making an app wherein the user can add new data to a QTreeModel
I'm making this app with which the user can record and play sound and
I'm making an app with which the user can record sound and send it
I'm making an iPhone app in which the user can do gestures (left and
I've got a part in my app where the user can view some notes
So im making this app where user could add UP to 3 images to
Im making an app that should let the user see video from the camera
Hi i'm making an app which need to get user's gmail account contact list

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.