I do have a UIWebview inside one of my UIViewControllers. The destination URL to be displayed within the WebView is a page on my server (therefore I have access to make changes on it).
That page basically has a list of PDFs to be downloaded (imagine an un-ordered list of hyperlinks each pointing to a PDF file).
I need a way to tell my App that whenever a file is downloaded from that WebView by clicking on one of the links, I need it to be saved inside my application folder instead of the iPhone/iPad memory.
Is there any way I can achieve that? Are there alternatives?
You can allow UIWebView to call your Objective-C delegate function. This link provides an overview of how to do it: http://dblog.com.au/iphone-development/iphone-sdk-tip-firing-custom-events-when-a-link-is-clicked-in-a-uiwebview/ Basically, the delegate function will be called on all requests from the UIWebView. You can examine if they are for links to a pdf files, and if so, write your own objective-c code to download the file and store it in your Application directory. You'll probably want to add some UI to let the user know what is happening. Otherwise you let the request go on as normal and it will be displayed in the web browser.
Related
I've got an 'interactive PDF' that I need to be able to edit and save in an iOS app and I'm looking at how to achieve it. It's got text boxes and radio buttons which I can interact with in the UIDocumentInteractionController preview (or QLPreviewController) but there doesn't seem to be a way to save those changes to the file that was loaded and if I share the live and edited file to my mac via AirDrop it doesn't send the changes, rather it seems just the original file.
I don't really know anything about interactive PDFs so not sure how added text would normally be saved. I've found that the 'Files' app (added in iOS 11) actually saves the edits you make, so that's basically what I want to be able to do.
At the end of the day I just need a way to be able to interact with a PDF in my app and save the changes. Do I maybe need to use a custom PDF viewer rather than trying to piggy back off the standard iOS file previewer functionality?
Looks like this library solves my problem: https://github.com/derekblair/ILPDFKit
It lets you edit a PDF, access and set individual fields and save out as a static PDF.
TL;DR - I want to download a .csv and other files from a link, and present a UIActivityViewController.
I'm working in an app with lots of WKWebViews. In one of the delegate methods, decidePolicyForNavigationAction:, the available URL is a URL compatible with URLRequests, and I can download just fine from it. (navigationAction.request.url)
In another delegate method decidePolicyForNavigationResponse: the response's url (navigationResponse.response.url) identifies as part of Apple's QuickLook framework scheme, and contains this: x-apple-ql-magic. I was trying to use a QLPreviewController, but couldn't populate the dataSource with a remote file I wanted to download.
My goal is: When a link points to a downloadable file, like a .csv or PDF, give a user the option to share this file via UIActivityViewController.
How can I download remote files from this scheme: x-apple-ql-magic?
You can’t. When WKWebView previews a file such as CSV, it is internally converted to HTML by Quick Look to be rendered by WebKit. The x-apple URL is the URL of the converted content. It should not be exposed to you, you should be seeing the original URL instead, please file a bug.
Why do you want to use the response delegate in the first place instead of the delegate at link tap time?
I am currently working on an IOS app that allows users to view docx files within the app. These files have links inside them that link directly to outside sources, such as youtube videos.
The issue is that when any of these links inside the file are clicks, it gives this error and does nothing. Error Image
However, if you load up a file, press and hold the link, click the "share" button, and then click cancel, the links will work fine after that.
To load in the files, i'm using the Document Controller class.
Is there any way to dynamically detect when links inside a file are clicked, and then perform an action (such as open the associated url)?
I use web views in my app and I want the user to be able to open a page in offline mode if he has opened it already before. So I need to somehow store entire page, including images. Is there any easy way to do it where I don't have to parse entire html looking for 's and downloading them separately? I was doing it in my previous project by using ASIWebPageRequest, but I was thinking about moving from ASIHTTPRequest to AFNetworking, starting from this project.
I need to individualize documents within an iOS-App. I could provide the origin-documents as DOCX, PDF, PPT etc. The output-format has to be PDF.
My minimun requirement is to fill some text-fields. Nice to have would be to replace an image, too.
I´m quite used to generate PDFs programmatically using UIGraphicsBeginPDFContextToFile etc. But in my current case I don´t want to create the whole document programmatically, I just want to replace some content.
Any hints / tipps?
Thank you in advance.
DOCX is a zip - format file so you can process the contents programmatically and the reconstruct the zip file. PPT is a binary format though newer versions of PowerPoint might also construct zip-oriented versions that you can programmatically process. You mentioned though that you need don't want to programmatically process these documents - which I would probably also do only as a last resort.
For your DOCX origin/source documents (or doc,odt,rtf but not ppt/pdf) you could use Docmosis cloud services if your app can have the external dependency. You would upload your DOCX origin documents with placeholders for text-fields or images as a one-off/occasional task. Your iOS app then calls Docmosis sending instructions and data to create the output PDF and either stream it back to the app or email/store it or both.
The upside is it takes all the load and coding away from the iOS application (there is an SDK). The downside is it is an external depdendency. Please note I work for the company the created Docmosis.
Hope that helps.
Why not just load a page in a webView modal that points to a URL of a page you create? The main parts of the page would be static, and then the fields you need to customize would be populated via Javascript or PHP.
For example, we have a contact form in our app that gives you an option to view the details of your completed form after you submit. When the user clicks on the button to view the Contact Confirmation, it loads example.com/confirmation.php in a modal view within the iOS App.
On the confirmation.php page (on the web), I use PHP to pull in $_GET variables from the URL parameters which then populates the page with my static content, and their customized information that they entered into the form.