请问高手有什么办法直接将PDF文件输出到打印机,当然我得自定义纸张
用printDocument能不能做?
图片是能用printed事件设置Graphi,不知道PDF怎么弄,
我用PDF带的控件使用axAcroPDF1.print()没用反应
用axAcroPDF1.printAll()就弹出有对话框,都不是我想要的,请大家帮帮我

解决方案 »

  1.   

    没有打印过pdf文件,等待+学习
      

  2.   

      try  
      {  
      ProcessStartInfo   startInfo   =   new   ProcessStartInfo()   ;  
      startInfo.UseShellExecute   =   true;  
      startInfo.Verb   =   "Print";  
      startInfo.CreateNoWindow   =   true;  
      startInfo.WindowStyle   =   ProcessWindowStyle.Minimized;  
      startInfo.FileName   =   filename;  
      processInstance.StartInfo   =startInfo;  
      processInstance.Start();  
      }  
      catch   (Win32Exception   ex)  
      {  
      if   (ex.NativeErrorCode   ==   ERROR_FILE_NOT_FOUND   )  
      {  
      throw   new   Exception("File   not   found   in   your   personal   folder.")   ;  
      }  
      if   (ex.NativeErrorCode   ==   ERROR_ACCESS_DENIED   )  
      {  
      throw   new   Exception("You   do   not   have   permission   to   print   this   file.");  
      }  
      }
      

  3.   

    楼上的代码看不懂,我出PDF都是用iTextSharp的,还算可以
      

  4.   

    6楼的兄弟是调用进程打印,能不能一个文件打多份的,这个打印格式能调么?
    7楼的朋友能说详细点iTextSharp怎么用么
    谢谢各位了
      

  5.   

    安装个虚拟打印机:比如SmartPrint等,这样你打印的东西就直接可以保存成PDF了
      

  6.   


    修改下,虚拟打印机叫SmartPrinter,你可以去下载
    另外也还有其它的
      

  7.   

    失踪的月亮 : 我用了你这个方法,不过好象弹出对话框来要我报错mdi文件,我不想要有对话框
      

  8.   

    我现在已经有很多PDF文件了,想要批量打印,不用调对话框
      

  9.   

    还是用水晶报表,只不过最后把它导成PDF格式
      

  10.   

    给你一个solution:   
      用Process处理对pdf文件的打印。   
      你在程序里直接调用执行就可以了。   
      using   System.Drawing.Printing;   
      using   System.Management;   
      ...   
        
      public   static   void   PrintDoc(string   filename)   
      {   
      //检测当前打印的文档数,当超过2个时,就开始等待   
      PrintDocument   pd   =   new   PrintDocument()   ;   
      StringCollection   sc   =   GetPrintJobsCollection(pd.PrinterSettings.PrinterName);   
      while(sc.Count   >   2)   
      {   
      Thread.Sleep(1000)   ;   
      sc   =   GetPrintJobsCollection(pd.PrinterSettings.PrinterName);   
      }   
      try   
      {   
      ProcessStartInfo   startInfo   =   new   ProcessStartInfo()   ;   
      startInfo.UseShellExecute   =   true;   
      startInfo.Verb   =   "Print";   
      startInfo.CreateNoWindow   =   true;   
      startInfo.WindowStyle   =   ProcessWindowStyle.Minimized;   
      startInfo.FileName   =   filename;   
      processInstance.StartInfo   =startInfo;   
      processInstance.Start();   
      }   
      catch   (Win32Exception   ex)   
      {   
      if   (ex.NativeErrorCode   ==   ERROR_FILE_NOT_FOUND   )   
      {   
      throw   new   Exception("File   not   found   in   your   personal   folder.")   ;   
      }   
      if   (ex.NativeErrorCode   ==   ERROR_ACCESS_DENIED   )   
      {   
      throw   new   Exception("You   do   not   have   permission   to   print   this   file.");   
      }   
      }   
      }
      

  11.   

    楼上的兄弟能把你那个GetPrintJobsCollection()的方法提供下么,谢谢了
    还有ERROR_FILE_NOT_FOUND,ERROR_ACCESS_DENIED是什么东西?
    我用进程打试了,可以打
    但是有个问题不知道是什么原因,就是在电脑刚开机的时候打印,打印机闪了一下,但是不打印,也没队列,
    然后打开PDF,用它选择打印机来打印一张,然后再用进程打印就可以了,这个是什么原因,真的郁闷啊!
    你们有没有碰到这样的问题