Perhaps I'm misunderstanding something, but isn't CBLAttachment's 
contentURL designed to give you the URL to the file attachment?

Brendan

On Saturday, August 15, 2015 at 7:02:51 PM UTC-6, Jens Alfke wrote:
>
>
> On Aug 15, 2015, at 4:57 PM, Shizam <[email protected] 
> <javascript:>> 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:///....)  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/16a2f3dd-c88b-411c-a26e-7eeca0b66522%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to