How to execute javaScript with Quartz (CGPDF) iPhone SDK - iphone

I would like to know that is it possible to run the JavaScript with Quartz.
I have to create an application to open the password protected PDF. I also have user name and password for that PDF and when user want to open the PDF I send the username and password to server. All the validation will be happend on server then server returning me the JavaScript code in response, I have to run the same JavaScript code in my App to unlock the PDF. Is there any way to run the javaScript in my App So that I will be able to open the Password Protected PDF.
I have tried to open the same PDF in all Standered iPad PDF App like(GoodReader, PDF Reader and so on) but they are also failed to unlock the PDF.
When I open the Same PDF in Adobe Reader in my MAC machine it open successfully.
Thanks

There's currently (as of iOS4/5) no way to use Javascript inside a PDF. You can use javascript in a web view, and do your server checks there, then unlocking the pdf, but that's of course not as secure as doing it all in the pdf. Some crazy people even included a custom build of the JavaScriptCore, as the Apple Framework is not directly accessible in iOS.

Related

PWA - file download works on android, not working on IOS

I have PWA application to create pdf report. When i click Generate raport on android all works fine, file is download, when i click Generate report, app redirect me to url to download pdf, for example my pdf url is http://generatemypdf.com/pdf?generate=true on android app download my report, on IOS, i be redirected to http://generatemypdf.com/pdf?generate=true in browser.
When i click Generate report then my app send post data to generate pdf.
My code to get file
handleSubmit(event) {
event.preventDefault();
let form = store.get("form");
window.open("http://generatemypdf.com/pdf?" + qs.stringify(form));
}
Where is bug?
The problem is that Safari is blocking any call to window.open() which is made inside an async call.
Answer how to bypass that you can find here

pdf download not working on Android with cordova inappbrowser

In my cordova inappbrowser app, pdfs can be downloaded by calling a RESTful service that streams the content to the user's browser (see html snippet below). This works fine on iOS and using Google Chrome directly on Android but not when doing it through cordova inappbrowser. Clicking on the link doesn't do anything. I've tried many of the suggestions here including using gview but no result.
The tag in html is an href (I tried using window.open as well) that evaluates to something like https://xxx/member/get_pdf/217521359ashr868af6as. Using target='_blank' (tried _system also)
where the value after get_pdf is a guid (value above is not the real guid)
The google viewer workoaround that many people propose works fine with a physical pdfs but my files are streamed back from the service above and gview doesn't recognize it as a pdf and shows error 'preview not available' and its not an option to store them physically. Is there some specific header to set to make gview recognize the streamed response as a pdf? I set content_type, Content-length, tried adding Content-disposition with a filename also. No go.
Any suggestions appreciated.
Thanks,
Patrick

Aviary client side implementation vs needing a server side component

I'm planning on building an online image editor. I want to use aviary library for it. https://developers.aviary.com
Can someone explain me how I implement it? More specifically, do I need to send an image to their server in order to modify it? or I just do all the modifications on client side and then save that image to the server?
The editor works by loading the image client-side via a public url, allowing the user to edit the photo in the browser. When the user saves, the image is POSTed to Aviary's server, where it's uploaded to a temporary storage location. You then get a url to that temporary image passed to you in the onSave callback, which you can use to save the image back to your own server.
See a full client-side integration here: https://developers.aviary.com/docs/web/example

Phone gap ios app - show pdf file with print/email options

I have a requirement to do the following task.
Inside a Phonegap iOS app, the user wants to view a pdf file after clicking a link which will load the pdf from the remote server.
And also user needs print, email functions with this document viewer.
So far I have tried following options.
Exit from the app when user click on the link and try to load the pdf throught the Safari. This is not working because user has to relogin for viewing the application.
Check with child-browser plugin. But it does not provide the options like print/email.
It'll be really great if some one can help on this who has similar experience.
Thanks

Prefill web form with data stored in app

With the iPhone UiWebView is it possible to prefill an html form with username and other
account details that are stored in the app's data folder. Using iOS 5.1 sdk
So I would need to read the file with the customers's information stored and then prefill the web form from the UIWebView. I need to know if this can be done and if so any tutorials how to do it would be useful.
Thanks
You could read the data from your app's bundle then run a JavaScript function that takes the data as parameters and uses it to pre-populate the form.
You can execute the Javascript in your UIWebView by using the method
stringByEvaluatingJavaScriptFromString:
I'm not a JavaScript expert so I don't want to comment on the best way to write the JavaScript function to pre-populate the form but I know its possible.