How best to implement automatic printing of a PDF in ie8?

Dear, please tell - you must implement the following case:
The user clicks on the Print button
Run the loader block with the form
Starts the request to the REST service with custom headers (important), the service returns a PDF
Starts automatically print the resulting PDF
Closes the loader
This should work in ie8

Now similar implemented using activeX pdf.ocx from Adobe Acrobat, but it is very primitive, does not contain a callback on the load rest (there is no way to gracefully close the loader), you cannot add custom headers

...
const print= '<object classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" ' + 'id="' + uid + '" width="0" height="0">'
 + '<param name="src" value="' + url + '">'
 + '</object>';
document.body.insertAdjacentHTML('beforeEnd', print);
const doc = document.getElementById(uid);
doc.contentDocument.printAll();


Are there any good solutions how to do it? This, again, should work in ie8 and ie11 in ie8 mode...
July 8th 19 at 11:25

Find more questions by tags Internet ExplorerJavaScriptPDF