Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ScribeToPaperless

Built with AI. This project was designed and written with Claude (Anthropic). The code has been tested, and runs in production on the author's setup, but treat it as you would any small hobby project — read what it does before running it on machines you care about.

A Windows virtual printer that sends printed documents directly to a paperless-ngx instance over its REST API. Print from any Windows application → document appears in paperless a second later. No SaveAs dialogs, no metadata prompts, no folder watchers. Proof of concept. Tested on a single Windows 11 x64 machine with paperless-ngx 2.x. Not signed. No automated tests.

How it works

This is a small companion to a fork of stchan/PdfScribe (AGPL-3.0). PdfScribe handles the hard part — being a real Windows printer driver that turns print jobs into PDFs via Ghostscript. This repo contributes:

  • ScribeToPaperless.exe — a CLI that takes a PDF path, queues it, and uploads it to paperless. Has a built-in retry queue for when paperless is unreachable.
  • A patch to PdfScribe's Program.cs that swaps out the SaveAs dialog for a silent handoff to ScribeToPaperless.exe.
  • A WiX fragment that bundles ScribeToPaperless.exe into the existing PdfScribe MSI so you ship a single installer.
    Any Windows app
           │  File → Print → "PDF Scribe"
           ▼
    Microsoft PostScript driver
           │
           ▼
    Redmon (port monitor)
           │
           ▼
    PdfScribe.exe (modified)
           │  Ghostscript → PDF in %TEMP%
           ▼
    ScribeToPaperless.exe
           │  moves PDF into queue, POSTs to paperless
           ▼
    paperless-ngx  /api/documents/post_document/

Uploads are silent. The paperless title is Print-<ISO-8601 UTC timestamp> based on when you actually pressed Print, not when the upload eventually succeeded. Use paperless workflows (Settings → Workflows) to handle classification, title rewriting, correspondent assignment, etc.

Install

  1. Download the latest ScribeToPaperless-*.msi from Releases.
  2. Run the MSI. Default install location is C:\Program Files\PDF Scribe\.
  3. Configure (see Configure).
  4. Print to "PDF Scribe" from any application.

Once installed:

  1. Run the MSI. Default install location is C:\Program Files\PDF Scribe\.
  2. Open a PowerShell prompt and configure your paperless URL and API token (see Configure).
  3. Print to "PDF Scribe" from any application. The document appears in paperless within a few seconds.

The installer registers the printer driver, the port monitor, and Ghostscript. It does not prompt for paperless credentials at install time; configuration is per-user via the CLI.

Configure

Each Windows user needs a one-time setup:

& "C:\Program Files\PDF Scribe\ScribeToPaperless.exe" --configure

This prompts for:

  • Paperless URL — e.g. https://paperless.example.com
  • API token — generate from paperless: user menu → My Profile → API token → "Regenerate"

Values are saved to %APPDATA%\ScribeToPaperless\config.json.

You can also set PAPERLESS_URL and PAPERLESS_TOKEN as environment variables.

Testing

& "C:\Program Files\PDF Scribe\ScribeToPaperless.exe" "C:\some-test.pdf"

You should see three log lines (Queued, OK, Flush summary) and a new document in paperless within seconds.

Other CLI commands

ScribeToPaperless.exe <pdf-path>     Upload a PDF (also retries the queue)
ScribeToPaperless.exe --flush        Retry everything in the queue without a new job
ScribeToPaperless.exe --configure    Set URL and token interactively
ScribeToPaperless.exe --version      Print version

Build from source

Prerequisites

  • Windows 10/11 x64
  • Visual Studio 2022 with the ".NET desktop development" workload
  • FireGiant HeatWave Visual Studio extension (provides WiX 4 tooling)
  • .NET SDK 8 or later (for building ScribeToPaperless; the exe itself targets .NET Framework 4.8)
  • Git

One-time setup

Clone both repos as siblings — the WiX fragment uses a relative path that assumes this layout:

mkdir C:\paperless-print
cd C:\paperless-print
git clone --recurse-submodules https://github.com/stchan/PdfScribe.git
git clone https://github.com/jtscott/ScribeToPaperless.git

Patch PdfScribe

Apply the changes from PdfScribe-patch.md to:

  • PdfScribe\PdfScribe\PdfScribe.csproj — add the System.Configuration reference.
  • PdfScribe\PdfScribe\Program.cs — replace the body of the main try block and add the InvokeUploader helper method.

The patch file is self-contained and includes the exact code to paste in.

Patch the WiX project

Edit PdfScribe\PdfScribeInstall\Product.wxs. Inside the <ComponentGroup Id="ProductComponents" ...> block, immediately after the existing <Component Id="PdfScribeBase">...</Component>, add:

<Component Id="ScribeToPaperlessExe">
    <File Id="ScribeToPaperlessExeFile"
          Source="..\..\ScribeToPaperless\ScribeToPaperless\bin\Release\net48\ScribeToPaperless.exe"
          KeyPath="yes" />
</Component>

Build the uploader

cd C:\paperless-print\ScribeToPaperless\ScribeToPaperless
dotnet publish -c Release -f net48 -o bin\Release\net48

This produces ScribeToPaperless.exe at the path the WiX fragment expects.

Build the MSI

Open C:\paperless-print\PdfScribe\PdfScribe.sln in Visual Studio.

  1. Set the solution configuration to Release and x64.
  2. Build → Build Solution.

The MSI is produced at: PdfScribe\PdfScribeInstall\bin\x64\Release\en-us\PdfScribe.msi

Install and test

  1. Uninstall any previous PdfScribe install (Add/Remove Programs).
  2. Run the MSI.
  3. Configure (see Configure).
  4. Print from any app to "PDF Scribe" → document lands in paperless.

Troubleshooting

Printed but nothing appears in paperless. First place to look is %LOCALAPPDATA%\ScribeToPaperless\upload.log — every upload attempt logs there. Second place: %LOCALAPPDATA%\ScribeToPaperless\queue\. Anything sitting in the queue means Ghostscript worked but the upload didn't.

Token works from curl but not from here. Check PAPERLESS_URL doesn't have a trailing slash. Check the Windows machine trusts the paperless TLS certificate (matters for self-signed certs).

Multiple users on the same machine. Each Windows user gets their own %APPDATA%\ScribeToPaperless\config.json. Each needs to run --configure once. Useful if you want each user's prints to show up under a different paperless user.

MSI build fails because it can't find ScribeToPaperless.exe. The WiX fragment uses a relative path that assumes both repos live as siblings under the same parent directory. Either follow that layout, or edit the <File Source=...> path in Product.wxs to point at your actual build output.

License

AGPL-3.0-or-later, same as the upstream PdfScribe and Ghostscript on which this depends. See LICENSE.txt for the full text.

In short: if you run a modified version of this as a service that other people use over a network, you owe them the source. For private use on your own machines there's nothing to do.

Acknowledgements

  • stchan/PdfScribe — does all the hard work of being a real Windows printer driver. This project is essentially a fork-and-extend.
  • paperless-ngx — the document management system this bridges to.
  • Ghostscript — PostScript-to-PDF conversion (bundled via PdfScribe).
  • Redmon — port monitor (bundled via PdfScribe's submodule).

About

A Windows virtual printer that sends printed documents directly to a paperless-ngx instance over its REST API. Print from any Windows application → document appears in paperless a second later. No SaveAs dialogs, no metadata prompts, no folder watchers.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages