Reputation: 768
I have stored user uploaded document (.doc ,.pdf) as a Blob object into data-store. Instead of allowing user to download the document, I would like to present it as an HTML page for viewing the doc. how do I convert Blob into HTML ? does google app engine provides any ready made API for the same?
Upvotes: 0
Views: 115
Reputation: 41089
Most browsers already have a built-in PDF viewer. If you provide a link to a PDF file, when users click on it, many browsers will automatically display the document. Those browsers that do not support this option, will offer a user to download the file to their hard-drive.
This is the easiest solution - you don't have to do anything at all.
Upvotes: 0
Reputation: 4178
There is no ready made API in AppEngine to convert .doc or .pdf (or or other types of) files to HTML. You would need to find a library for your preferred language to parse the blob file into its parts structured as an object model (like a DOM). Then you would need to write code to convert individual parts of the object model to HTML, unless you are lucky enough to find another library. And no, StackOverflow is not a good place to ask "what library is there...".
Upvotes: 2
Reputation: 3192
No. AppEngine itself does not provide any file format conversion tools. You might want to look into Google Drive API, which might, to some extent, do the format conversion for you.
Upvotes: 1