dikshiprintagent
| Install | |
|---|---|
npm install dikshiprintagent |
|
| Latest Version: | 1.0.6 |
| License: | MIT |
| Last Updated: | Oct 7, 2026 |
| Links: | npm |
dikshiprintagent
Official JavaScript SDK for connecting a website, billing application, POS, ERP, or web portal to Dikshi Print Agent running on a Windows computer.
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.
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.
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.
Android/iOS remote printing through the optional secure relay is documented in REMOTE-PRINTING.md.
How it works
Website / Billing App
| dikshiprintagent npm SDK
v
http://127.0.0.1:8181
v
Dikshi Print Agent for Windows
v
Installed Windows Printer
V10 features
- Windows tray application
- Loopback-only HTTP API on
127.0.0.1:8181 - First-run 256-bit random API token
- Origin allow-list/CORS protection
- Dynamic installed-printer discovery and default-printer detection
- Queued print jobs with job status and history
- Text printing through Windows PrintDocument
- Image printing (base64 PNG/JPG/BMP and other supported formats)
- RAW printing through Winspool for label languages and printer-native data
- ESC/POS printing through the RAW path
- PDF printing through the Windows registered PDF
printtohandler - Direct PDF URL printing: the agent downloads a PDF from an API URL and sends it to the selected printer
- HTML printing through WebView2 with page-size and orientation options
- Invoice and receipt template printing from plain JSON data
- QR and CODE128 barcode printing
- ESC/POS receipt builder in the browser SDK
- Persistent recent job history under
%APPDATA%\DikshiPrintAgent\job-history.json - Local dashboard with printer list, HTML/text test printing, and job history
- Visual template designer at
/designerwith drag-and-drop fields and saved JSON layouts - Designer validation, version backups, locked layouts, resize handles, undo/redo, zoom, logo upload, and custom table columns
- Dashboard and designer pages do not embed the API token; paste it from the tray menu before using protected actions
- Daily logs under
%APPDATA%\DikshiPrintAgent\logs - Start-with-Windows support
- Browser JavaScript SDK and test page
- Single-file, self-contained
win-x64publish - Inno Setup script included
Installation
npm install dikshiprintagent
The SDK uses ES modules and supports modern browser build tools such as Vite, React, Vue, Angular, and Next.js client components.
Build the Windows agent
Install the Microsoft .NET 8 SDK on the Windows development computer, then run build-exe.bat.
The output is DikshiPrintAgent-V10.exe in the project root.
Before you start
On the Windows billing computer:
- Install and run Dikshi Print Agent.
- Confirm that the required printer is installed in Windows.
- Right-click the agent tray icon and select Copy API Token.
- Add your website origin to
%APPDATA%\DikshiPrintAgent\config.json. - Restart the agent after changing its configuration.
{
"port": 8181,
"allowAllOrigins": false,
"allowedOrigins": [
"http://localhost:5173",
"http://localhost:3000",
"https://your-website.example"
]
}
Never publish or hard-code a customer's API token in source control.
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.
For example:
"AllowedOrigins": [
"https://erp.example.com",
"https://billing.example.com",
"http://localhost:*"
]
Do not set AllowAllOrigins=true on production computers unless you fully understand the security risk.
Quick start
import DikshiPrintAgent from 'dikshiprintagent';
const agent = new DikshiPrintAgent({
token: 'TOKEN_COPIED_FROM_THE_WINDOWS_TRAY_APP'
});
const health = await agent.health();
console.log('Agent:', health);
const result = await agent.printers();
console.log('Printers:', result.printers);
const job = await agent.printText(result.printers[0].name, 'Hello from Dikshi!');
const completedJob = await agent.wait(job.jobId, 30000);
console.log('Completed:', completedJob);
Constructor
const agent = new DikshiPrintAgent({
token: 'required-api-token',
host: '127.0.0.1', // optional
port: 8181, // optional
protocol: 'http' // optional: http or https
});
Common examples
Print text
const job = await agent.printText('EPSON TM-T82', 'Thank you!', {
documentName: 'Receipt 1001',
fontName: 'Consolas',
fontSize: 10,
copies: 1
});
await agent.wait(job.jobId);
Print HTML or PDF URL
await agent.printHtml('Invoice Printer', '<h1>Invoice #1001</h1>', {
documentName: 'Invoice 1001'
});
const job = await agent.printPdfUrl('HP Laser Printer', invoiceUrl, {
documentName: 'Invoice 1001.pdf'
});
await agent.wait(job.jobId, 30000);
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.
curl -X POST "http://127.0.0.1:8181/api/v1/print/pdf-url" \
-H "Content-Type: application/json" \
-H "X-Dikshi-Token: YOUR_AGENT_TOKEN" \
-d "{\"printer\":\"YOUR_WINDOWS_PRINTER_NAME\",\"url\":\"https://dikshitech.ddns.net/kingmotorsapi/api/BookingEntry/DownloadBookingPdf/001/B00009AA\",\"documentName\":\"Booking_B00009AA.pdf\"}"
Browser SDK:
await agent.printPdfUrl(printerName, bookingPdfUrl, {
documentName: 'Booking_B00009AA.pdf'
});
QR code and barcode
await agent.printQr('Label Printer', 'https://www.dikshitech.com/');
await agent.printBarcode('Label Printer', 'ITEM-10001');
ESC/POS receipt
const receipt = DikshiPrintAgent.receiptBuilder({ width: 42 })
.center().bold().text('DIKSHI STORE\n').bold(false)
.line()
.row('Invoice', 'INV-1001')
.item('Product', 2, 100)
.line()
.row('Total', 'Rs. 200.00')
.cut()
.build();
const job = await agent.printEscPos('Thermal Printer', receipt);
await agent.wait(job.jobId);
RAW and ESC/POS printing require a printer and Windows driver that accept the commands being sent.
SDK methods
| Method | Purpose |
|---|---|
health() |
Check whether the local agent is running |
printers() |
Get installed Windows printers |
jobs() / job(jobId) |
Read recent jobs or one job |
wait(jobId, timeoutMs) |
Wait until a job completes or fails |
printText() / printHtml() |
Print text or HTML |
printImage() |
Print a base64 image |
printPdf() / printPdfUrl() |
Print a base64 PDF or PDF URL |
printQr() / printBarcode() |
Print QR and CODE128 codes |
printRaw() / printEscPos() |
Send printer-native data |
templates() / template(name) |
Read saved templates |
saveTemplate() |
Save a print template |
printTemplate() |
Print template data |
printDesignedTemplate() |
Print a designer template |
TypeScript declarations are included.
Agent API
GET /api/v1/health(no token; health only)GET /api/v1/printersGET /api/v1/jobsGET /api/v1/jobs/{id}GET /api/v1/templatesGET /api/v1/templates/{name}POST /api/v1/templatesPOST /api/v1/print/textPOST /api/v1/print/imagePOST /api/v1/print/codePOST /api/v1/print/rawPOST /api/v1/print/escposPOST /api/v1/print/pdfPOST /api/v1/print/pdf-urlPOST /api/v1/print/htmlPOST /api/v1/print/templatePOST /api/v1/print/designed-template- WebSocket:
/ws?token=...
Authenticated REST requests require the X-Dikshi-Token header.
Important compatibility notes
- Generic printing works with printers exposed as valid Windows printer queues. Future printer models normally need only their Windows driver.
- 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.
- PDF
printtorelies on a Windows PDF application that implements theprinttoshell verb. For maximum unattended PDF reliability, a dedicated PDF rendering and printing engine should be embedded in a future signed enterprise build. - 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.
Troubleshooting
- Token is required: Copy it from the Windows tray application and pass it to the constructor.
- Connection failed: Open
http://127.0.0.1:8181/api/v1/health. Start or restart the agent if it does not return JSON. - HTTP 401: The token is missing or incorrect. Copy the current token again.
- CORS/origin error: Add the exact origin, such as
http://localhost:5173, toallowedOriginsand restart the agent. - HTTPS to local HTTP blocked: Some browsers and enterprise policies require trusted local HTTPS or approved browser configuration.
- Printer missing: Install its Windows driver, confirm it appears in Windows Printers & scanners, and reload the list.
Security
- Keep
allowAllOriginsdisabled in production. - Allow only trusted application origins.
- Never store a real agent token in a public repository.
- Store the token locally per billing computer or user.
- The default service listens on loopback address
127.0.0.1.
About Dikshi Technologies
Dikshi Technologies is a Chennai-based software and digital-solutions company with its office in Pallikaranai. With over 22 years of domain experience, the company develops practical ERP, billing, mobile, RFID, and automation solutions for retail and service businesses.
Products and services
- Jewellery billing, POS, stock, order, customer, and ERP solutions
- Jewellery RFID inventory, auditing, tracking, and loss-prevention solutions
- Pawn Pro for pawn-broking and pledge-management operations
- Wholesale, retail, supermarket, and hypermarket billing software
- Textile, readymade, garment, and footwear ERP software
- Restaurant, hotel, hardware, fancy-store, and industry-specific billing systems
- Barcode, QR-code, tag, label, and thermal-printing integrations
- Windows, web, Android, iOS, cloud, and multi-branch applications
- Custom ERP, CRM, business automation, and software development
- Website and mobile-application development
- Social-media marketing, digital marketing, SEO, content, creative, and other digital services
Office and contact
Dikshi Technologies
No. 80 & 81, Devi Karumariamman Nagar
Velachery Main Road, Near Oil Mill Bus Stop
Pallikaranai, Chennai – 600100
Tamil Nadu, India
- Website: www.dikshitech.com
- Email: dikshitechnologies@gmail.com
- Phone: +91 98414 19981
- Demo / WhatsApp: +91 74488 80373
- LinkedIn: Dikshi Technologies
License
MIT © 2026 Dikshi Technologies.
Related Packages
Automatically detects new app versions, clears browser caches & storages, and re...
Simple, framework agnostic and GDPR Compliance library to track data to Meta Pix...
Simple, framework agnostic and GDPR Compliance library to track data to Meta Pix...
Headless QR code label rendering engine — generate ZPL, PDF, PNG layouts from JS...
Version History
| Version | Released | License |
|---|---|---|
| 1.0.6 | MIT | |
| 1.0.5 | MIT | |
| 1.0.4 | MIT | |
| 1.0.3 | MIT | |
| 1.0.2 | MIT | |
| 1.0.1 | MIT | |
| 1.0.0 | Proprietary |