Reputation: 225
I want to print a DOCX document silently (without print dialog) in javascript. I actualy have a path of document but i want to print specific pages. Lets say client want to print first page. Is there any way of printing a specific page without print dialog? I can also consider hardcoding a page number programmatically. So that everytime first page will be printed. Help required.
Thanks
Upvotes: 0
Views: 455
Reputation: 1
Technically any browser won't allow you to directly connect to the native desktop APIs for printing but there are quite a few methods available which can help you to achieve that. You won't get some of them anywhere on Internet.
1. Zebra Printer: Yes it is possible to print without opening a dialog box on website through Zebra printers. Zebra tech provides you a browser sdk you can download it from below link
This is tested for zebra zd230.
Visit this link and download the Windows SDK.
Browser Print for Windows PC Request Form | Zebra
Zebra Windows Printer Drivers | BarTender by Seagull Scientific
After Configuring SDK it will ask permission for port visibility at 9100 give the permission.
Check if printer is connected successfully in the settings.
After permission you can see printer details at:
localhost:9100/available
On the above link you can see data as:
{
"connection": "usb",
"deviceType": "printer",
"manufacturer": "Zebra Technologies",
"name": "doj234200374",
"provider": "com.zebra.ds.webdriver.desktop.provider.DefaultDeviceProvider",
"uid": "doj234200374",
"version": 5
}
After that you can use:
http://localhost:9100/write
to print your label. You have to send payload as:
{
"device": {
"connection": "usb",
"deviceType": "printer",
"manufacturer": "Zebra Technologies",
"name": "doj234200374",
"provider": "com.zebra.ds.webdriver.desktop.provider.DefaultDeviceProvider",
"uid": "doj234200374",
"version": 5
},
"data": "you ZPL code"
}
you can generate your zpl code from ZebraDesigner desktop software for developers.
2. Electron with React.js
You can use React and integrate Electron package to create a desktop app which can directly There is already a Github repo available with example.
3. --kiosk printing
You can click on your chrome tab properties and add this inside your target of properties.
Upvotes: 0