PDF Library Features
PDF Library Features
This page summarises the major feature areas in Aspose.PDF FOSS for Go. Each section links to dedicated developer-guide pages with complete code examples.
Document Management
Document is the central type. It supports opening (Open, OpenWithPassword),
creating (NewDocument), saving (Save), and operating on page collections
(Split, Append, Extract, PageCount). SetMetadata and Metadata provide
read/write access to XMP and Info dictionary fields.
doc, _ := pdf.Open("input.pdf")
pages, _ := doc.Split()
fmt.Printf("Split into %d pages\n", len(pages))Security and Encryption
EncryptionOptions configures password-based encryption in a single call to
Document.SetEncryption. Supported algorithms: AES-128 (default), AES-256
(ISO 32000-2 / PDF 2.0), and RC4-128. Permissions controls individual
operations — print, copy, accessibility — independently.
doc, _ := pdf.Open("doc.pdf")
doc.SetEncryption(pdf.EncryptionOptions{
UserPassword: "user",
OwnerPassword: "owner",
Permissions: &pdf.Permissions{AllowPrint: true},
})
doc.Save("doc_secured.pdf")AcroForm Processing
Document.Form returns a *Form providing access to all fields. Type
assertions expose the specific field types: TextBoxField, CheckboxField,
RadioButtonField, ComboBoxField, ListBoxField, and ButtonField.
Field values are written; appearances are regenerated automatically by PDF viewers.
doc, _ := pdf.Open("form.pdf")
text := doc.Form().Field("name").(*pdf.TextBoxField)
text.SetValue("Jane Doe")
doc.Save("form_filled.pdf")Table Layout
Table, Row, and Cell build grid layouts positioned on pages. BorderInfo
sets border styles per cell or for the whole table. MarginInfo sets padding.
TextStyle, Font, Color, HAlign, and VAlign control text presentation.
Bookmarks and Navigation
OutlineItemCollection represents a single bookmark. Configure title, bold/italic
style, link color, and destination (DestinationXYZ, DestinationFit,
DestinationFitH). Nested bookmarks build a chapter/section hierarchy.
NamedDestinations provides reusable page targets accessible by name.
Annotations
AnnotationCollection holds all annotations on a page. Available types include
TextAnnotation, FreeTextAnnotation, StampAnnotation, HighlightAnnotation,
LinkAnnotation, RedactAnnotation, InkAnnotation, LineAnnotation,
SquareAnnotation, and CircleAnnotation.
Image Handling
Image represents an embedded image resource. ImageInfo exposes dimensions and
color space. Images can be added to pages directly or embedded in table cells.
OptimizeImageOptions provides compression parameters for file size reduction.
API Reference Summary
| Type | Purpose |
|---|---|
Document | Core document container — open, create, save, split, merge |
Page | Single page access — size, annotations, content |
Form | AcroForm container — field enumeration and access |
Table | Grid layout element |
EncryptionOptions | Password and algorithm configuration |
Permissions | Per-operation access control flags |
OutlineItemCollection | Bookmark tree node |
AnnotationCollection | Page annotation container |
Metadata | XMP and Info dictionary read/write |
Image | Embedded image resource |