Save iframe content in .xps / .pdf format without user interaction


I would like to know whether it is possible to save iframe content as .xps/.pdf format without the user interaction or not.

Currently, my coding is able to skip print dialog box and select default printer. However, it couldn't bypass the Save As dialog box.

Do anyone has some advice to solve this issue?

Browser: IE 9 (Don't support HTML 5)

Javascript :

function PrintDoc()
    var TestPrint = null;
    TestPrint = this.document.frames['iframecontent'];
    if(TestPrint) //verify the content isn't empty or null

VBScript :

Sub bypassprint()
    call WB.ExecWB(6, 2) //bypass printer dialog box
    call Wb.Dispose()
End Sub


<input type="submit" name="Submit" value="Print" onclick="javascript:PrintDoc();" id="btnSubmit" class="Btn" />

Assume that I have an iframe tag with id ="iframecontent" and I wish to print the iframe content as .xps/.pdf format without the user interaction.

The above code is able to bypass the printer dialog box but not the Save As dialog box.

Any advice given would be appreciated :)

Server-side solution: First: get the HTML, then pass it to a component that can create a pdf from it and voila ;-)

Client-side solution: this is a bit harder, the browser does not allow you to generate a pdf without user interaction. BUT: you can send the html document to an API (you create it) which in return send a url where you can download the generated pdf. The do and the user downloads the pdf without further dialogs.

For creating a pdf from html see the server-side solution ;-)