<tfoot id='CZnmD'></tfoot>
      • <bdo id='CZnmD'></bdo><ul id='CZnmD'></ul>
      1. <i id='CZnmD'><tr id='CZnmD'><dt id='CZnmD'><q id='CZnmD'><span id='CZnmD'><b id='CZnmD'><form id='CZnmD'><ins id='CZnmD'></ins><ul id='CZnmD'></ul><sub id='CZnmD'></sub></form><legend id='CZnmD'></legend><bdo id='CZnmD'><pre id='CZnmD'><center id='CZnmD'></center></pre></bdo></b><th id='CZnmD'></th></span></q></dt></tr></i><div id='CZnmD'><tfoot id='CZnmD'></tfoot><dl id='CZnmD'><fieldset id='CZnmD'></fieldset></dl></div>
        <legend id='CZnmD'><style id='CZnmD'><dir id='CZnmD'><q id='CZnmD'></q></dir></style></legend>
      2. <small id='CZnmD'></small><noframes id='CZnmD'>

        如何下载 PDF 并将其存储在 iPhone 本地?

        时间:2023-10-23

        • <bdo id='8hqk6'></bdo><ul id='8hqk6'></ul>

          <small id='8hqk6'></small><noframes id='8hqk6'>

            <i id='8hqk6'><tr id='8hqk6'><dt id='8hqk6'><q id='8hqk6'><span id='8hqk6'><b id='8hqk6'><form id='8hqk6'><ins id='8hqk6'></ins><ul id='8hqk6'></ul><sub id='8hqk6'></sub></form><legend id='8hqk6'></legend><bdo id='8hqk6'><pre id='8hqk6'><center id='8hqk6'></center></pre></bdo></b><th id='8hqk6'></th></span></q></dt></tr></i><div id='8hqk6'><tfoot id='8hqk6'></tfoot><dl id='8hqk6'><fieldset id='8hqk6'></fieldset></dl></div>
                <tbody id='8hqk6'></tbody>
            1. <tfoot id='8hqk6'></tfoot>

            2. <legend id='8hqk6'><style id='8hqk6'><dir id='8hqk6'><q id='8hqk6'></q></dir></style></legend>

                  本文介绍了如何下载 PDF 并将其存储在 iPhone 本地?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我能够成功地从网站查看 PDF.我希望能够将该 PDF 下载到设备上,然后在本地访问该文件.

                  I am able to successfully view a PDF from a website. I want to be able to download that PDF to the device, then access that file locally.

                  当应用程序打开时,它会检查在线 PDF 的日期.如果它比本地存储的 PDF 更新,则应用程序将下载新的,否则将打开本地存储的 PDF.

                  When the app is opened, it will check the online PDF's date. If it is newer than the locally-stored PDF, the app will download the new one, otherwise it opens the locally-stored PDF.

                  我目前使用的代码:

                  PDFAddress = [NSURL URLWithString:@"http://www.msy.com.au/Parts/PARTS.pdf"];
                  request = [NSURLRequest requestWithURL:PDFAddress];
                  [webView loadRequest:request];
                  webView.scalesPageToFit = YES;
                  

                  我怎样才能做到这一点?

                  How am I able to achieve this?

                  推荐答案

                  我找到了一种我自己尝试过的方法:

                  I have found one method which I tried myself:

                  // Get the PDF Data from the url in a NSData Object
                  NSData *pdfData = [[NSData alloc] initWithContentsOfURL:[
                      NSURL URLWithString:@"http://www.example.com/info.pdf"]];
                  
                  // Store the Data locally as PDF File
                  NSString *resourceDocPath = [[NSString alloc] initWithString:[
                      [[[NSBundle mainBundle] resourcePath] stringByDeletingLastPathComponent]
                          stringByAppendingPathComponent:@"Documents"
                  ]];
                  
                  NSString *filePath = [resourceDocPath 
                      stringByAppendingPathComponent:@"myPDF.pdf"];
                  [pdfData writeToFile:filePath atomically:YES];
                  
                  
                  // Now create Request for the file that was saved in your documents folder
                  NSURL *url = [NSURL fileURLWithPath:filePath];
                  NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
                  
                  [webView setUserInteractionEnabled:YES];
                  [webView setDelegate:self];
                  [webView loadRequest:requestObj];
                  

                  这将在本地存储您的 PDF 并将其加载到您的 UIWebView 中.

                  This will store your PDF locally and load it into your UIWebView.

                  这篇关于如何下载 PDF 并将其存储在 iPhone 本地?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何在 UIWebView 中增加字体大小 下一篇:当用户点击下拉列表 HTML 选择标签时,ios8 iPad uiwebview 在显示弹出窗口时崩溃

                  相关文章

                • <small id='q7Er6'></small><noframes id='q7Er6'>

                    <bdo id='q7Er6'></bdo><ul id='q7Er6'></ul>
                  <legend id='q7Er6'><style id='q7Er6'><dir id='q7Er6'><q id='q7Er6'></q></dir></style></legend>
                • <i id='q7Er6'><tr id='q7Er6'><dt id='q7Er6'><q id='q7Er6'><span id='q7Er6'><b id='q7Er6'><form id='q7Er6'><ins id='q7Er6'></ins><ul id='q7Er6'></ul><sub id='q7Er6'></sub></form><legend id='q7Er6'></legend><bdo id='q7Er6'><pre id='q7Er6'><center id='q7Er6'></center></pre></bdo></b><th id='q7Er6'></th></span></q></dt></tr></i><div id='q7Er6'><tfoot id='q7Er6'></tfoot><dl id='q7Er6'><fieldset id='q7Er6'></fieldset></dl></div>
                  1. <tfoot id='q7Er6'></tfoot>