PDA

View Full Version : How to open PDF content automatically



theWallflower
6 Mar 2014, 6:52 AM
I have a requirement to open a generated PDF after the user selects some data and clicks on a link. The PDF content comes from the response. It works fine in Chrome, but in Firefox, it doesn't do anything. In Firebug, it has the error "not well-formed", pointing to some random character in the base64 string content. Is there a way to make this work in Firefox and Chrome?


var content = response.responseText;
var link = document.createElement('a');
link.download = "Name-On-Card.pdf";
link.href = "data:application/octet-stream;base64," + content;
link.click();
return true;

theWallflower
12 Mar 2014, 6:09 AM
Bump

theWallflower
9 Jul 2014, 10:03 AM
It appears that this may be related to a new version of Chrome that came out at the time I encountered this problem. Is there a workaround?

jorgegaray
11 Feb 2016, 10:58 AM
what is you code for display pdf ?