Sarathy
Sarathy

Reputation: 452

Directly Print PDF in client side without viewing it

I have PDF file in server, when user clicks print button on my asp.net page I need to show print dialogue directly without showing the PDF. How can I achieve this? Please guide me.

Upvotes: 2

Views: 5616

Answers (1)

Eric
Eric

Reputation: 401

This only works in IE, but you can embed the Adobe ActiveX control into an HTML page as follows:

<object classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" style="height:75%; width: 100%; display: none;" id="viewer" name="viewer" VIEWASTEXT>
    <param name="src" value="document.pdf">
</object>

Then in the onclick of the print button you can do this:

viewer.printWithDialog();

Might be able to tweak this for other browsers.

Upvotes: 2

Related Questions