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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:25:30+00:00 2026-06-10T07:25:30+00:00

I am struggling with the problem from last few hour. I make a pdf

  • 0

I am struggling with the problem from last few hour. I make a pdf programmatically and save it on ~/library/Application Support/iPhone Simulator/… and the programs work fine for me in simulator. I can save and retrieve the pdf in webView.

But when I test my App in iPhone4 device I not see the pdf file when I retrieve. I am new so I don’t know check manually that pdf created in device or not.

Please provide me help.

thanks

I save the pdf from this code :

- (void)generatePdfButtonPressed{

pageSize = CGSizeMake(612, 792);
NSString *fileName = @"Demo.pdf";
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *pdfFileName = [documentsDirectory stringByAppendingPathComponent:fileName];

[self generatePdfWithFilePath:pdfFileName];
}


- (void) generatePdfWithFilePath: (NSString *)thefilePath
{
UIGraphicsBeginPDFContextToFile(thefilePath, CGRectZero, nil);

NSInteger currentPage = 0;
BOOL done = NO;
do
{
    // Mark the beginning of a new page.
    UIGraphicsBeginPDFPageWithInfo(CGRectMake(0, 0, pageSize.width, pageSize.height), nil);

    // Draw a page number at the bottom of each page.
    currentPage++;
    //[self drawPageNumber:currentPage];

    //Draw a border for each page.
  //  [self drawBorder];

    //Draw text fo our header.
    [self drawHeader];

    //Draw a line below the header.
    [self drawLine];


    //Draw personel details
    [self drawPersonelDetail];

    //Draw Education
    [self drawEducation];




    //Draw work Experiences
    [self drawWorkExperiences];

    //Draw work Activities
    [self drawActivities];


    //Draw Skills
    [self drawSkils];


    //Draw some text for the page.
 //   [self drawText];

    yCord=550;
//    [self drawText];

    //Draw an image
//    [self drawImage];
    done = YES;
}
while (!done);

// Close the PDF context and write the contents out.
UIGraphicsEndPDFContext();
}
  • 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-10T07:25:31+00:00Added an answer on June 10, 2026 at 7:25 am

    After a long struggling I find the solution of my own question : I provide solution below may be it help any other.

    - (void)generatePdfButtonPressed{
    
    pageSize = CGSizeMake(612, 792);
    NSString *fileName = @"Demo.pdf";
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *pdfFileName = [documentsDirectory stringByAppendingPathComponent:fileName];
    
    [self generatePdfWithFilePath:pdfFileName];
    }
    
    
    - (void) generatePdfWithFilePath: (NSString *)thefilePath
    {
    UIGraphicsBeginPDFContextToFile(thefilePath, CGRectZero, nil);
    
    NSInteger currentPage = 0;
    BOOL done = NO;
    do
    {
    // Mark the beginning of a new page.
    UIGraphicsBeginPDFPageWithInfo(CGRectMake(0, 0, pageSize.width, pageSize.height), nil);
    
    // Draw a page number at the bottom of each page.
    currentPage++;
    [self drawPageNumber:currentPage];
    
    //Draw a border for each page.
     [self drawBorder];
    
    //Draw text  our header.
    [self drawHeader];
    
    //Draw a line below the header.
    [self drawLine];
    
    
    //Draw personel details
    [self drawPersonelDetail];
    
    //Draw Education
    [self drawEducation];
    
    
    //Draw an image
    [self drawImage];
    
    done = YES;
    }
    while (!done);
    
    // Close the PDF context and write the contents out.
    UIGraphicsEndPDFContext();
    }
    
    
    
    And for Display the pdf file the method is :
    
    - (void)showPdfClicked
    {
    
    pdf1View.scalesPageToFit = YES;
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    
    NSLog(@"%@",documentsDirectory);
    
    NSString *path1 =[documentsDirectory stringByAppendingPathComponent:@"Demo.pdf"];
    
    NSLog(@"Retruve Save path is %@: ",path1);
    // NSString *path1 = [[NSBundle mainBundle] pathForResource:@"pdf1" ofType:@"pdf"];
    NSURL *targetURL1 = [NSURL fileURLWithPath:path1];
    NSURLRequest *request1 = [NSURLRequest requestWithURL:targetURL1];
    [pdf1View loadRequest:request1];
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been struggling with this problem for the last few hours, and it
I'm struggling with the problem to cut the very first sentence from the string.
I've been struggling with this problem for a few hours and it is preventing
Hey Guys I've been struggling with this for the last hour and pouring over
Struggling with this problem for an hour now and searched both stackoverflow and google
I am struggling with a weird problem. I have an application manifest that defines
I am struggling with this problem from yesterday. What I have done so far?
I´m struggling to understand this concept: I have a fixed size definition: (from http://msdn.microsoft.com/pt-br/library/aa931918.aspx
I am struggling with a problem that In my application Im having audio files
I'm new to Hibernate and I'm struggling with problem: I have 3 tables and

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.