It uses a combination of UIApplication's openURL method to trigger Texpad, and UIPasteboard to transfer the data.
Basically you create a request object and add one or more LaTeX files (plus images, BibTeX files, and anything else that's necessary), and then pass that to the API. It puts the data in a named pasteboard, and uses openURL to invoke Texpad.
iOS then switches across to Texpad, which takes the data you gave it and produces a PDF file. Texpad sends the PDF file back to your own application (via a return URL you provided it with), and you receive the file via UIApplicationDelegate's handleOpenURL method.
I've been working with the developers of Texpad to get this integration working with my own app (UX Write), and found that it's a very smooth process.
The only downsides are that the user sees their device switch from your app to Texpad and back (which may be a bit confusing if they don't know what's going on), and since iOS can potentially kill background apps at any time, you have to save any necessary state so that if you are terminated, you can restore that state and pick up where you left off once you're re-activated with the received PDF file. But this is relatively easy to solve, and given the lack of (custom) shared libraries on iOS I think overall it works pretty well.
3 comments
[ 2.8 ms ] story [ 18.9 ms ] threadBasically you create a request object and add one or more LaTeX files (plus images, BibTeX files, and anything else that's necessary), and then pass that to the API. It puts the data in a named pasteboard, and uses openURL to invoke Texpad.
iOS then switches across to Texpad, which takes the data you gave it and produces a PDF file. Texpad sends the PDF file back to your own application (via a return URL you provided it with), and you receive the file via UIApplicationDelegate's handleOpenURL method.
I've been working with the developers of Texpad to get this integration working with my own app (UX Write), and found that it's a very smooth process.
The only downsides are that the user sees their device switch from your app to Texpad and back (which may be a bit confusing if they don't know what's going on), and since iOS can potentially kill background apps at any time, you have to save any necessary state so that if you are terminated, you can restore that state and pick up where you left off once you're re-activated with the received PDF file. But this is relatively easy to solve, and given the lack of (custom) shared libraries on iOS I think overall it works pretty well.