{"_id":"@bun-win32/prntvpt","_rev":"3-7836651d604184136725b188eb246692","name":"@bun-win32/prntvpt","dist-tags":{"latest":"2.0.1"},"versions":{"1.0.0":{"name":"@bun-win32/prntvpt","version":"1.0.0","keywords":["bun","ffi","win32","windows","prntvpt","bindings","typescript","dll"],"author":"Stev Peifer <stev@bell.net>","license":"MIT","_id":"@bun-win32/prntvpt@1.0.0","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"859c86c4d169c726d6e4427b554f903a2c1a3728","tarball":"https://registry.npmjs.org/@bun-win32/prntvpt/-/prntvpt-1.0.0.tgz","fileCount":6,"integrity":"sha512-3BrGrq4iTUyyT83ybErVGp1cdQ4qH2mI/BNpwXoxPgRh0y1B32Ww1Wg4I0YjiCA2LBPMHWVUihJ62hsGejrkNQ==","signatures":[{"sig":"MEQCIFebvqkM51xzF+5xcvaxcIs4cTQhUNtG9ZUSW9I7070wAiBe7cEI6gQeHCIb0L78JX/UQ/GCXkCu5fPh+lrFBZAo6Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16910},"main":"./index.ts","type":"module","module":"index.ts","shasum":"859c86c4d169c726d6e4427b554f903a2c1a3728","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:print-ticket-studio":"bun ./example/print-ticket-studio.ts","example:print-capabilities-report":"bun ./example/print-capabilities-report.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-3BrGrq4iTUyyT83ybErVGp1cdQ4qH2mI/BNpwXoxPgRh0y1B32Ww1Wg4I0YjiCA2LBPMHWVUihJ62hsGejrkNQ==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/prntvpt"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 PRNTVPT (Print Ticket / Print Schema) bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.2"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/prntvpt_1.0.0_1780539756652_0.20732536921868938","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@bun-win32/prntvpt","version":"2.0.0","keywords":["bun","ffi","win32","windows","prntvpt","bindings","typescript","dll"],"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","_id":"@bun-win32/prntvpt@2.0.0","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"f4969a45a85c928957eb4d6450ffae39f97596bd","tarball":"https://registry.npmjs.org/@bun-win32/prntvpt/-/prntvpt-2.0.0.tgz","fileCount":6,"integrity":"sha512-67czu2tIzQhcasq8MklJqupbQxN0CCRx3it4nMNkpgQrjirzk4zFz2Tl7+gDQV7MjkRGVY+CN9wcxjmdCMCWYg==","signatures":[{"sig":"MEQCIBNfBCeovgMQwM1+Q0LnE0sAFqODvqiIVR/Edezr3wbzAiBye5hoprWuORd9oprvEssu77qfT/AExzUzj9gheQ/FkQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":18398},"main":"./index.ts","type":"module","module":"index.ts","shasum":"f4969a45a85c928957eb4d6450ffae39f97596bd","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:print-ticket-studio":"bun ./example/print-ticket-studio.ts","example:print-capabilities-report":"bun ./example/print-capabilities-report.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"_integrity":"sha512-67czu2tIzQhcasq8MklJqupbQxN0CCRx3it4nMNkpgQrjirzk4zFz2Tl7+gDQV7MjkRGVY+CN9wcxjmdCMCWYg==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/prntvpt"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 PRNTVPT (Print Ticket / Print Schema) bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"26.3.0","dependencies":{"@bun-win32/core":"2.0.0"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/prntvpt_2.0.0_1782435492663_0.3756501412745106","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"author":"Stev Peifer <stev.p@outlook.com>","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dependencies":{"@bun-win32/core":"2.0.1"},"description":"Zero-dependency, zero-overhead Win32 PRNTVPT (Print Ticket / Print Schema) bindings for Bun (FFI) on Windows.","devDependencies":{"@types/bun":"latest"},"exports":{".":"./index.ts"},"license":"MIT","module":"index.ts","name":"@bun-win32/prntvpt","peerDependencies":{"typescript":"^5"},"private":false,"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/prntvpt"},"type":"module","version":"2.0.1","main":"./index.ts","keywords":["bun","ffi","win32","windows","prntvpt","bindings","typescript","dll"],"sideEffects":false,"engines":{"bun":">=1.1.0"},"scripts":{"example:print-ticket-studio":"bun ./example/print-ticket-studio.ts","example:print-capabilities-report":"bun ./example/print-capabilities-report.ts"},"_id":"@bun-win32/prntvpt@2.0.1","_integrity":"sha512-ezrpfWKJ48lYHo2moK37BSDa3xtFV/7YlksBV0qAYfmgam96Eg/TRMfoUaUMGlCg7is83+h6275URopfhSTFQQ==","_nodeVersion":"26.3.0","_npmVersion":"10.8.3","shasum":"b59e7d1da14f2e67cab72c1fa3c07f5a9bf7bef0","dist":{"integrity":"sha512-ezrpfWKJ48lYHo2moK37BSDa3xtFV/7YlksBV0qAYfmgam96Eg/TRMfoUaUMGlCg7is83+h6275URopfhSTFQQ==","shasum":"b59e7d1da14f2e67cab72c1fa3c07f5a9bf7bef0","tarball":"https://registry.npmjs.org/@bun-win32/prntvpt/-/prntvpt-2.0.1.tgz","fileCount":6,"unpackedSize":18398,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDxsO9Ad6v6seun/Cf5nNyt3Nb29LmOiY29UpeGv+mA+AIgOkCDQgncJRsNwBNMFX4yWxsvs8osOQKz9pTfqzkvaw0="}]},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"directories":{},"maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/prntvpt_2.0.1_1782438152903_0.8577483486411646"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-04T02:22:36.493Z","modified":"2026-06-26T01:42:33.141Z","1.0.0":"2026-06-04T02:22:36.796Z","2.0.0":"2026-06-26T00:58:12.810Z","2.0.1":"2026-06-26T01:42:33.031Z"},"bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","homepage":"https://github.com/ObscuritySRL/bun-win32#readme","keywords":["bun","ffi","win32","windows","prntvpt","bindings","typescript","dll"],"repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/prntvpt"},"description":"Zero-dependency, zero-overhead Win32 PRNTVPT (Print Ticket / Print Schema) bindings for Bun (FFI) on Windows.","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"readme":"# @bun-win32/prntvpt\n\nZero-dependency, zero-overhead Win32 Prntvpt bindings for [Bun](https://bun.sh) on Windows.\n\n## Overview\n\n`@bun-win32/prntvpt` exposes the `prntvpt.dll` exports — the Print Ticket / Print Schema API — using [Bun](https://bun.sh)'s FFI. It provides a single class, `Prntvpt`, which lazily binds native symbols on first use. You can optionally preload a subset or all symbols up-front via `Preload()`.\n\nThe Print Ticket API is the modern, XML Print Schema way to inspect and manipulate print settings: query a printer's full PrintCapabilities, convert between the legacy `DEVMODE` blob and a Print Ticket, and merge + validate delta tickets against the live driver. No more shelling out to PowerShell or hand-rolling `DEVMODE` structs.\n\nThe bindings are strongly typed for a smooth DX in TypeScript.\n\n## Features\n\n- [Bun](https://bun.sh)-first ergonomics on Windows 10/11.\n- Direct FFI to `prntvpt.dll` (Print Ticket providers, PrintCapabilities, DEVMODE ⇄ Print Ticket conversion, merge & validate, schema-version query).\n- All 11 documented `prntvpt.h` functions plus the standard `Dll*` COM-server entries.\n- In-source docs in `structs/Prntvpt.ts` with links to Microsoft Docs.\n- Lazy binding on first call; optional eager preload (`Prntvpt.Preload()`).\n- No wrapper overhead; calls map 1:1 to native APIs.\n- Strongly-typed Win32 aliases plus the `EPrintTicketScope` / `EDefaultDevmodeType` enums and the Print Ticket `HRESULT` constants (see `types/Prntvpt.ts`).\n\n## Requirements\n\n- [Bun](https://bun.sh) runtime\n- Windows 10 or later\n\n## Installation\n\n```sh\nbun add @bun-win32/prntvpt\n```\n\n## Quick Start\n\n```ts\nimport Prntvpt from '@bun-win32/prntvpt';\nimport Shlwapi from '@bun-win32/shlwapi';\nimport Ole32 from '@bun-win32/ole32';\n\nOle32.CoInitialize(null);\n\nconst printer = Buffer.from('Microsoft Print to PDF\\0', 'utf16le');\n\n// Highest Print Schema version this queue supports.\nconst maxVer = Buffer.alloc(4);\nPrntvpt.PTQuerySchemaVersionSupport(printer.ptr!, maxVer.ptr!);\nconsole.log('Print Schema version:', maxVer.readUInt32LE(0));\n\n// Open a provider and pull the driver's PrintCapabilities XML.\nconst phProvider = Buffer.alloc(8);\nPrntvpt.PTOpenProvider(printer.ptr!, maxVer.readUInt32LE(0) || 1, phProvider.ptr!);\nconst hProvider = phProvider.readBigUInt64LE(0);\n\n// IStream* tokens are opaque bigints; SHCreateMemStream gives us one.\nconst caps = BigInt(Shlwapi.SHCreateMemStream(null, 0));\nconst hr = Prntvpt.PTGetPrintCapabilities(hProvider, 0n, caps, null);\nconsole.log('PTGetPrintCapabilities → 0x' + (hr >>> 0).toString(16));\n\nPrntvpt.PTCloseProvider(hProvider);\n```\n\n> [!NOTE]\n> AI agents: see `AI.md` for the package binding contract and source-navigation guidance. It explains how to use the package without scanning the entire implementation.\n\n## Examples\n\nRun the included examples:\n\n```sh\nbun run example:print-capabilities-report\nbun run example:print-ticket-studio\n```\n\n- **print-capabilities-report** — a thorough diagnostic: enumerates the printer roster, then for the default printer queries its Print Schema version and decodes the full driver-authored `PrintCapabilities` (and Win10 1703+ `PrintDeviceCapabilities`) document into aligned Feature / Option / ParameterDef tables, with every HRESULT decoded by name.\n- **print-ticket-studio** — a live, animated round-trip: takes the default printer's real `DEVMODE`, converts it to a Print Ticket and X-rays the syntax-highlighted Print Schema XML, forges a delta ticket that flips the page to Landscape, merges + validates it (decoding the `S_PT_CONFLICT_RESOLVED` / `S_PT_NO_CONFLICT` verdict), then converts the merged ticket back into a fresh driver-allocated `DEVMODE` read out with `ReadProcessMemory` and freed with `PTReleaseMemory`.\n\n## Notes\n\n- COM `IStream*` parameters are opaque `bigint` tokens. Create one with `Shlwapi.SHCreateMemStream` (or `ole32`); read produced XML back by invoking the stream's vtable (`Seek` + `Read`).\n- Call `Ole32.CoInitialize` (or `CoInitializeEx`) before using a Print Ticket provider.\n- `PTConvertPrintTicketToDevMode` returns a `DEVMODE` the **driver** allocated. It comes back as a `bigint` address — read it with `ReadProcessMemory` and release it with `PTReleaseMemory`.\n- `PTOpenProvider` handles are thread-affine: open, use, and close on the same thread.\n- Either rely on lazy binding or call `Prntvpt.Preload()`.\n- Windows only. Bun runtime required.\n- **SAL types & naming:** nullability is in the **type** — `Optional<T>` (formally optional, SAL `_*opt_`) and `Nullable<T>` (plain `[in]`/`[out]` the docs say can be NULL), the null sentinel derived from `T` (`null` for pointers `LP*`/`P*`, `0n` for handles/by-value addresses); direction is in the **parameter name** — `_out` (`_Out_`), `_in_out` (`_Inout_`), `_In_` bare. See `AI.md` and the repo `AGENTS.md`.\n","readmeFilename":"README.md"}