直接打印pdf文件而无需打开adobe reader [英] printing a pdf file Directly without opening adobe reader

查看:431
本文介绍了直接打印pdf文件而无需打开adobe reader的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我已经编写了一个代码来直接打印PDF文档。在此期间,ADOBE正在开放。任何人都可以告诉我如何在不打开adobe的情况下打印PDF。我发现了一些文章但没有为我工作......这是我的代码



Hi All,

I have written a code to print the PDF document Directly. During this ADOBE is opening. Can any one tell me how to print the PDF without opening adobe.I found some articles but not worked for me...Here is my code

private void SendToDirectPrint(string filename)
        {
            ProcessStartInfo info = new ProcessStartInfo();
            info.Verb = "print";
            info.FileName = filename;
            info.CreateNoWindow = true;

            info.WindowStyle = ProcessWindowStyle.Hidden;

            Process p = new Process();
            p.StartInfo = info;
            p.Start();

            if (p.HasExited == false)
            {
                p.WaitForExit(10000);
            }

            p.WaitForInputIdle();
            if (false == p.CloseMainWindow())
                p.Kill();
        }

推荐答案

这应该有效:

使用C#.NET中的iTextSharp创建/阅读高级PDF报告:第一部分 [ ^ ]


您可以将此代码用于aspx

You can use this code for aspx
----------------------------------------------------------------------------------

 <script type="text/javascript" language="javascript">

        function fnPrint() {
            var a = window.open('', '', 'left =' + screen.width - 100 + ',top=' + screen.height - 10 + ',width=0,height=0,toolbar=0,scrollbars=0,status=0');
            a.document.write(document.getElementById('receipt').innerHTML);
            a.document.close();
            a.focus();
            //call print
            a.print();
            a.close();

        }
      
    </script>


对于Extjs:



For Extjs :

-----------------------------------------------------------------------------------
   text: '' + printReceipt_lbl + '',
                 handler: function () {
                     var txthidenAmountToPay = Ext.getCmp('txtAmountToPay').getValue();
                     var Credit = Ext.getCmp('txtCredit').getValue();
                     var OsAmount = Ext.getCmp('txtOsAmount').getValue();
                     var RecNo = TrimString(Ext.getCmp('txtRecNo').getValue());
                     window.open('../Certificates/BillReceipt.aspx?BillNo=' + RecNo + '&AmountToPay=' + txthidenAmountToPay +
                 '&Credit=' + Credit + '&OsAmount=' + OsAmount, 'name', 'height=800,width=700,scrollbars=1');

                 }


这篇关于直接打印pdf文件而无需打开adobe reader的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆