Open PDF with calculated form fields

Hi for everyone,

I'm new developing ios applications. I'm develop an app where users can connects to website and downloads a pdf using WKWebView. I need to open this downloaded pdf to allow user fill it.

I have the problem that pdfs are receipts or delivery notes with fields that are calculated automatically with JavaScript code. I tried with PDFView but calculated fields don't work. I also tried WKWebView but I couldn't complete the pdf form. Opening the pdf with Adobe Reader DC application it works correctly but I need to return the completed pdf to my app to upload it to a web service.

What can I do? There are a solution?

What is the correct way to programmatically open a form pdf from my iPad application?

Thanks!


P.S.: Sorry if it's badly written, I'm Spanish and I know little English. I used a translator.

Accepted Reply

Is there any kind of shared folder in IOS where all applications can access?

Not as such. However, iOS has a full-featured document architecture that lets you share your documents with other apps and vice versa. This document model has been repeatedly extended over the last N releases, so I’m not sufficiently up to speed on it that I can explain it here (my focus is mainly on low-level stuff). A good place to start would be WWDC 2018 Session 216 Managing Documents In Your iOS Apps.

IMPORTANT This will only work if the other app is integrated with the document architecture. I don’t use Adobe Reader so I can’t say whether that’s the case.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Replies

I tried with

PDFView
but calculated fields don't work.

That’s a shame. If anything were to work, that’d be it.

Have you tried this on the latest iOS 12 beta? iOS 12 has a bunch of

PDFView
fixes, including ones related to form fields.

If that doesn’t help then my recommendations are:

  • Please file an enhancement request against

    PDFView
    . Make sure to include a sample PDF and an explanation of what you expected to work. Also post your bug number here, just for the record
  • Working around this limitation while sticking with

    PDFView
    is likely to be quite tricky. Instead I recommend that you investigate third-party PDF UI libraries to see if you can find one with the features you need.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Thanks for your answer. I tried my app on IOS 12 beta with Xcode 10 beta. Pdf doesn't work correctly on PDFView. I can fill it, but date pickers and calculated fields doesn't work.

On one hand tried to open this pdf on Acrobat Reader DC movile app using UIApplication.shared.open(URL(string: "com.adobe.Adobe-Reader://(filePdfPath)")). In this way Adobe Reader opens but doesn't show the pdf file.

On the other hand I tried to open the pdf file using DocController. In this way pdf works perfect but I'm not be able to return the completed pdf to my application to send it to web service. DocController copy PDF to Adobe Reader app documents and due to sandbox I can't access to it from my application.

Now I will try your recommentadtions:

  • Please file an enhancement request against
    PDFView
    . Make sure to include a sample PDF and an explanation of what you expected to work. Also post your bug number here, just for the record
  • Working around this limitation while sticking with
    PDFView
    is likely to be quite tricky. Instead I recommend that you investigate third-party PDF UI libraries to see if you can find one with the features you need.

I hope some works, please. I new with ios applications and I going crazy.

Thanks!

I new with ios applications and I going crazy.

Yeah, you have managed to choose a particularly tricky place to start. Apple platforms deal with PDF reasonably well, but PDFs with calculated form fields are quite an obscure edge case )-:

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Is there any kind of shared folder in IOS where all applications can access? I could save in this users downloaded pdfs, having only one pdf that is accessed from my application and the Adobe Reader app, so that users could modify it on Reader and send it to web service from my app.

Thanks!

Is there any kind of shared folder in IOS where all applications can access?

Not as such. However, iOS has a full-featured document architecture that lets you share your documents with other apps and vice versa. This document model has been repeatedly extended over the last N releases, so I’m not sufficiently up to speed on it that I can explain it here (my focus is mainly on low-level stuff). A good place to start would be WWDC 2018 Session 216 Managing Documents In Your iOS Apps.

IMPORTANT This will only work if the other app is integrated with the document architecture. I don’t use Adobe Reader so I can’t say whether that’s the case.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Thanks for your answer, Finally, I could open file with Adobe Reader from my app sharing it with CFURLStopAccessingSecurrityScopedResource. Now, I am looking for the correct way to automatically upload pdf to web service when user returns to my application after completing the pdf in Adobe Reader.

Thanks a lot for your help. It was so useful.

Could you please explain how `CFURLStopAccessingSecurrityScopedResource` is used?