Verica 1.1.0

dotnet add package Verica --version 1.1.0
                    
NuGet\Install-Package Verica -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Verica" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Verica" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Verica" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Verica --version 1.1.0
                    
#r "nuget: Verica, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Verica@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Verica&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Verica&version=1.1.0
                    
Install as a Cake Tool

Verica

An all-in-one PDF + barcode toolkit for .NET 8 / 9 / 10.

Verica is a from-scratch, dependency-light managed PDF library: read, write, transform, secure, sign, OCR, redact, watermark, merge, split, fill forms, validate (PDF/A and PDF/UA), add headers/footers and hyperlinks, and convert HTML / Markdown / SVG to PDF. It also ships 25+ barcode formats (Code128, QR, DataMatrix, PDF417, Aztec, GS1, EAN/UPC, Postnet, Intelligent Mail).

No native binaries. No P/Invoke. Pure managed code.

<PackageReference Include="Verica" Version="1.0.0" />

Why Verica?

Capability Verica iText 7 PdfPig PDFsharp QuestPDF
License MIT AGPL/Commercial Apache 2.0 MIT MIT
Read PDF partial
Write PDF
Encryption RC4-128 + AES-V5 read partial RC4
Digital signatures ✅ (PAdES)
OCR ✅ (Tesseract)
HTML → PDF ✅ (subset) partial
Markdown → PDF
SVG → PDF partial partial
Headers/footers + logo manual
Hyperlinks read-only
Barcodes (25+) partial partial
PDF/A + PDF/UA validation
Native deps none none none none none
Multi-target net8.0/net9.0/net10.0 netstandard2.0 netstandard2.0 net6.0+ net6.0+

Feature matrix

Read & extract

  • Per-page plain text, layout-aware text (words / lines / blocks / columns), table extraction, image extraction (DCT / JPX / JBIG2 / CCITTFax pass-through), embedded files, bookmarks / outlines, page labels, annotations, AcroForm fields, structure tree (tagged PDF), optional content (layers), fonts, document info / metadata.
  • Export to structured JSON (good for AI / RAG ingestion) or Markdown (heading inference from font sizes).

Write & transform

  • Merge N PDFs, split by page range, rotate / reorder / delete / insert / resize / crop pages.
  • Watermark (text or JPEG image), page numbering ({page}/{total} templates), Bates numbering, N-up imposition.
  • Headers and footers with text in 6 regions (top/bottom × left/center/right) plus an optional JPEG logo.
  • Hyperlinks — clickable URL annotations and internal page jumps.
  • Annotations: add highlight / underline / strikeout / note / stamp; bulk filter / flatten / remove.
  • Redaction: black-box overlay or true text removal (rewrites Tj / TJ operators).
  • AcroForm: fill, flatten.
  • Document info editor (Title / Author / Subject / Keywords).
  • CMYK and RGB color in the content stream (SetFillColorCmyk, SetFillColor(int rgb)).
  • Image embedding: drop a JPEG onto a page in two lines via page.AddJpeg(doc, bytes, x, y, w, h).

Security & signatures

  • RC4-128 encryption (universal — works in every PDF viewer including iOS / Android browsers) and AES-V5 (AES-256) decryption.
  • PKCS#7 / CAdES signature validation (PAdES B / T-aware).
  • Add a digital signature with PdfSigner (incremental update); strip signatures with SignatureRemover.

Generators / converters

  • HTML → PDF (subset: h1-h6, p, ul/ol, strong, em, basic styling).
  • Markdown → PDF (CommonMark subset).
  • SVG → PDF (paths, transforms, styles).
  • Tagged PDF builder (accessibility-tagged from text elements).
  • Barcodes — see Verica.Barcodes.BarcodePng for 1-line PNG bytes generation.

Compliance

  • PDF/A (ISO 19005) conformance check.
  • PDF/UA accessibility check.

OCR

  • IOcrEngine interface with a shell-based Tesseract backend (language code is regex-validated to prevent shell injection).
  • High-level OcrService orchestrates rasterize → OCR → text reconstitution.

Quick start

1. Build a PDF from scratch

using Verica.Core;
using Verica.Fonts;

var doc = new PdfDocument();
var page = doc.AddPage(595, 842); // A4

var font = new PdfStandardFont("Helvetica");
var fontObj = font.Register(doc);
page.Resources.AddFont("F1", new PdfObjectRef(fontObj.ObjectNumber));

page.Content
    .BeginText()
    .SetFont("F1", 28)
    .MoveTextPosition(72, 740)
    .ShowText("Hello, Verica!")
    .EndText();

File.WriteAllBytes("hello.pdf", doc.Save());

2. Read text from any PDF

using Verica.Parsing;
using Verica.Parsing.ContentStream;

using var reader = new PdfDocumentReader(File.ReadAllBytes("input.pdf"));
foreach (var page in reader.Pages)
{
    var text = TextExtractor.Extract(page).GetPlainText();
    Console.WriteLine(text);
}

3. Merge PDFs

using Verica.Parsing;
using Verica.Parsing.Writing;

using var a = new PdfDocumentReader(File.ReadAllBytes("a.pdf"));
using var b = new PdfDocumentReader(File.ReadAllBytes("b.pdf"));
var merged = PdfMerger.Merge(new[] { a, b });
File.WriteAllBytes("merged.pdf", merged);

4. Watermark

using var src = new PdfDocumentReader(File.ReadAllBytes("input.pdf"));
var bytes = WatermarkService.AddTextWatermark(src, "DRAFT",
    fontSize: 96, grayLevel: 0.85, rotationDegrees: 45);
File.WriteAllBytes("watermarked.pdf", bytes);

5. Encrypt with a password

using Verica.Core;
using Verica.Security;

var doc = new PdfDocument();
// ... build content ...
PdfSecurityHandler.Apply(doc, new PdfSecurityOptions
{
    EnablePassword = true,
    UserPassword = "secret",
    AllowPrinting = true,
    AllowModification = false,
    AllowCopying = false,
});
File.WriteAllBytes("secured.pdf", doc.Save());

6. Page numbering — multi-format

using var src = new PdfDocumentReader(File.ReadAllBytes("doc.pdf"));
var bytes = PageNumberingService.Add(src,
    template: "Page {page} of {total} — {date}",
    position: PagePosition.BottomCenter,
    fontSize: 10,
    grayLevel: 0.3,
    margin: 36,
    pagePredicate: i => i > 0);  // skip page 0 (cover)
File.WriteAllBytes("numbered.pdf", bytes);

Templates support {page}, {total}, and {date} tokens. Position is one of: TopLeft, TopCenter, TopRight, BottomLeft, BottomCenter, BottomRight.

using var src = new PdfDocumentReader(File.ReadAllBytes("report.pdf"));
var stamped = HeaderFooterService.Apply(src, new HeaderFooterOptions
{
    TopLeft = "Acme Corp",                       // text regions
    TopRight = "{date}",
    BottomLeft = "Confidential",
    BottomCenter = "Page {page} of {total}",
    BottomRight = "v1.0",
    LogoJpegBytes = File.ReadAllBytes("logo.jpg"),  // optional logo (JPEG)
    LogoWidth = 80,
    FontSize = 9,
    GrayLevel = 0.4,
    SkipFirstPage = true,                          // cover-page friendly
});
File.WriteAllBytes("with_header_footer.pdf", stamped);

For SVG logos, convert them to a JPEG first via SvgToPdfConverter + a rasterizer, or use the SVG directly with a separate stamping pass. The LogoJpegBytes route is JPEG-only because Verica embeds JPEGs as a DCTDecode passthrough (no decode dependency).

using var src = new PdfDocumentReader(File.ReadAllBytes("doc.pdf"));
var withLink = LinkAnnotationService.AddUrlLink(src,
    pageIndex: 0,
    rect: new LinkAnnotationService.AnnotationRect(72, 700, 200, 30),
    url: "https://example.com");
File.WriteAllBytes("clickable.pdf", withLink);

Internal page jumps:

var withJump = LinkAnnotationService.AddInternalLink(src,
    pageIndex: 0,
    rect: new LinkAnnotationService.AnnotationRect(72, 700, 200, 30),
    targetPageIndex: 5);

9. Embed a JPEG image into a page

var doc = new PdfDocument();
var page = doc.AddPage(595, 842);
page.AddJpeg(doc, File.ReadAllBytes("photo.jpg"),
    x: 72, y: 500, width: 200, height: 200);
File.WriteAllBytes("with_image.pdf", doc.Save());

10. Digital signature

using Verica.Parsing.Signatures;

var signer = new PdfSigner();
var signed = signer.Sign(File.ReadAllBytes("contract.pdf"),
    new PdfSigningOptions
    {
        SignerName = "Alice",
        Reason = "Approved",
        Location = "Mumbai",
    });
File.WriteAllBytes("contract.signed.pdf", signed);

11. OCR a scanned PDF (requires Tesseract on the host)

using Verica.Parsing.Ocr;

var ocr = new OcrService(new TesseractShellOcrEngine(language: "eng+hin"));
foreach (var pageText in ocr.ExtractText(File.ReadAllBytes("scanned.pdf")))
    Console.WriteLine(pageText);

12. HTML / Markdown / SVG → PDF

File.WriteAllBytes("invoice.pdf",
    HtmlToPdfConverter.Convert("<h1>Invoice #42</h1><p>Total: <strong>$1,200</strong></p>"));

File.WriteAllBytes("notes.pdf",
    MarkdownToPdfConverter.Convert("# Notes\n\n- one\n- two\n"));

13. Barcodes — 1-line PNG bytes

using Verica.Barcodes;

var qrPng        = BarcodePng.QrToPng("https://verica.example");
var code128Png   = BarcodePng.Code128ToPng("HELLO-128");
var dataMatrixPng = BarcodePng.DataMatrixToPng("DM-DATA");
var aztecPng     = BarcodePng.AztecToPng("AZTEC");
var pdf417Png    = BarcodePng.Pdf417ToPng("PDF417 payload");

For full configuration (margins, colors, human-readable text, DPI), use the typed barcode classes (Code128Barcode, QrCode, DataMatrixBarcode, …) plus BarcodeGenerator.SavePng(barcode, filePath).

14. CMYK color (prepress)

page.Content
    .SetFillColorCmyk(0, 0.7, 0.9, 0.1) // warm orange
    .Rectangle(72, 700, 200, 50)
    .Fill();

15. Validate against PDF/A

using Verica.Parsing.Compliance;

using var src = new PdfDocumentReader(File.ReadAllBytes("doc.pdf"));
var result = PdfAValidator.Validate(src);
foreach (var issue in result.Issues)
    Console.WriteLine($"{issue.Severity}: {issue.Message}");

Supported standards

  • PDF 1.4 – 1.7 (ISO 32000-1)
  • PDF/A (ISO 19005) — validation
  • PDF/UA (ISO 14289) — validation
  • PAdES B / T signature profiles
  • PKCS#7 / CAdES detached signatures
  • Standard security handler /V 2 /R 3 (RC4-128 — write + read) and /V 5 /R 6 (AES-256 — read)

Architecture

Verica/
├── Core/             PdfDocument, PdfPage, PdfContentStream,
│                     PdfDictionary, PdfStream, image extensions
├── Tokens/           Tokenizer primitives for content streams
├── IO/               Byte-stream input abstraction
├── Reader/           Lightweight reader for incremental updates
├── Filters/          Stream codecs: Flate, ASCII85, ASCIIHex, LZW, RunLength,
│                     CCITTFax G3+G4, DCT (passthrough), JPX (passthrough),
│                     JBIG2 (passthrough), Crypt
├── Fonts/            Font registry, TrueType parser/subsetter, ToUnicode CMaps
├── Images/           PNG decoder, JPEG embedder
├── Svg/              SVG path / transform / style → PDF
├── Security/         Password hashing, RC4 engine, permission flags,
│                     PdfSecurityOptions
├── Parsing/
│   ├── PdfDocumentReader   top-level reader
│   ├── ContentStream       text + layout + tables + JSON + Markdown export
│   ├── Forms               AcroForm read / fill / flatten
│   ├── Annotations         read + add (highlight, note, stamp, ...)
│   ├── Bookmarks           outline tree
│   ├── PageLabels
│   ├── EmbeddedFiles
│   ├── StructureTree       tagged-PDF structure
│   ├── OptionalContent     layers
│   ├── Security            /Encrypt parsing + RC4 + AES-V5 decryption
│   ├── Signatures          read + validate + sign + remove
│   ├── Fonts               Type0 / Type1 / TrueType / Type3 / MMType1
│   ├── Images              decode Image XObjects
│   ├── Compliance          PDF/A + PDF/UA validators
│   ├── Ocr                 IOcrEngine + Tesseract shell backend
│   ├── Diff                structural diff (text + form fields)
│   └── Writing             Merger, Splitter, PageOps, Watermark, Redaction,
│                           NupImposer, PageNumbering, BatesNumbering,
│                           HtmlToPdf, MarkdownToPdf, FormFlattener,
│                           DocumentInfoEditor, AnnotationService,
│                           HeaderFooterService, LinkAnnotationService
├── Barcodes/         25+ formats: Code128, QR, DataMatrix, PDF417, Aztec,
│                     GS1, EAN/UPC, Postnet, Intelligent Mail, ...
│                     plus BarcodePng for 1-line byte[] outputs.
└── DependencyInjection/ AddVerica() extension for IServiceCollection

351 public types across 41 namespaces. Multi-targeted: net8.0, net9.0, net10.0.


License

MIT — see LICENSE.

Acknowledgements

The PDF object model and content-stream parser are derived from the public ISO 32000-1 specification. The Reed-Solomon and matrix-placement code in the barcode subsystem is implemented from the relevant ISO/IEC standards (16022 for DataMatrix, 18004 for QR, 24778 for Aztec, 15438 for PDF417). No third-party PDF or barcode libraries are linked.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 99 5/12/2026
1.0.0 132 5/9/2026

v1.1.0 — Added fluent PdfBuilder, async services with CancellationToken across reading / transforming / annotating / securing / forms / conversion / compliance, Stream overloads, unified PdfOperationResult, PageRangeParser ("1-3,5,7-9"), ILogger<T> integration, services.AddVerica() DI registration, and PdfDrawioConverter (raw/compressed .drawio, .drawio.svg, and PNG-with-mxfile). Removed OCR (Tesseract) and Barcode modules — for OCR use a dedicated OCR library; for barcodes use a dedicated barcode library.