onepdfDocs
onepdf docs
Everything about onepdf: getting started, extraction, editing and pages, forms and signatures, PDF/A and PDF/UA, layout and generation, migrating from PdfPig, PDFsharp and QuestPDF, and the reference.
Extraction
Text and reading orderHow glyphs become words, lines and blocks, and the parameters that decide it. The code is in src/OnePdf/Text/Extraction/; every number below is a constant in LayoutParameters. Distances are in em of the glyphs concerned, so the analysis does not depend on the page scale. The…Extraction JSONThe JSON form of text extraction: glyphs, words, lines and blocks per page. It is written by PdfExtractionJson (ToJson, Write) and is meant to be compared byte for byte across implementations, so it is versioned and fully deterministic.
Editing and pages
Page operationsReorder, delete, insert, rotate and duplicate pages of a document; copy pages from other documents; merge documents; split one into several. All of it works on an editable document (PdfOpenOptions.AllowEditing, see writing.md) and is written with Save or SaveIncremental like…WritingDocuments open read-only by default. A document opened with PdfOpenOptions.AllowEditing = true can be changed and saved, in full or as an incremental update.Content creationA document opened with PdfOpenOptions.AllowEditing, or made with PdfDocument.CreateEmpty, can have content drawn onto its pages. The same builder makes new pages, stamps existing ones and writes reusable forms.RedactionPdfDocument.Redact removes what is drawn inside given areas of a page: the glyphs, the vector paths, the image samples, the annotations and form values under them, and (on request) metadata that repeats the text. It rewrites the content; nothing is hidden under a box. After…
Forms and signatures
FormsDocuments opened with PdfOpenOptions.AllowEditing = true can have their form fields filled and their annotations baked into the page. Both work with Save and SaveIncremental, and on encrypted documents (new objects are encrypted like the rest). Field scripts (/AA calculate…Appearance generationWhen an annotation has no usable normal appearance, page.Interpret builds one in memory and draws it through the same path as a stored /AP (ISO 32000-2 12.5.5). The same appearance is available as data from PdfAnnotation.GenerateAppearance(). Nothing is written to the document.Signature verificationOnePDF reads the signatures in a PDF as data and checks them. It never runs anything in the file and never touches a network: no certificate downloads, no OCSP or CRL fetches, no time-stamp requests. Verification is on demand; opening a document does no signature work.…
PDF/A and PDF/UA
PDF/AOnePDF writes PDF/A-2b, 2u, 2a, 3b, 3u and 3a (ISO 19005-2 and -3, on ISO 32000-1) from a full save, and checks documents against the requirements it can verify from the file's structure.PDF/UA and PDF/A level AOnePDF can write PDF/UA-1 (ISO 14289-1), PDF/UA-2 (ISO 14289-2, on PDF 2.0; see PDF/UA-2) and PDF/A-2a / 3a (ISO 19005-2 and -3, level A: tagged), alone or in one file, and can check a document against the requirements it is able to verify.Tagging existing PDFsThere are two layers. The happy path (PdfDocument.Tag) covers the common case: you say what each block is, OnePDF builds the structure the way the rules below describe, and each default is an option. The plan API underneath (CreateTaggingPlan, PdfTagElement, ApplyTagging)…
Layout and generation
LayoutOnePdf.Layout generates documents from code: you describe pages with nested delegates, it lays them out (shaped text, tables, lists, images, headers and footers, page numbers) and writes a tagged PDF through OnePDF's streaming writer, one page at a time. It ships as the…Layout textThe rules as built. The engine turns styled inline text into lines and draws them; it does not depend on the element tree (src/OnePdf.Layout/Paragraphs/), and the Text element is one client of it. Shaping, bidi and break data come from OneFont.SVG in layoutRecursiveAI.OnePdf.Layout draws SVG as native PDF vector content: paths, fills, strokes, shadings, clips, soft masks and real text. Nothing is rasterised except the pictures the SVG itself embeds. Core gains no SVG code; the code is in the layout package, over core's public…PDF fontsHow a font dictionary becomes glyphs. Code: src/OnePdf/Text/Fonts/. The font programs, CMaps and encodings underneath are in FontPrograms/ and FontData/.
Migrating
From PdfPigThis maps the PdfPig calls most programs use to their OnePDF equivalents. It is based on PdfPig's public documentation and README; check its docs for details of its behavior. OnePDF's API is smaller in some places and larger in others, so this is a map, not a drop-in replacement.From PDFsharpThis maps the PDFsharp calls most programs use to their OnePDF equivalents for opening, reading, changing, saving and page operations. It is based on PDFsharp's public documentation (docs.pdfsharp.net, version 6.x) and its published API reference; check those for details of…From QuestPDFOnePdf.Layout generates documents from code in the same style as QuestPDF: you describe pages with nested delegates, chain decorators on a place that holds one child, and fill it with text, a column, a table and so on. This guide maps the concepts a QuestPDF program uses to…
Reference
Reading and repair rulesHow OnePDF opens a file, and what it does when the file is damaged. Every repair adds a PdfDiagnostic (severity Warning, with object number and offset where known) to PdfDocument.Diagnostics. With PdfOpenOptions.Strict each of them throws PdfFormatException instead.…Display-list text formatThe text form of a PdfDisplayList (or of any interpretation, written straight from the interpreter). It is used for snapshot tests and is meant to be comparable across implementations: it is plain UTF-8 text, one record per line, with \n line ends. Any change to what is…ChangelogAll notable changes are listed here. The format follows Keep a Changelog and versions follow Semantic Versioning.