
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@transkripid/pdf-text-replace
Advanced tools
Find and replace text in PDF files while preserving formatting.
String.replace()# From npm (when published)
npm install pdf-text-replace
# From local path
npm install /path/to/pdf-text-replace
import { PDF } from 'pdf-text-replace';
import { readFileSync, writeFileSync } from 'fs';
const input = readFileSync('document.pdf');
const modified = new PDF(input)
.replace('John Doe', 'Jane Smith')
.replace('old@email.com', 'new@email.com')
.replace(/\d{4}-\d{4}-\d{4}/g, 'XXXX-XXXX-XXXX')
.toBuffer();
writeFileSync('modified.pdf', modified);
new PDF(input: Buffer | Uint8Array)Create a new PDF instance from a buffer.
.replace(search: string | RegExp, replacement: string): thisQueue a text replacement operation. Returns this for chaining.
search - String or RegExp pattern to findreplacement - Text to replace matches with.toBuffer(): BufferApply all queued replacements and return the modified PDF as a Buffer.
Returns the original buffer unchanged if:
The library parses PDF content streams (both raw and FlateDecode compressed), finds text operators (Tj, TJ), and performs replacements while:
Tz operator) when replacement text has different widthReplacement text containing Unicode characters is automatically transliterated to ASCII for compatibility with standard PDF fonts (WinAnsiEncoding):
// Chinese → Pinyin
.replace('Author', '银宵') // Becomes "YinXiao"
// Korean → Romanized
.replace('Name', '스트레이') // Becomes "seuteulei"
// Cyrillic → Latin
.replace('Hello', 'Привет') // Becomes "Privet"
// Accented → Plain ASCII
.replace('Name', 'José García') // Becomes "Jose Garcia"
This uses any-ascii for transliteration.
WinAnsiEncoding (standard Latin text)MIT
FAQs
Find and replace text in PDF files with preserved formatting
We found that @transkripid/pdf-text-replace demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.