簡體   English   中英

與客戶端打印機通信並打印A4紙

[英]Communicate with client side printer and print A4 sheet

Java Web應用程序安裝在服務器中。 客戶端可以使用瀏覽器通過URL訪問應用程序。 應用程序需要與直接連接到客戶端的本地打印機或網絡打印機進行通信,並在A4紙上打印pdf文件。

這里的打印操作是自動完成的,無需用戶交互。 用戶只需單擊打印按鈕,我們需要在客戶端機器中找到默認的打印設置,並在該打印機的A4紙張中打印pdf文件。

多個客戶端計算機和多個基於用戶設置的默認打印機。

如何使用Java或JavaScript?

您可以在window對象上使用方法print

print()方法打印當前窗口的內容。

print()方法打開“打印”對話框,允許用戶選擇首選打印選項。

用法示例:

 <!DOCTYPE html> <html> <body> <p>Click the button to print the current page.</p> <button onclick="myFunction()">Print this page</button> <script> function myFunction() { window.print(); } </script> </body> </html> 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM