Reputation: 4688
I want to store pdf files client side in one of the HTML5 storages (indexedDB or localstorage) and then open them later with the adobe reader.
The scenario is as follows:
Is this possible with pure html5/js or do i have to write a firefox extension?
Upvotes: 3
Views: 1817
Reputation: 4053
Create links with PDF type and base64 encoded data (representing the PDF binary)
<a href="data:[<mime type>][;charset=<charset>][;base64],<encoded data>">PDF name</a>
The base64 encoded content can be stored in HTML5 storage.
Warning: does not work for IE (excuses for security reasons).
Upvotes: 1
Reputation: 26895
You can use the data URI scheme (http://en.wikipedia.org/wiki/Data_URI_scheme).
Something like this, but with a PDF:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAKBJREFUeNpiYBjpgBFd4P///wJAaj0QO9DEQiAg5ID9tLIcmwMYsDgABhqoaTHMUHRxpsGYBv5TGqTIZsDkYWLo6gc8BEYdMOqAUQeMOoAqDgAWcgZAfB9EU63SIAGALH8PZb+H8v+jVz64KiOK6wIg+ADEArj4hOoCajiAqMpqtDIadcCoA0YdQIoDDtCqQ4KtBY3NAYG0csQowAYAAgwAgSqbls5coPEAAAAASUVORK5CYII=
You can see this example at its original page: http://iconhandbook.co.uk/reference/examples/data/
Upvotes: 1