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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:10:50+00:00 2026-05-26T02:10:50+00:00

In my work, I just want to read a downloaded PDF in iphone device

  • 0

In my work, I just want to read a downloaded PDF in iphone device

At first, I tried to use the “bundleRoot” directory, it is work in simulator but not on device. Now, I just test in simulator for Directory of Document or Cache.

How can I get a writable path on the iPhone?

After I read the above topic,

I have tried using Directory of Document or Cache.

Here is my code in finding the writable path

/******************************************************************************/

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *cachePath = [paths objectAtIndex:0];
BOOL isDir = NO;
NSError *error;

if (! [[NSFileManager defaultManager] fileExistsAtPath:cachePath isDirectory:&isDir] && isDir == NO) {
    [[NSFileManager defaultManager] createDirectoryAtPath:cachePath withIntermediateDirectories:NO attributes:nil error:&error];
}


NSString *path_to_file = [cachePath stringByAppendingPathComponent:@"testing6.pdf"];

/******************************************************************************/

I can find the downloaded file and get the size in this directory,but I cannot read the file by using the following code :

            pdf = CGPDFDocumentCreateWithURL((CFURLRef)pdfURL);

    page = CGPDFDocumentGetPage(pdf, 1);
    CGPDFPageRetain(page);

    CGRect pageRect = CGPDFPageGetBoxRect(page, kCGPDFMediaBox);

The return pageRect.size.width is 0

After I print out the download and retrieve file path also are :

/Users/ITDEV/Library/Application Support/iPhone Simulator/4.3.2/Applications/806ED359-70F8-4C07-996F-6AFC959B3FC7/Library/Caches/testing6.pdf

Anyone can help me pls?

  • 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-26T02:10:51+00:00Added an answer on May 26, 2026 at 2:10 am

    If all other answers won’t work then try using NSBundle as below:

    NSString *path = [[NSBundle mainBundle] pathForResource:@"myfilename" ofType:@"pdf"];
    NSLog("path : %@",path);
    

    Same problem i faced and i found that my plist file was not in Documents directory but instead it shows me path to my app and then it shows MYAppName.app/myPlist.plist file. This means that the app file includes my plist file in its own bundle i.e. MainBundle.

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

Sidebar

Related Questions

I have some tabs using jQuery UI which work just fine, but I want
I saw similar examples here. But it just doesn't work for me. I want
I tried to work with the boost library to read/write configuration files but I
I just want to know why this doesn't work (I am trying to name
I have a page that displays messages and I want it to work just
This is something that should be very simple. I just want to read numbers
I must be missing something obvious, but I can't make it work I want
For some time now, I want to use the update functionality of eclipse. But
this code in my plugin used to work just fine: jQuery('#embedded_obj', context).get(0).getVersion(); and the
I like to be sure that everything will work just by copying the contents

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.