dikshiprintagent 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +100 -0
  2. package/package.json +64 -1
package/README.md CHANGED
@@ -4,8 +4,12 @@ Official JavaScript SDK for connecting a website, billing application, POS, ERP,
4
4
 
5
5
  It lets a web application discover installed Windows printers and submit text, HTML, image, PDF, barcode, QR-code, RAW, and ESC/POS print jobs through a simple JavaScript API.
6
6
 
7
+ The Windows agent is a local print bridge designed around Windows printer queues, so newly installed printers are discovered automatically when Windows has a working driver.
8
+
7
9
  > This npm package is the web SDK. The Dikshi Print Agent Windows application must be installed and running on every computer that needs to print.
8
10
 
11
+ Android/iOS remote printing through the optional secure relay is documented in [REMOTE-PRINTING.md](REMOTE-PRINTING.md).
12
+
9
13
  ## How it works
10
14
 
11
15
  ```text
@@ -19,6 +23,35 @@ Dikshi Print Agent for Windows
19
23
  Installed Windows Printer
20
24
  ```
21
25
 
26
+ ## V10 features
27
+
28
+ - Windows tray application
29
+ - Loopback-only HTTP API on `127.0.0.1:8181`
30
+ - First-run 256-bit random API token
31
+ - Origin allow-list/CORS protection
32
+ - Dynamic installed-printer discovery and default-printer detection
33
+ - Queued print jobs with job status and history
34
+ - Text printing through Windows PrintDocument
35
+ - Image printing (base64 PNG/JPG/BMP and other supported formats)
36
+ - RAW printing through Winspool for label languages and printer-native data
37
+ - ESC/POS printing through the RAW path
38
+ - PDF printing through the Windows registered PDF `printto` handler
39
+ - Direct PDF URL printing: the agent downloads a PDF from an API URL and sends it to the selected printer
40
+ - HTML printing through WebView2 with page-size and orientation options
41
+ - Invoice and receipt template printing from plain JSON data
42
+ - QR and CODE128 barcode printing
43
+ - ESC/POS receipt builder in the browser SDK
44
+ - Persistent recent job history under `%APPDATA%\DikshiPrintAgent\job-history.json`
45
+ - Local dashboard with printer list, HTML/text test printing, and job history
46
+ - Visual template designer at `/designer` with drag-and-drop fields and saved JSON layouts
47
+ - Designer validation, version backups, locked layouts, resize handles, undo/redo, zoom, logo upload, and custom table columns
48
+ - Dashboard and designer pages do not embed the API token; paste it from the tray menu before using protected actions
49
+ - Daily logs under `%APPDATA%\DikshiPrintAgent\logs`
50
+ - Start-with-Windows support
51
+ - Browser JavaScript SDK and test page
52
+ - Single-file, self-contained `win-x64` publish
53
+ - Inno Setup script included
54
+
22
55
  ## Installation
23
56
 
24
57
  ```bash
@@ -27,6 +60,12 @@ npm install dikshiprintagent
27
60
 
28
61
  The SDK uses ES modules and supports modern browser build tools such as Vite, React, Vue, Angular, and Next.js client components.
29
62
 
63
+ ## Build the Windows agent
64
+
65
+ Install the Microsoft .NET 8 SDK on the Windows development computer, then run `build-exe.bat`.
66
+
67
+ The output is `DikshiPrintAgent-V10.exe` in the project root.
68
+
30
69
  ## Before you start
31
70
 
32
71
  On the Windows billing computer:
@@ -51,6 +90,20 @@ On the Windows billing computer:
51
90
 
52
91
  Never publish or hard-code a customer's API token in source control.
53
92
 
93
+ On its first run, the EXE creates `%APPDATA%\DikshiPrintAgent\config.json`. Right-click the tray icon and select **Copy API Token**. Edit `AllowedOrigins` in `config.json` to include your websites, then restart the agent.
94
+
95
+ For example:
96
+
97
+ ```json
98
+ "AllowedOrigins": [
99
+ "https://erp.example.com",
100
+ "https://billing.example.com",
101
+ "http://localhost:*"
102
+ ]
103
+ ```
104
+
105
+ Do not set `AllowAllOrigins=true` on production computers unless you fully understand the security risk.
106
+
54
107
  ## Quick start
55
108
 
56
109
  ```js
@@ -109,6 +162,23 @@ const job = await agent.printPdfUrl('HP Laser Printer', invoiceUrl, {
109
162
  await agent.wait(job.jobId, 30000);
110
163
  ```
111
164
 
165
+ The agent can also download and print a PDF returned by a server API as `application/pdf`. It validates the downloaded file, queues it, and prints it through the existing PDF print handler.
166
+
167
+ ```bash
168
+ curl -X POST "http://127.0.0.1:8181/api/v1/print/pdf-url" \
169
+ -H "Content-Type: application/json" \
170
+ -H "X-Dikshi-Token: YOUR_AGENT_TOKEN" \
171
+ -d "{\"printer\":\"YOUR_WINDOWS_PRINTER_NAME\",\"url\":\"https://dikshitech.ddns.net/kingmotorsapi/api/BookingEntry/DownloadBookingPdf/001/B00009AA\",\"documentName\":\"Booking_B00009AA.pdf\"}"
172
+ ```
173
+
174
+ Browser SDK:
175
+
176
+ ```js
177
+ await agent.printPdfUrl(printerName, bookingPdfUrl, {
178
+ documentName: 'Booking_B00009AA.pdf'
179
+ });
180
+ ```
181
+
112
182
  ### QR code and barcode
113
183
 
114
184
  ```js
@@ -155,6 +225,36 @@ RAW and ESC/POS printing require a printer and Windows driver that accept the co
155
225
 
156
226
  TypeScript declarations are included.
157
227
 
228
+ ## Agent API
229
+
230
+ - `GET /api/v1/health` (no token; health only)
231
+ - `GET /api/v1/printers`
232
+ - `GET /api/v1/jobs`
233
+ - `GET /api/v1/jobs/{id}`
234
+ - `GET /api/v1/templates`
235
+ - `GET /api/v1/templates/{name}`
236
+ - `POST /api/v1/templates`
237
+ - `POST /api/v1/print/text`
238
+ - `POST /api/v1/print/image`
239
+ - `POST /api/v1/print/code`
240
+ - `POST /api/v1/print/raw`
241
+ - `POST /api/v1/print/escpos`
242
+ - `POST /api/v1/print/pdf`
243
+ - `POST /api/v1/print/pdf-url`
244
+ - `POST /api/v1/print/html`
245
+ - `POST /api/v1/print/template`
246
+ - `POST /api/v1/print/designed-template`
247
+ - WebSocket: `/ws?token=...`
248
+
249
+ Authenticated REST requests require the `X-Dikshi-Token` header.
250
+
251
+ ## Important compatibility notes
252
+
253
+ 1. Generic printing works with printers exposed as valid Windows printer queues. Future printer models normally need only their Windows driver.
254
+ 2. RAW/ESC-POS requires the printer and driver to accept the command language being sent. There is no universal ESC/POS guarantee for every model.
255
+ 3. PDF `printto` relies on a Windows PDF application that implements the `printto` shell verb. For maximum unattended PDF reliability, a dedicated PDF rendering and printing engine should be embedded in a future signed enterprise build.
256
+ 4. An HTTPS website talking to a local agent can be affected by browser mixed-content and private-network policies. For strict enterprise or all-site deployment, use a trusted local TLS certificate or companion Chrome/Edge extension. This source keeps loopback HTTP intentionally simple and auditable.
257
+
158
258
  ## Troubleshooting
159
259
 
160
260
  - **Token is required:** Copy it from the Windows tray application and pass it to the constructor.
package/package.json CHANGED
@@ -1,12 +1,75 @@
1
1
  {
2
2
  "name": "dikshiprintagent",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "JavaScript SDK for silent printing from web applications through the Dikshi Print Agent for Windows",
5
5
  "keywords": [
6
+ "dikshiprintagent",
7
+ "dikshi-print-agent",
8
+ "dikshi-technologies",
9
+ "print-agent",
10
+ "printer-agent",
6
11
  "printing",
7
12
  "silent-print",
13
+ "silent-printing",
14
+ "direct-printing",
15
+ "automatic-printing",
16
+ "background-printing",
17
+ "browser-printing",
18
+ "web-printing",
19
+ "web-to-printer",
20
+ "local-printing",
21
+ "windows-printing",
22
+ "windows-print-service",
8
23
  "escpos",
24
+ "esc-pos",
9
25
  "windows-printer",
26
+ "local-print-agent",
27
+ "thermal-printer",
28
+ "receipt-printer",
29
+ "pos-printer",
30
+ "receipt-printing",
31
+ "invoice-printing",
32
+ "bill-printing",
33
+ "label-printing",
34
+ "tag-printing",
35
+ "raw-printing",
36
+ "pos-printing",
37
+ "point-of-sale",
38
+ "pos",
39
+ "erp",
40
+ "billing-software",
41
+ "billing-system",
42
+ "retail-software",
43
+ "retail-pos",
44
+ "jewellery-billing",
45
+ "jewellery-software",
46
+ "jewellery-pos",
47
+ "pawn-broking",
48
+ "pawn-software",
49
+ "rfid",
50
+ "rfid-printing",
51
+ "barcode-printing",
52
+ "barcode-printer",
53
+ "qr-code-printing",
54
+ "pdf-printing",
55
+ "html-printing",
56
+ "image-printing",
57
+ "text-printing",
58
+ "webview2-printing",
59
+ "printer-sdk",
60
+ "print-api",
61
+ "javascript-sdk",
62
+ "typescript",
63
+ "javascript",
64
+ "browser-sdk",
65
+ "vite",
66
+ "react",
67
+ "vue",
68
+ "angular",
69
+ "web-application",
70
+ "desktop-bridge",
71
+ "localhost-api",
72
+ "windows",
10
73
  "dikshi"
11
74
  ],
12
75
  "license": "MIT",