> On Aug 15, 2015, at 4:57 PM, Shizam <[email protected]> wrote: > > My approach thus far has been to access the image data as raw bytes using > Attachment.content and render it on a UIWebView as a base64 encoded image and > then get the UIWebView object to export the HTML data as a PDF (all in > memory).
That seems like a roundabout way of doing it! CoreGraphics has a whole API for reading and writing PDFs — take a look at CGPDFContext. I’ve only used this for reading PDF files, but it looks like it goes the other way too, allowing you to generate PDFs. > So my question is if there is a way to access an attachment in couchbase > lite as a direct URL (like file:/// <file:///>....) so that one can > circumvent the entire base64 conversion and rendering stages. Hopefully you won’t need this :) but yes — use CBLDatabase.internalURL to get the root URL of the database in the REST API, then append path components for the docID and the attachment name. The resulting URL can be used inside the app (including in a UIWebView) to read the attachment. —Jens -- You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/24E21885-3CD2-4F97-9942-60E0BB58C114%40mooseyard.com. For more options, visit https://groups.google.com/d/optout.
