I am trying to get a runtime binary string loaded to new tab as pdf. I am able to have it downloaded,but is there a way to have it previewed before downloading?
I have an equivalent in php which does this:
\PDF::loadView(template,[data]) returns as object which gives me a pdf stream property.
You’ll need to set headers so the browser knows it’s a pdf and to show it inline… eg:
show in browser:
Content-Disposition: inline; filename="filename.pdf"
Content-Disposition: attachment; filename="filename.pdf"
alternatively for full control, you can use pdf.js - maybe combine/inline with a liveview etc https://mozilla.github.io/pdf.js/examples/index.html#interactive-examples