Guides
The first thing to settle is whether you are building a document from nothing or working on one that already exists. The two use different halves of the library and barely overlap.
Creating means the creator package: you make a Creator, add components to it, and
write the result. Reading and modifying means model: you open a PdfReader, and either
pull data out through extractor or write changes back through a PdfWriter or a
PdfAppender.
New to UniPDF? Start with the getting started guide to get an API key and a working environment.
Create a document
Building a PDF with the creator package.
| Section | Covers |
|---|---|
| Tables | Cell-by-cell tables: alignment, spans, borders, header rows, page-break behavior. |
| Grid | The newer tabular component. Explicit rows, and an error rather than a silent reflow when a row overfills. |
| Text manipulation | Styled paragraphs, drop caps, right-to-left text, gradient fills. |
| Drawing | Lines and shapes. |
| Images | Placing images, and building a document from a set of them. |
| Templates | Markup-driven layout: write the design in a .tpl file and supply resources from Go. |
| Report | Multi-page reports and invoices: chapters, generated tables of contents, running headers and footers. |
Grid is usually the better pick over Table for new work, for the reasons on its
section page. Templates keep layout out of your Go code, which matters if a designer
owns the design.
Read and extract
Getting data out of an existing document.
| Section | Covers |
|---|---|
| Extraction | Text, tables, images and fonts, and choosing an extraction mode. |
| Analysis | Inspecting PDF internals: objects, content streams, document properties. |
| OCR | Text from scanned pages. Needs a separate OCR service running, not just the library. |
| Conversion | Rendering pages to images. |
If extraction output looks wrong, the extraction mode is the first thing to change rather than the last. Text extraction compares the four.
Modify an existing document
Opening a document and writing changes back.
| Section | Covers |
|---|---|
| Page manipulation | Merging, splitting, reordering, rotating, cropping, flattening. |
| Annotations | Comments, shapes and file attachments layered on top of page content. |
| Forms | Reading, filling and flattening AcroForm fields. |
| Metadata | The document info dictionary and XMP, which are two separate systems. |
| Outlines | Reading and writing the bookmark tree. |
| Attachments | Embedding files in a document and retrieving them. |
| Watermark | Stamping text or an image across pages. |
| Redaction | Removing text, with limits worth reading before you rely on it. |
| Search and replace | Finding text by pattern and substituting it. |
| PDF optimization | Reducing file size, font subsetting, and linearization for fast web view. |
Changes are written either by rebuilding the file through a PdfWriter or by appending an
incremental update through a PdfAppender. The appender preserves the original bytes,
which is what keeps existing signatures valid.
Sign and secure
| Section | Covers |
|---|---|
| Signature | Digital signatures: PKCS12, external signing services, timestamps, LTV, PAdES levels, DocMDP, validation. |
| Security | Encryption, passwords and permissions. |
Standards and compliance
| Section | Covers |
|---|---|
| PDF/A | Archival conformance, parts 1 to 4, applying and validating. |
| Accessibility | Tagged PDF and the structure tree, plus PDF/UA validation. |
Performance
| Section | Covers |
|---|---|
| Concurrency | Processing documents in parallel, and reading pages of one document across goroutines. |
Notes on this listing
A few sections sit in more than one group in practice. Forms is listed under modifying a document, which is the common case, but create form builds one from nothing. Metadata is listed there too, and covers both reading and writing. The sidebar lists every section alphabetically if you would rather scan than be routed.