There is any chance to Send PDF file directly to printer without print preview?? I want to grab a pdf file from a folder in my project and send it directly to the printer how can I do it in JS or VB.NET????
Tried that one: Silent print a embedded PDF Didn't work!
Here what I have tried:
<div class="reportFieldsDiv" runat="server" clientidmode="Static">
<table style="width: 400px; margin: 10px 0px 0px 10px; border: 1px solid black">
<tr>
<td>
<img src="~/Images/Layout/TestBadge.jpg" alt="ID Badge" id="mainImage" align="middle"/>
</td>
</tr>
</table>
<div style="border: 0px solid black;padding:5px 0px 0px 280px">
<asp:Button ID="Button1" runat="server" Text="Print" Width="140px" OnClientClick="printDocument(pdfDocument)" />
<embed
type="application/pdf"
src="~/UserGuide/temp.pdf"
id="pdfDocument"
width="100%"
height="100%">
</embed>
</div>
</div>
JS:
function printDocument(documentId) {
var doc = document.getElementById(documentId);
//Wait until PDF is ready to print
if (typeof doc.print === 'undefined') {
setTimeout(function () { printDocument(documentId); }, 1000);
} else {
doc.print();
}
}