Open a PDF file in an external app on iPad - cocoa-touch

I'd like to make my app to open a specified PDF by an external app of the user's choice on the iPad. How can I do that? Or, is there any open-source PDF reader framework available so that I can put it into my app?
My situation in more detail:
I'm thinking of porting to the iPad from OS X / rewriting from scratch for the iPad an app which manages lots of PDFs (journal articles, etc.), but I don't want to write the PDF reader part, because there are many good ones already out there; I don't want to reinvent the wheels.
(You might say you shouldn't reinvent pdf management apps, but I'd like to make one as a front end to SPIRES, and there isn't one so far.)
As the app would be a front end to a serious reading activity, UIWebView's pdf capability is not enough.
Also, users of my app would have various preferences which app to use.
That's the background behind my question. Thanks in advance!

Here's my self-answer:
Use UIDocumentInteractionController. See this Apple doc.
The problem now is to find a way to choose programmatically exactly with which app you open a document, when multiple apps are available to a same file type.

Its not that hard to view PDFs without a UIWebView. You use some Quarts 2D drawing but a large majority of the work is done for you. You mainly have to choose how you will flip pages, and do pinch to zoom.
Quarts 2D PDF reference

You aren't able to search inside of PDF files. You can't access the text. You could do annotation, but it would be a hack at best.

Related

Is there any way to create and display music notation inside of a codenameone app?

Is there any way to create and display music notation inside of a codenameone app?
For Java generally there are some libraries like for example JFugue that let you write music inside a program. Maybe also display it, i didn't try that out.
There is lilypond, which would work in a desktop environment if you were able to run it to make the pdf after generating the file itself.
I wrote a small app in Android Studio and had to write my own music notation logic and drew it with the help of png files on a Canvas. That worked okay for small musical examples of a clef and around 2-7 notes.
Now i want to do something similar in Codenameone and display at least a clef and some notes inside the app (maybe as an image) - they have to be generated with some random element while the program runs.
It would also be great to be able to write and show more than a few notes, displaying it somehow and maybe also with the ability to have it as a pdf file later.
Is it possible to use something that already exists?
Thanks a lot!

Viewing XPS file inside WebView or RichEditBox for Windows Store

Long time reader, first time poster :)
I'm developing an Windows Store app and I'm trying to load a formatted page into an in-app viewer. As Windows 8.0 does not support PDF natively, I'm trying to load the XPS format instead.
I've tried loading the XPS Uri directly into WebView using the code below, but the result is just a blank page:
ResultsWebView.Navigate(xpsFile);
Is there a way to view XPS file within Windows Store apps?
If not, can anyone think of a way to view formatted documents in app? My next option is probably to find an API to convert the PDF into a PNG image, and load the image directly. I'm trying to avoid using non-native APIs as my app needs to be cross-platform, so the tricky part with APIs is that I need to make sure whatever I use is compatible with both Windows RT and Windows 8.
PDF support was added in Windows 8.1 (in essence).
I researched extensively and could not find a suitable solution that was easy to implement, so I resorted to creating a new module that reads my inputs, generate an html stream, and use that stream to display on WebView.
In the end it was a couple of days' work to format it properly to match the PDF, but not hard at all to implement. I've already spent a lot of time researching an "easy" way out by reading PDF/XPS directly to no avail anyway.

Changing OS file icons using AIR app

I am building an AIR app which will be kind of like Dropbox. It will allow users to sync their files between various OSs. What I would like to know is that how can i change the default file system's file icons (add an overlay for eg) for states like - Synced and Syncing, the way Dropbox does it ??
On Windows i found out that Dropbox edits the registry files to insert the overlay icons..not yet sure how they do it in MAC OS X though.
I saw some threads here asking similar questions about AIR, but none referencing how to change file's icons. Hoping to get a solution for this from the various experts .. Please suggest any ideas if you know how it can be accomplished. Much thanks.
A simple yet effective solution would be to use icons that are only internal to your application : just embed in your application files some transparent pictures representing the various states of your files (with only the small part telling in which state it is, with the rest totally transparent), that you will add at runtime above the displayed icons.
Since you can get the actual icon of your files, just draw them into a BitmapData (if needed) & add an overlay with theses custom images, using the one related to your file's state in your application.
And one step further could be to store in your AIR application folder any resulting icons for future use (check what types of files you already have, and if your new file type isn't in thoses, export the various icons with your custom overlays to PNG files directly on the user device, for re-loading them the next time the application is opened).

QLPreviewController vs UIWebView -- Pros / Cons

Does anyone have experience with pros and cons of using QLPreviewController vs UIWebView to open pdf and office document? And benchmark data ?
Thanks!
The QLPreviewController can open and display various documents such as office documents, pdf, images, movie files, text documents, etc. It also offers built in air print functionality. When opening movie files all the standard controls are there such as air play etc. It also supports multiple document previews via the QLPreviewControllerDelegate. You get all this for "free" and have to write very little code to get it.
A UIWebView can do much of this, but you will have to write more code to handle it. It will take more work to render images "properly", and you will have to handle movies and audio on your own in some cases. There can also be issues detecting the appropriate text encoding when viewing plain text files.
The QLPreviewController is a much better "all in one" solution. There are other classes available as well if you need even more control then what the QLPreviewController will give you.

Looking for the better way to make a kind of PDF reader w/ iOS 3+

I'm trying to make an iPhone application which can read PDFs in full screen and follow links on PDFs, but I can't find the right way to do it.
First, I tried to use an UIWebView to read the PDF file, but it doesn't work exactly as I wanted (I was not able to fix the link problem).
The second solution was to use the Quartz API to read the PDF. I took a look at http://developer.apple.com/iphone/library/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_pdf/dq_pdf.html, but i'm only able to print one page on the screen, and there is no way to jump to next pages.
Can someone help me ? I'm running out ideas :)
Thanks for your help
Quartz does not know how to change pages, click on links, etc. It only "draws" the PDF page you want - you will have to do all gestures by yourself (or use UIScrollView and such).
BTW, I guess your question is duplicated. Take a look at: Fast and Lean PDF Viewer for iPhone / iPad / iOs - tips and hints?