How to display a javascript File object in Chrome's PDF viewer with its name? -
i've got pdf file in form of blob object (generated jspdf), want display in <iframe>
element.
i can way:
iframe.src = url.createobjecturl( blob )
the pdf rendered correctly esoteric string in place of name (see image below of chrome's pdf viewer).
so tried convert blob file object in order give human-readable name.
var file = new file( [blob], 'a_name.pdf', { type: 'application/pdf' } ) iframe.src = url.createobjecturl( file )
it works firefox: name kept when saving file header's pdf viewer. unfortunately dropped in chrome , replaced random file name before being loaded in pdf viewer.
do know if possible display pdf file object in <iframe>
file name?
you can set title of pdf generated jspdf setproperties
method:
var doc = new jspdf(); doc.setproperties({ title: "this title" }); ...
that title displayed in pdf viewer in chrome. can test in live demo page.
Comments
Post a Comment