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:
- The user visites my site and downloads a bunch of pdf's into a storage
- Later the user revisits the site and wants to view one of the pre downloaded pdf's.
He chooses one of the stored pdf's and it gets rendered with the adobe reader (or the
default pdf renderer).
Is this possible with pure html5/js or do i have to write a firefox extension?
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/
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).