各位高手:
  我從網頁取得數據流,如何連接打印機并打印出來

解决方案 »

  1.   

    WEB打印
    <OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height=0 id=wb name=wb width=0></OBJECT>
    <script language="javascript"> 
    <!--
    // 打印页面设置 
      function printsetup(){ 
       wb.execwb(8,1); 
      }  // 打印页面预览 
      function printpreview(){ 
       wb.execwb(7,1);      
      } 

    //打印
      function printit() 
      { 
       if (confirm('确定打印吗?')) { 
    wb.execwb(6,6);
       } 
      } 
    -->
    </script> <style> 
    @media print { 
       .ipt {display:none} 

    </style> 要隐藏的内容设置样式为: class="ipt"
      

  2.   

    我是在應用程序里打印,不是在web中.
      

  3.   

    参考http://www.yesky.com/SoftChannel/72342371961929728/20030919/1730057_1.shtml
      

  4.   

    樓上的兄弟:
    請問,PDF通過網頁瀏覽,要用什么格式打印。
      

  5.   

    URL url=new URL(str_url);
          URLConnection urlconn=url.openConnection();
          InputStream inStream=urlconn.getInputStream();
          PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
          DocFlavor flavor=DocFlavor.INPUT_STREAM.AUTOSENSE;
          PrintService printService[] = PrintServiceLookup.lookupPrintServices(flavor, pras);
          PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService();
          PrintService service = ServiceUI.printDialog(null, 200, 200, printService, defaultService, flavor, pras);
          if (defaultService != null)
          {
           try 
           {
              DocPrintJob job = defaultService.createPrintJob(); 
              DocAttributeSet das = new HashDocAttributeSet();
              Doc doc = new SimpleDoc(inStream, flavor, das);         
              job.print(doc, pras);        }
           catch(Exception ev){
            ev.printStackTrace();}
          }
    這是原碼,但是打印出來是几行亂碼.