Sunday, August 23, 2026

How I Built a Local PDF PII Redaction Tool Before Uploading Documents to AI

I wanted to use AI to analyze a sensitive PDF, but I did not want to upload the original document with personal information intact. The document was also large, around 60 pages, with names, identifiers, contact details, and other PII repeated many times. Manually finding and redacting every occurrence would have been tedious and easy to get wrong.

My requirements were:

  • Run completely locally on Windows.

  • Open and process a large PDF, around 60 pages.

  • Automatically detect likely PII across the document.

  • Find repeated names, emails, phone numbers, dates, IDs, and similar fields.

  • Let me review the detections before applying them.

  • Keep useful analytical fields such as age, premium, cash value, surrender value, MEC information, loan provisions, and policy values.

  • Export a sanitized PDF that I could then upload to ChatGPT, Claude, Gemini, or another AI tool.

The goal was:

Original PDF -> Local PII Detection -> Review -> Redact -> Sanitized PDF -> AI

Finding the Right Tool

I looked at OpenRedact, PDF24, PDFgear, PDF-XChange, and a few other options.

Most traditional PDF tools work well when you already know exactly what needs to be removed. My requirement was slightly different: I wanted the software to help identify what might be PII first.

I eventually found:

PII GUI

https://github.com/sophia486/pii-gui

It is an open-source desktop application built with Tauri, React/TypeScript, Rust, and ONNX-based local detection.

Why I Built It From Source

The downloaded Windows installer triggered Microsoft Defender SmartScreen:

Windows protected your PC
Publisher: Unknown publisher

The executable also had no Digital Signatures tab in Windows Properties.

That does not automatically make an application unsafe, but since I planned to use it for sensitive documents, I decided to build it directly from the GitHub source instead.

Clone the Project in VS Code

I used VS Code because the project uses TypeScript, React, Rust, and Tauri.

Press:

Ctrl + Shift + P

Choose:

Git: Clone

Repository:

https://github.com/sophia486/pii-gui.git

My local folder was:

D:\ch-projects\pii-gui\pii-gui

Install the Required Tools

Check what is already installed:

node --version
pnpm --version
rustc --version
cargo --version

I already had Node.js.

Install pnpm

npm install -g pnpm

Verify:

pnpm --version

Install Rust and Cargo

Install Rust from:

https://rustup.rs/

Then verify:

rustc --version
cargo --version

If VS Code cannot find them:

where.exe rustc
where.exe cargo

Rust normally installs under:

C:\Users\<username>\.cargo\bin

Install Visual Studio C++ Build Tools

Open Visual Studio Installer and install or update:

Build Tools 2022 -> Modify -> Desktop development with C++

Make sure the latest available versions of these are installed:

  • MSVC v143 C++ build tools

  • Windows SDK

  • C++ CMake tools

This became important because ONNX Runtime depends on native C++ libraries.

Install Project Dependencies

Go to the Tauri directory:

cd D:\ch-projects\pii-gui\pii-gui\tauri

Then:

pnpm install

Run the development version:

pnpm tauri dev

Fixing the ONNX Runtime Linker Error

My first build produced a large number of linker errors such as:

LNK2001: unresolved external symbol __std_find_last_of_trivial_pos_1

and:

__std_search_1
__std_remove_2

The problem was not React, Rust, or Tauri code.

The ort-sys dependency was using a statically linked ONNX Runtime built with a newer MSVC C++ Standard Library than my installed Visual Studio 2022 Build Tools 17.10 provided.

The fix was to update the MSVC v143 C++ toolset and Windows SDK using Visual Studio Installer.

Then I cleaned the previous Rust build:

cd D:\ch-projects\pii-gui\pii-gui\tauri\src-tauri
cargo clean
cd ..
pnpm tauri dev

Port 1420 Already in Use

At one point Vite reported:

Port 1420 already in use

Find the process:

netstat -ano | findstr :1420

Then stop it:

taskkill /PID <PID> /F

Run again:

pnpm tauri dev

Opening a PDF

The GUI did not make the PDF-open option obvious.

The shortcut is:

Ctrl + O

That opens the Windows file picker.

You can then select the PDF and load it into PII GUI.

For my use case, this was important because the document was about 60 pages long and contained many repeated PII entries.

Instead of manually working page by page, the workflow became:

60-page PDF -> Detect PII Across Document -> Review Matches -> Apply Redactions -> Export

Reviewing PII

PII GUI can detect categories such as:

PrivatePerson
PrivateEmail
PrivatePhone
PrivateDate
PrivateUrl
Secret
UserId

The key part is that the results can be reviewed before redaction.

That matters because not every detected value should be removed. In an insurance illustration, for example, I may want to preserve:

  • age

  • underwriting class

  • premium

  • face amount

  • cash value

  • surrender value

  • MEC values

  • loan information

  • policy charges

while removing names, addresses, phone numbers, and identifiers.

Build the Windows Installer

After confirming the app worked with:

pnpm tauri dev

I created the release build.

Tauri generated both an NSIS .exe installer and an MSI installer under:

D:\ch-projects\pii-gui\pii-gui\tauri\src-tauri\target\release\bundle

The NSIS installer was under:

...\bundle\nsis

The MSI installer was under:

...\bundle\msi

I verified them using:

Get-ChildItem `
'D:\ch-projects\pii-gui\pii-gui\tauri\src-tauri\target\release\bundle\nsis', `
'D:\ch-projects\pii-gui\pii-gui\tauri\src-tauri\target\release\bundle\msi' |
Select-Object FullName,Length,LastWriteTime

Tauri Signing Warning

The release command returned exit code 1 because updater signing was enabled but:

TAURI_SIGNING_PRIVATE_KEY

was not configured.

The message was:

A public key has been found, but no private key

The important point was that the installers had already been generated successfully. The failure was related to updater signing, not the application build itself.

Install the Locally Built Application

The generated installer was:

D:\ch-projects\pii-gui\pii-gui\tauri\src-tauri\target\release\bundle\nsis\PII GUI_0.1.2_x64-setup.exe

After running it, PII GUI was installed like a normal Windows application and could be launched from the Start menu.

Final Workflow

My everyday process is now:

Launch PII GUI -> Ctrl + O -> Open PDF -> Detect PII -> Review -> Redact -> Export Sanitized PDF -> Upload to AI

For the blog screenshots, I only use pages from the final sanitized PDF. I do not publish the original before-image because it contains real PII.

Bottom Line

The original problem was simple: I had a large, approximately 60-page PDF with many repeated personal-information fields, and I wanted to use AI to analyze it without sending the original PII.

Building PII GUI locally gave me a reusable workflow:

Sensitive PDF -> Local PII Detection -> Human Review -> Redacted PDF -> AI

The most important lesson is straightforward:

Sanitize locally first. Use AI second. And here is a sample example of one of the pages of a 60-page document.





No comments: