« Control printing in F… | Home | PDF Viewer control fo… »

Adding QuickLook preview for iOS to Xojo

For 23.3 plugins, we add QLPreviewControllerMBS class for iOS projects in Xojo to preview various file types full screen. If your iOS app needs to show some downloaded file or a PDF file received/generated, you can just preview it.

Since we can enable markup features, you can even annotate and edit PDF documents. The user would get the usual tools and then can save the new PDF to a temporary file. Your application receives an event and then you can save it to where you need it, e.g. into a database.

A QLPreviewController can display previews for many common file types, including the following:

  • iWork documents
  • Microsoft Office documents
  • Rich text format, or RTF, documents
  • PDF files
  • Images
  • Text files with a uniform type identifier that conforms to the public.text type. To learn more, see Uniform type identifiers.
  • Comma-separated values, or CSV, files
  • 3D models in the USDZ format with both standalone and AR views for viewing the model

If you like to use this, please add a property to the screen to hold the panel reference. e.g. "panel as QLPreviewControllerMBS".

Then in the code to show a PDF file, just call a bit code like this:

panel = New QLPreviewControllerMBS
panel.AddItem PDFFile
panel.Present

And it shows the panel full screen. You can add multiple files if needed and use a subclass of QLPreviewControllerMBS to implement events to allow editing or get notified for dismissal of the panel.

Please try with next prerelease and let us know if you have questions.


12 06 23 - 15:51