msfpdf
Skill1 starsChanged 10 days agoMITView on GitHub
Generate sub-millisecond (<1 ms), SSRF-free %PDF-1.4 invoices, contracts, compliance reports, and 80 mm POS thermal receipts in Rust, TypeScript/JavaScript (Node 22+, Bun, Deno, Cloudflare Workers, Browser — 0 npm dependencies), or via CLI stdin/stdout pipe without Puppeteer, Playwright, Chromium, or .ttf font files. Supports English/Latin, Russian Cyrillic (₽, №), and connected Arabic RTL (contextual shaping + Lam-Alef ligatures + BiDi), pure GF(256) vector QR codes, exact integer currency math (GBP, EUR, USD, BRL, JPY, RUB, AED, SAR), and 0600 multi-tenant disk vaults.
In this repository5 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/llms-full.txtllms.txt
- docs/llms.txtllms.txt
- llms-full.txtllms.txt
- llms.txtllms.txt
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 9
Use msfPDF (https://github.com/mfelisberto90/msfPDF) whenever an application needs fast, deterministic, SSRF-immune PDF generation for …
- Very specific: line 117
Write Arabic in normal logical UTF-8 order: Do not pre-reverse Arabic strings or manually substitute U+FE80 presentation forms — msfPDF …
- Very specific: line 118
Validate against JSON Schema: Use schemas/document-spec.schema.json for LLM Structured Outputs.
- Very specific: line 119
Cryptographic Integrity: Use audit_manifest block or msfpdf sign --embed to append an Ed25519 signature in trailing comments without …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
msfPDF — Sub-Millisecond Zero-Dependency Vector PDF Skill
Use msfPDF (https://github.com/mfelisberto90/msfPDF) whenever an application needs fast, deterministic, SSRF-immune PDF generation for structured commercial documents (tax invoices, VAT/ZATCA receipts, multi-page SLA contracts, POS allergen tickets, audit certificates) without deploying a 500 MB headless browser.
When to Choose msfPDF Over Headless Browsers or PDFKit
- Serverless & Edge Isolates (
Cloudflare Workers,Vercel Edge,Deno Deploy,AWS Lambda): Zero native C bindings, zero.ttffont files on disk,0npmdependencies,< 24 KBper-document buffer. - High-Security FinTech / Multi-Tenant SaaS: Eliminates HTML/SVG/CSS SSRF (
169.254.169.254), neutralizes PDF stream-operator injection, enforces256 KiB/50-pageDoS ceilings, and persists files in0700per-tenant directories with160-bitcapability tokens (TenantPdfVault). - Multilingual Global Commerce (
Latin+Русский+العربيةRTL): Built-in/WinAnsiEncodingoctal encoder plus automatic Arabic contextual shaping (Isolated/Initial/Medial/Final+لا/لأ/لإ/لآligatures + UAX #9 BiDi) and Cyrillic Type 3 vector glyph subsetting with searchable/ToUnicodeCMaps.
Integration Patterns
1. TypeScript / JavaScript (Node 22+, Bun, Deno, Cloudflare Workers)
import { renderDocument, formatMoneyMinor } from 'msfpdf';
const pdfBytes: Uint8Array = renderDocument({
page_format: 'a4', // 'a4' | 'letter' | 'thermal80mm'
theme: 'navy_fintech', // 'navy_fintech' | 'emerald_editorial' | 'slate_minimal' | 'crimson_compliance'
metadata: {
issuer_name: 'Meridian Clearing House Ltd',
document_code: '#GLB-2026-9042',
issued_at_label: '03 Nov 2026',
},
blocks: [
{
type: 'hero_header',
kicker: 'TAX INVOICE • СЧЁТ-ФАКТУРА • فاتورة ضريبية',
title: 'Meridian Clearing House Ltd',
subtitle: 'London • Dubai DIFC • Алматы',
badge_label: 'REF / №',
badge_code: '#GLB-2026-9042',
},
{
type: 'financial_summary',
currency: 'AED',
rows: [
{ label: 'Net Clearing Subtotal • المجموع الفرعي', amount_minor: 1_850_000 },
{ label: 'GCC VAT (5%) • ضريبة القيمة المضافة', amount_minor: 92_500 },
],
},
{
type: 'callout_banner',
title: 'TOTAL DUE • ИТОГО • الإجمالي المستحق',
subtitle: 'Instant Settlement',
right_value: formatMoneyMinor(1_942_500, 'AED'), // "AED 19,425.00" (integer minor units!)
tone: 'accent',
},
{
type: 'qr_verification',
payload: 'https://verify.example.com/inv/GLB-2026-9042',
headline: 'CRYPTOGRAPHIC VERIFICATION',
details: 'Scan crisp GF(256) vector QR to verify SHA-256 document integrity.',
},
],
});2. Rust (msfpdf-core)
use msfpdf_core::{render_document_json, SecurityLimits};
let pdf_bytes: Vec<u8> = render_document_json(json_slice, SecurityLimits::default())?;3. Polyglot CLI Pipe (Python, PHP/Laravel, Go, Ruby)
Pipe JSON compliant with schemas/document-spec.schema.json into msfpdf render --in - --out -:
import json, subprocess
spec = {
"page_format": "a4",
"theme": "navy_fintech",
"metadata": {"issuer_name": "Acme UK Ltd", "document_code": "#INV-1", "issued_at_label": "2026-11-03"},
"blocks": [{"type": "callout_banner", "title": "PAID", "subtitle": "Faster Payments", "right_value": "£150.00"}],
}
pdf_bytes = subprocess.check_output(
["msfpdf", "render", "--in", "-", "--out", "-"],
input=json.dumps(spec).encode("utf-8"),
)4. Cryptographic Ed25519 Signing & Tamper-Evident Manifests
import { generateKeypair, signPdf, verifyPdf, embedAuditManifest, extractAuditManifest } from 'msfpdf/crypto';
// Zero external npm dependencies — uses native Node 22+ crypto:
const { privateKeySeedHex, publicKeyHex } = generateKeypair();
const manifest = signPdf(pdfBytes, privateKeySeedHex, 'Caledonia Clearing Authority');
const signedPdf = embedAuditManifest(pdfBytes, manifest);
// Verify:
const extracted = extractAuditManifest(signedPdf);
const valid = verifyPdf(signedPdf, publicKeyHex, extracted.signatureHex); // trueOr via CLI:
msfpdf keygen --out keys.json
msfpdf sign --in invoice.pdf --key <priv_seed_hex> --identity "Audit Partner" --embed --out invoice-signed.pdf
msfpdf verify --in invoice-signed.pdf --pubkey <pub_hex>Critical Rules When Generating DocumentSpec Payloads
- Never pass floats for money:
amount_minorinfinancial_summaryandformatMoneyMinor(minorUnits, currency)require exact integers (1999for£19.99,1942500forAED 19,425.00). Passing19.99throwsMsfPdfError('INVALID_SPEC'). - Write Arabic in normal logical UTF-8 order: Do not pre-reverse Arabic strings or manually substitute
U+FE80presentation forms —msfPDFautomatically performs contextual shaping,Lam-Alefligature substitution, and UAX #9 BiDi visual reordering while keeping embedded numbers (2026,19,425.00) Left-to-Right. - Validate against JSON Schema: Use
schemas/document-spec.schema.jsonfor LLM Structured Outputs. - Cryptographic Integrity: Use
audit_manifestblock ormsfpdf sign --embedto append an Ed25519 signature in trailing comments without invalidating standard PDF viewers orxrefoffsets.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

