Loading pdf file from iPhone Documents folder into a UIWebView

I'm currently trying to include the ability for my App to download a "pdf" file from the web,... display the image in a UIWebView,.. save it to the iPhone,... and later redisplay it in the same UIWebView while "off line". I've been able to do everything but get the web view to load/display the stored pdf file. The App finds the .pdf file...
Here's the path it finds in the Simulator...
Image File Path: /Users/FCR/Library/Application Support/iPhone Simulator/User/Applications/8E29ACDF-4A56-4AC2-BFA0-C4F8E00E1481/Documents/AD_K EWR.pdf
... but I'm not much into html and can't seem to come up with a url scheme to load the image. I've tried several attempts using the URL... "file:///" ... but so far haven't been able to get the file (which is in the iPhone's Documents folder) to display. I seem to be about one line short of a workable solution.
Can anyone offer a bit of code (help) to accomplish this seemingly easy task of displaying it in the UIWebView?... It would be much appreciated!

EdOfTheMountain wrote:
Thanks for your post and sharing your solution.
Can you please post the code snippet used to download and save the PDF to the iPhone? I did not know you could do that.
-Ed
Ed,... Here's the code ... I've cut and pasted from a couple different routines, but you should get the point...
Ric
- (BOOL)downloadPDF:(NSString *)pdfFileName
// Download a (pdf) file
BOOL success = NO;
NSString *urlStr = \[NSString stringWithFormat:@"http://... web path to file .../%@", pdfFileName\];
if(urlStr)
NSURL *PDF_URL = \[NSURL URLWithString:urlStr\];
NSMutableData *receivedData = \[NSData dataWithContentsOfURL: PDF_URL\];
if(receivedData)
success = YES;
NSLog(@"PDF downloaded... Save it to file: %@",pdfFileName);
NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
if (paths.count > 0)
NSString *documentsDirectory = \[paths objectAtIndex:0\];
NSString *filePath = \[documentsDirectory stringByAppendingPathComponent: pdfFileName\];
if(\[receivedData writeToFile:filePath atomically:YES\])
success = YES;
NSLog(@"Saved file: %@",filePath);
else
NSLog(@"Failed to save PDF to: %@",filePath);
return success;
}

Similar Messages

  • How do I move a pdf file from my download area into adobe reader

    How do I move a pdf file from my download area into adobe reader

    Hi!
    Adobe Reader automatically lists all the PDFs on your device in it's file browser. You can toggle between the "All PDFs" view and "Folder View" in the "Documents" tab of the file browser.
    Thanks
    Adobe Reader Team

  • Problem when loading pdf files from Shared Content

    When I load pdf files from Shared Content, I got the following problem: "The selected document could not be retrieved, please try uploading the document again."
    Anyone knows this?
    Thank you very much in advanced.

    I don't migrated the program, but installed it from the original installer,
    i. e. I first installed Indesign from backup, and then uninstalled it and
    reinstall  clean from Adobe.
    What a plug-in or utility converts page from InDesign to PDF?
    2014-08-10 22:51 GMT+04:00 Peter Spier <[email protected]>:
        problem with exporting PDF files from InDesign CS5  created by Peter
    Spier <https://forums.adobe.com/people/P+Spier> in InDesign - View the
    full discussion <https://forums.adobe.com/message/6627440#6627440>

  • How to Enable Plugin before File Opened And Load PDF File From memory?

    hello everyone,
    there have two problems,all i want to do is to show a pdf file encrypted by AES algorithm.
    1.one is how to enable plugin before file opened?
    i developed another two plugin,and each enabled after one pdf file was opened,and now i want to replace the file open command and can do some word by meself,such as decrypt the pdf ?
    2.another is how to load pdf file from memory?
    if i can enable plugin before file opened,and than i can read the file and decrypt it,and now i want to do is do load the decrypt file (in memory) into the adobe?
    i tried many method,but all in vain.who can help me or give me some advice?
    thanks.
    merry chrismas to everyone.

    The proper way to handle other file formats (even where it is really a PDF that has been "wrapped") is to create an AVConversionHandler.
    To load a PDF from a source other than the file system, you need to create a custom AVFileSys.

  • I cannot delete a file from the document folder.  I can move it to the trash and then empty the trash, but when I go back to the documents folder it is still there.

    I cannot delete a file from the documents folder.  I can move it to the trash and then empty it, but when I go back to the documents folder, the file is still there.

    Gay,
    I wonder what your computing environment is. Is your account being administrated by another account? Are you working in an account subject to "Parental Controls"?
    Jerry

  • How to send pdf file from iphone 5s to iphone 4s

    want to send files from iphone 5s to iphone 4s, tried downloading bluthooth apps but does not send. i dont know how to do it.

    It depends, to some extent on the app you're using to view PDFs. It most app, there is a sharing icon (looks like a box with an arrow coming out the top). Tap that, tap Mail and email the PDF.

  • How do I load PDF files from my flash drive to my iPad

    just go an iPad and need to transfer several PDF files from flash drive to the iPad.   I get an error message,not enough power

    You can't! If you have a computer you can send them bij email to your iPad or use the free Dropbox; http://db.tt/VCNzkXr

  • Automate creating single PDF file from multiple documents

    Hi everyone ! I am testing the Adobe XI version, especially because I need it for a very specific function.I haven't found it yet, maybe you guys can help ?
    Basically, I need to make a user friendly system, that in one click will create a single PDF document from multiple files :
    To be more precise : I have in a folder on the network 25 different documents (Word and PDF mainly). Some of these documents change weekly. What I need as an end result is a single PDF, that combines these 25 ones in a specific order, and the tricky part is I need to automate this so that someone with absolutely no knowledge of Acrobat can perform this task, with just a click.
    I have found of course the procedure to manually build such a combined PDF, but as you can see it does not fulfil my needs.
    So that's it, as simple as that
    As a bonus question : I am still struggling with the construction of these documents : in the Word documents I use, there are both internal links within the document, and links between the documents (pointing to other Word files, or PDF files). I keep losing those links when I combine, is there something I am missing ?
    Second bonus question : I would like to have multiple levels of signets, but for some reason all my signets are at the same hierarchical level. Anything I am doing wrong ?
    A free electronic doughnut for anyone giving me a hint !

    When you combine you have many PDFs together in one, new PDF.  Your orignal links are from one specific file to another specific file. A combine does not change the link in the original file. So the link is now from the  PDFcombined  to the second specific file. However, "second specific file" won't be present - so, "broken link".
    Be well...

  • Cannot delete .PDF files from a shared folder.

    Hello,
    I am having issues with deleting/renaming PDF files!
    Permissions is not an issue as even logged in as the Network Administrator of the Domain, I still can't delete the file.
    The error message I'm recieving is:  cannot delete xxxx.pdf It is being used by another person or program.  Close any programs that might be using this file and try again.
    There are only 1 or 2 users that would have access to the files and neither of them are using them.  I can also reset the security permissions for the file and take ownership, but even after doing these things it doesn't make a difference?
    I've tried various unlocking tools (Unlocker) and none of them report that the file is open or that there are any locks on them.  This only happens with PDF files. If I reboot the sever the problem will go away, but this server needs to be 99.999% of the
    time!
    Help please!

    Hi,
    Windows is somehow accessing Thumbs.db during the time of the folder move/delete attempt.  Please go into Folder options > View > Always show icons, never thumbnails to check if you can delete .PDF files.
    For more detailed information, please refer to the thread below:
    Network folders - cannot move/delete even though not in use
    http://answers.microsoft.com/en-us/windows/forum/windows_7-files/network-folders-cannot-movedelete-even-though-not/14fdcda7-e22e-4991-939b-b3fcdb049e0f
    Best Regards,
    Mandy 
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • How to insert a pdf file from a dynamic location into a table

    Hi friends
    Can any one please let me know how to insert a pdf file into a table from a dynamic location in server.
    suppose say i have a table CUST_BLOB(file_name, file_data). I have a file in directory c:\local having file_name test.pdf
    I want to insert this file in CUST_BLOB. Please help me.
    Thanks in advance.
    --Ahmed                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    user620950 wrote:
    Hi friends
    Can any one please let me know how to insert a pdf file into a table from a dynamic location in server. Why dynamic locations on the server?
    Make it a business case that the files should be stored in specific location(s).
    Oracle uses directory objects to point to locations on the file system and, whilst these locations can be altered, it is better practice to set up specific locations and grant permission to the correct users for those locations so that there is full control over who is accessing what on the server. Whilst filenames may be dynamic, I wouldn't recommend using dynamic locations.

  • Issues opening PDF files from SharePoint document library reader/pro 11.0.5

    Hello,
    We have a sharepoint 2010 enviroment and recently upgraded our Acrobat X11 installs ( both reader/std/pro) to version 11.0.5.
    We have a mixture of WIndows 7 32/64Bit IE 8 and IE 9 machines
    After upgrading to 11.0.5 when users click a pdf file in a SP document libary one of two things happens depending if they have the
    Adobe Reader Plugin Enabled or not
    If the Adobe Reader Plugin is enabled, they will not get prompted to run/save the pdf file and it will not open in a new tab in the browser
    If the Adobe Reader Plugin is disabled, they will get a popup window that has the correct URL to the PDF in the address bar but they will not be prompted to save or run the file.
    If they click in the addrss bar and press enter the pdf will then load in the external reader/acrobat application.
    This issue started with 11.0.5 updates, rolling people back to 11.0.4 fixes the issue.
    I have attempted everything I can think of including rebuilding new machines with our image.
    Has anyone see issues like this with the 11.0.5 update?

    If a bug is confirmed, a fix may be delivered in the next release (can't promise). For a similar issue caused by a Microsoft bug, see http://forums.adobe.com/message/6106294#6106294.
    Ben

  • Unable to load pdf-files from the internet. Message shown is: Before viewing PDF documents in this browser you must launch Adobe Reader and accept the End User License Agreement, then Quit and relaunch the browser. But this does not work!

    Can somebody help me with this?

    Hey Paul,
    Please try to:
    Remove from the folder /Library/Internet Plug-Ins:
    1) AdobePDFViewer.plugin
    2) AdobePDFViewerNPAPI.plugin
    backup these plugins - just in case.

  • I purchased Acrobat pdf 21/11/14 and after adding 2 files from my documents folder (both pdf files) one is printable and the other cannot be printed as the print option on the control bar does not function.I need an email address for support now

    I purchased adobe acrobat 21/11/14 I am already having problems relating to printing and creating a pdf document. I DO NOT want to waste my time reading a multitude of FAQ's I want a direct contact with a person actually in support for Adobe to be able to communicate by email and not automated messages. what is the email address for Adobe support please ?
    Andrew Morris this message dated 21/11/14 London time 14:13

    Can any member of the support team please contact me now ? My email: [email protected]

  • Creating pdf files from word document and allow copying of content

    I generate word documents and then save them in PDF format before sending out to clients.  Sometimes these documents contain quite a lot of data in table format and I want my clients to be able to copy the data from the tables and be able to paste it into excel.  How do I save as PDF and still allow copying of content?
    Thanks

    Open such a PDF in Adobe Reader: File | Properties | tab Security.  It will tell you if copying is allowed or not.
    I don't know if you can change these security options from Word; you'll have to ask Microsoft.  To change them after the PDF was created, you will need Acrobat.

  • How to print names all files from a given folder into a file??

    Hi,
    Given is folder which contains folder's n files. the same is wd every folder.
    How to print names of all files in parent dir.
    ex: C drive
    1) windows 2)prog files 3) Documents 4) a.txt
    1.a) cursors.........
    2.a) netbeans.....
    3.a) rcm_b05
    output:
    c:\windows\cursors\s.txt
    c:\progfiles\ram\m.tc
    a.txt

    Hi,
    look at http://exampledepot.com/egs/java.io/TraverseTree.html, copy the "visitAllFiles" method and implement the "process" method as follows:
        public static void process(File f) {
            System.out.println( f.getAbsolutePath());
        }- Michael

Maybe you are looking for