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

The Archive Base Latest Questions

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

I have this question that is driving me crazy: could I save a PDF

  • 0

I have this question that is driving me crazy: could I save a PDF file (that is online) locally on an iOS Device so that I can view the file every time even offline in the same UIWebView?
If I could, how?

  • 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-27T03:14:23+00:00Added an answer on May 27, 2026 at 3:14 am

    If you have control over such UIWebView and the URL it opens, then yes, you can. See the following code as example. It uses the ASIHttpRequest library, which you can find at http://allseeing-i.com/ASIHTTPRequest/

    #import "WebViewPDFViewController.h"
    #import <CommonCrypto/CommonDigest.h>
    #import "ASIHTTPRequest.h"
    
    @implementation WebViewPDFViewController
    
    -(NSString *) md5:(NSString *) str {
        const char *cStr = [str UTF8String];
        unsigned char result[16];
        CC_MD5( cStr, strlen(cStr), result );
    
        return [NSString stringWithFormat:
            @"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",
            result[0], result[1], result[2], result[3], 
            result[4], result[5], result[6], result[7],
            result[8], result[9], result[10], result[11],
            result[12], result[13], result[14], result[15]
        ];  
    }
    
    -(void) viewWillAppear:(BOOL)animated {
        NSString *pdfOnlinePath = @"http://redinter.eu/web/files/revistas/2Dummy.pdf";
    
        // Check if the file is already stored locally. If it is not, then first
        // download it, and load from the local cache. Next requests will always
        // load from the local cache
        NSString *pdfHash = [self md5:pdfOnlinePath];
        NSString *pdfCachePath = [NSString stringWithFormat:@"%@/pdfcache_%@.pdf", 
            [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0], 
            pdfHash];
    
        if ([[NSFileManager defaultManager] fileExistsAtPath:pdfCachePath]) {
            NSLog(@"Cached file found, using it");
        }
        else {
            // Not found in the local cache, download and store it
            NSLog(@"File  not found in the local cache, going to download it");
            ASIHTTPRequest *downloadRequest = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:pdfOnlinePath]];
            [downloadRequest setDownloadDestinationPath:pdfCachePath];
            [downloadRequest startSynchronous];
        }
    
        NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL fileURLWithPath:pdfCachePath]];
    
        UIWebView *webView = [[[UIWebView alloc] initWithFrame:self.view.bounds] autorelease];
        [webView loadRequest:request];
    
        [self.view addSubview:webView];
    }
    
    - (void)dealloc {
        [super dealloc];
    }
    
    @end
    

    I have tested it here ant it works fine.

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

Sidebar

Related Questions

Following on from this question I now have code that can attach to a
I have a question that is driving me crazy. It is all about updating,
This is probably a simple question, but it's driving me crazy! I have a
This is a newbie question that is driving me crazy. According to jQuery mobile
I have a question that is driving me crazy. I have a large number
I have this little question that's been on my mind for a while now.
This question is tied in with this other question that I asked I have
I have a UIView subclass ( CustomView for purposes of this question) that has
I realize that this question has been asked 100times but none that I have
Similar to this question: link However I have already mastered that. My problem is

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.