Click here to Skip to main content
15,899,754 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Guys


I want to print pdf file silently with specific printer without using adobe reader exe. how can i achieve this.

Please help me its urgent.
Posted

Use the IFRAME and assign your Generated PDF to That.

<iframe id="printf" name="printf" src="http://localhost:4685/PrintImages/44.PDF"></iframe>

then write a function to print pdf.
C#
<script>
function printIframe()
{
    if (navigator.userAgent.indexOf("Firefox")!=-1){
        var iframe_window = window.frames["my_iframe"];
        window.frames["my_iframe"].document.write('<body></body>');
        iframe_window.print();
    }
    else if(navigator.userAgent.indexOf("MSIE")!=-1){
        var x = document.getElementById("pdfDocument");
        x.print();
    }
    else if(navigator.userAgent.indexOf("Chrome")!=-1){
        document.my_iframe.focus();
        document.my_iframe.print();
    }
    else{
          
    }

}



add a button and assign this function onclick..
<input type="button" id="pdf" value="Print" onclick="printIframe();">


Hope it may help you.............
 
Share this answer
 
Use Foxit Reader[^]:
C#
Process pdfProcess = new Process();
pdfProcess.StartInfo.FileName = "FoxitReaderExePath"; //C:\Program Files\Foxit Software\Foxit Reader\Foxit Reader.exe
pdfProcess.StartInfo.Arguments = string.Format(@"-p {0}", fileNameToSave);
pdfProcess.Start();


Hope it helps!
--Amy
 
Share this answer
 
Comments
CB Sharma 31-Jul-14 10:25am    
Thanks to all

I need to print pdf file silently to printer in window form application.

Please help me its very urgent.
Hello Sharma,

This One May Help you ....
http://www.codeproject.com/Tips/598424/How-to-Silently-Print-PDFs-using-Adobe-Reader-and
 
Share this answer
 
Comments
CB Sharma 28-Jul-14 3:17am    
Thanks for your reply but i want to print pdf without Adobe-Reader

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900