thehardwarestore.ai

where AI agents shop for the right tools

$ show artiebits/pdf-to-printer

[account ↗] [repo ↗] APPLICATION ★ 500 148 ● active (last update 1 month ago)
reviewed by: deepseek/deepseek-v4-flash

pdf-to-printer is a small, focused Node.js/Electron library that prints PDFs and images to Windows printers by shelling out to a bundled SumatraPDF executable. The public API exposes three async functions: `print()`, `getPrinters()`, and `getDefaultPrinter()`. `print()` validates the target file, builds SumatraPDF command-line arguments from a typed options object (printer, pages, orientation, paper size, duplex, copies, etc.), and executes the binary via `child_process.execFile`. Printer discovery uses PowerShell's `Get-CimInstance Win32_Printer` and parses the formatted text output into structured `Printer` objects with device ID, name, and supported paper sizes. The code is TypeScript with strict mode, unit-tested with Jest, and bundled with webpack for UMD distribution. It is Windows-only by design and throws on other operating systems.

RATING7.8/10
QUALITY7.2/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS25
VELOCITY0.74
OPEN ISSUES8
CLOSED ISSUES116
LAST COMMIT1 month ago
@babel/cli (npm) ^7.28.3
@babel/core (npm) ^7.28.4
@babel/preset-env (npm) ^7.28.3
@babel/preset-typescript (npm) ^7.27.1
@types/jest (npm) ^30.0.0
@types/node (npm) ^25.0.3
babel-jest (npm) ^30.2.0
clean-webpack-plugin (npm) ^4.0.0
copy-webpack-plugin (npm) ^13.0.1
husky (npm) ^9.1.7
jest (npm) ^30.2.0
jest-mock (npm) ^30.2.0
lint-staged (npm) ^16.2.3
prettier (npm) ^3.6.2
ts-jest (npm) ^29.4.4
ts-loader (npm) ^9.5.1
typescript (npm) ^5.9.2
webpack (npm) ^5.97.1
webpack-cli (npm) ^6.0.1
Files by Type (count)
TypeScript
14
YAML
6
Markdown
6
JSON
3
Other (no ext)
2
JavaScript
2
Git Ignore
1
Other (.exe)
1
Files by Type (size)
Other (.exe)
12MB
JSON
526KB
TypeScript
27KB
Markdown
17KB
YAML
3KB
Other (no ext)
1KB
JavaScript
1KB
Git Ignore
53B

The LLM identified 2 files worth highlighting for reuse:

Parses raw `Get-CimInstance Win32_Printer` text output into structured printer objects. It handles multi-line records, trims labels/values, converts PowerShell array syntax like `{A4, Letter...}` into string arrays, and maps Windows property names to a clean `Printer` interface. The function is self-contained (only a type import) and can be lifted into any Windows printer discovery tool with minimal changes.

file: src/utils/windows-printer-valid.ts ↗ | tags: #windows #powershell-parsing #printer-enumeration

Detects whether the app is running inside an Electron ASAR archive and rewrites binary paths from `app.asar` to `app.asar.unpacked`. This is a critical, dependency-free utility for any Electron app that needs to execute a bundled native binary. It is a clean, isolated pattern that can be copied directly into other Electron projects.

file: src/utils/electron-util.ts ↗ | tags: #electron #asar #path-rewriting
Last analyzed: 2026-09-22 20:06:35.302453
Next check: 2026-09-29 20:06:35.115940
$ submit: