3 rules
3 rules

Reputation: 1409

javascript: Send base64string direct to print without preview

I am using ASP.Net MVC with jquery and javascript.

I am getting base64string as per my code in ajax success everything is running fine but I want to pass that base64string directly to print without preview.

I am opening the pdf like this and want to send data.bytedata direct to print without preview using window.open. But when I use window.open it render me the current whole web page from where my operation is running.

window.open("data:application/pdf;base64, " + data.bytedata);

I have read so many articles with pdf.js as well but I am confuse with pdf.js that it will work with chrome or not and direct print is possible using that?

Upvotes: 3

Views: 2586

Answers (1)

Mahavirsinh Padhiyar
Mahavirsinh Padhiyar

Reputation: 1179

You can try to open it inside iframe with using window.open if it doesn't open directly.

window.open("<iframe src='data:application/pdf;base64, " + encodeURI(data.bytedata) + "'></iframe>")

You can read whole article here

Upvotes: 1

Related Questions