商业产品,运行需 license code,需在 cloud.unidoc.io 注册获取(免费层有计量 API Key);仅支持最近三个 Go 版本;示例代码在单独的 unipdf-examples 仓库,需另行获取
unipdf
unidoc活跃维护纯 Go 实现的 PDF 库,能在服务端生成、读取、编辑、压缩和签名 PDF 文件,适合在 Go 项目里直接集成文档处理能力。
Golang PDF library for creating and processing PDF files (pure go)
纯 Go 编写的商业 PDF 库,用于创建、读取和处理 PDF 文件
纯 Go 实现的 PDF 库,能在服务端生成、读取、编辑、压缩和签名 PDF 文件,适合在 Go 项目里直接集成文档处理能力。
核心能力
- 创建 PDF 报告、表格和发票
- 合并、拆分、旋转页面并调整页序
- 提取文本及字号、位置和格式信息
- 提取图片、图片转 PDF、加水印
- 表单创建、填写、扁平化及 FDF 合并
容易踩的坑
- v5.2.0最新正式版2026-10-20 · 2026-10-20 08:25 UTC
Release notes - UniPDF v5.2.0
This release contains new features, improvements and bug fixes.
New Features
- US-1563 US-1566 US-1567 US-1568 Complete shading rendering support: function-based (Type 1), Gouraud triangle mesh (Types 4 and 5) and Coons / tensor-product patch mesh (Types 6 and 7) shadings, plus
Creator.NewFunctionBasedGradientfor authoring function-based gradients - US-1564 US-1565
PdfFunctionType3.Evaluatefor stitching functions and a generic shading color sampler for all function types and colorspaces - US-1569 Rendering of Type 1 tiling patterns
- US-1614 Rendering of the separable blend modes and non-isolated transparency group compositing
- US-1773 Rendering of
ExtGStatesoft masks, fixing axial ICCBased Multiply shadings rendering too dark, withmodel.NewPdfFunctionFromPdfObjectnow exported - US-1907 US-1908 Reading documents encrypted with the public-key security handler (
Adobe.PubSec) viaReaderOpts.Certificate/PrivateKey,PdfReader.DecryptWithCertificateandPdfReader.CheckAccessRightsWithCertificate - US-1909 US-1910 Encrypting documents for recipient certificates via
PdfWriter.EncryptForRecipients - US-1769 Template engine:
creator.ParseTemplatereturning a reusableParsedTemplate, rendered or validated withCreator.RenderTemplate/ValidateTemplate, plus named styles (<style>and theclassattribute) and typography inheritance - US-1772
Block.SetBackgroundandChapter.SetBackground, and page breaks inside aDivision, also available in templates - US-1779
SignatureValidationResult.CertificatesandSignatureValidationResult.SignerCertificatefor accessing certificate details - US-1814 FDF export of form field data from a PDF with
fdf.NewFromReader,fdf.NewFromFormandData.Write/WriteToFile, plusPdfAcroForm.AllFieldValues - US-1722 Form-field appearance generation for push buttons and signature fields with explicit clipping, and
PdfAppender.SignWithAppearance
Improvements
- US-1613 The
shoperator shading fill now covers the clip region and honours axial/radialExtend - US-1717 The renderer honour the transparency group colorspace, isolation and knockout, so groups with a DeviceCMYK group colorspace no longer render nothing
- US-1718 Replaced the Multiply blend mode alpha hack with real per-primitive compositing, adding the non-separable blend modes (Hue, Saturation, Color, Luminosity)
- US-1807 Template strict mode reports a missing data key by name
- US-1929 Upgraded
github.com/unidoc/pkcs7to v0.4.1, hardening BER-to-DER conversion against malformed and truncated input - US-1945 Upgraded
golang.org/x/image,x/text,x/cryptoandx/netto fix reachable advisories
Bug Fixes
- US-1774 Fixed
GetPreviousRevisionand DocMDP revision secti
- US-1563 US-1566 US-1567 US-1568 Complete shading rendering support: function-based (Type 1), Gouraud triangle mesh (Types 4 and 5) and Coons / tensor-product patch mesh (Types 6 and 7) shadings, plus
- v5.1.02026-09-10 · 2026-09-10 16:10 UTC
查看更新说明
Release notes - UniPDF v5.1.0
This release contains new features, improvements and bug fixes.
New Features
- US-1728
creator.SetDefaultFontfor overriding the default fonts - US-1738
creator.Imagemasks: soft, stencil and color-key masking, with alpha optimization - US-1753 Signature coverage reporting on
SignatureValidationResult - US-1753
PdfParser.RevisionEndOffsetsandPdfParser.Sizefor locating document revision boundaries - US-1767 US-1768 Template engine strict mode via
TemplateOptions.Strict - US-1721
PageText.FormContentsfor extracting text found inside Form XObjects - US-1603
PdfFont.ShapeTextand thetextencoding.ShapedGlyphRegistryinterface - US-1703 veraPDF PDF/A corpus parity test and an opt-in Isartor corpus test
Improvements
- US-1720 US-1733 Extended sanitizer coverage to embedded files, form-data actions and multimedia actions
- US-1683 Faster PDF/UA validation by parsing each page's content stream once per validation
- US-1680 Owner-aware layout attributes and ClassMap attribute resolution in the PDF/UA verifier
- US-1681 PDF/UA structure walks now look through
NonStruct,DivandPartwrappers - US-1687 PDF/UA font checks extended to annotation appearances, Type3
CharProcsand tiling patterns - US-1661 Consolidated the render alpha buffer pool onto
core.AcquireBytes/ReleaseBytes - US-1732 Updated the minimum supported Go version to 1.25.0
- US-1682 More stable golden-file comparison in the end-to-end test harness
Bug Fixes
- US-1666 Removed remaining PDF/UA verifier false positives for table regularity and XFA forms
- US-1667 Fixed PDF/UA verifier rules that misfire or under-report against veraPDF
- US-1682 Fixed the XMP rule cascade reported when the catalog has no
/Metadatastream - US-1703 Fixed XMP verifier gaps in packet encoding, schema matching and property value types
- US-1684 Fixed PDF/A font embedding for TrueType Collection substitutes and standard-14 base names
- US-1603 Fixed ligatures and contextual forms being dropped by font subsetting
- US-1727 Fixed font attributes with whitespace failing to resolve from the
FontMap - US-1767 Template data is now escaped on interpolation, with further template processor fixes
- US-1730 Fixed Flate-compressed
/JBIG2Globalsstreams failing to parse - US-1726 Fixed the xref repair regression for tables whose subsection numbering is shifted
- US-1721 Fixed the redactor silently skipping matches inside Form XObjects
- US-1751 Fixed
Editor.Replacetruncating replacement text longer t
- US-1728
- v5.0.02026-07-31 · 2026-07-31 13:15 UTC
查看更新说明
Release notes - UniPDF v5.0.0
This release contains new features, improvements and bug fixes.
New Features
- US-648 PDF linearization (Fast Web View) support: linearized writer, hint stream generation and
optimize.Linearizeconvenience API - US-1520 Linearization validator to verify Fast Web View compliance of PDF files
- US-1607 PDF/UA-1 (ISO 14289-1) validation and automatic compliance fixes via the new
pdfuapackage - US-1609 PDF/UA-2 (ISO 14289-2) validation and apply profile
- US-1610 PDF/UA-2 namespace-aware automatic tagging in the creator
- US-1606 PDF 2.0 structure namespaces support in the model
- US-1605 US-1618
pdfuaidXMP namespace support, includingpart/revandamd/corridentifiers - US-1549 ICC colorspace support
- US-1447 ICC color profile preservation when embedding images
- US-1504 Transparency groups with Multiply blend mode support
- US-1548 Color gradient support for
StyledParagraph - US-1629 List-box (choice field) appearance generation in the annotator
- US-1539
Direct()andEquals()methods for thePdfObjectinterface - US-1556 Opt-in writer
SkipObjectCopyfast path that skips the defensive deep copy of the source object graph
Improvements
- US-1507 Refactored the parser/reader I/O layer from
io.ReadSeekertoio.ReaderAt, enabling safer concurrent reads - US-1536 Typed
PdfColorinterface instead of the empty interface - US-1541 Charcode/GID/rune separation in font handling for more correct text encoding
- US-1537 Exposed content types and fields for
StyledParagraph,GridandTable - US-1598 Faster text rendering with a glyph cache and blit fast path
- US-1597 Reduced render allocations with buffer pools and font-face caching
- US-1601 Bold/italic style matching when falling back to system fonts
- US-1611 Improved handling of long table cell content, including splitting of oversized row-spanning cells
- US-1561 Improved radial shading fill by omitting the bounding box that clipped the fill to the disc
- US-1631 All PDF date fields after the 4-digit year are now optional in
ParsePdfTime - US-1604 Replaced the unmaintained
go-xmplibrary with a maintained fork - US-1571 Replaced the archived
gorilla/i18ndependency with the internallinebreakpackage - US-1637 US-1672 Aligned the PDF/UA verifier with veraPDF and added a veraPDF validation test corpus
Bug Fixes
- US-648 PDF linearization (Fast Web View) support: linearized writer, hint stream generation and
- v4.11.02026-07-03 · 2026-07-03 10:30 UTC
查看更新说明
Release notes - UniPDF v4.11.0
This release contains improvements and bug fixes
Improvements
- US-1571 Replaced archived https://github.com/gorilla/i18n dependency with maintained fork
Bug Fixes
- US-1629
GenerateAppearanceDictnot generating appearances for list-box (non-combo) choice fields fix - US-1631 NewPdfDate rejecting spec-valid dates that omit optional fields after the year (e.g. D:20260619, D:2026) fix
- US-1504 transparency groups and ExtGState blend modes not being honored when rendering PDF to image, causing overlays to drop out fix
- US-1546 MultiCell with rowspan > 1 causes broken cross-page rendering fix
- US-1611 Hang when table cells contain long content without row wrapping enabled fix
- US-1612 Renderer producing garbled or blank output for some embedded fonts fix
- v4.10.02026-05-27 · 2026-05-27 13:08 UTC
查看更新说明
Release notes - UniPDF v4.10.0
This release contains new features, improvements, and bug fixes
New Features
- US-1358 High level function for
PdfField.GetProperties()to get the form field properties - US-1423 Capability to access Chapter info from header/footer generator
- US-1438 Text extraction grid mode
Improvements
- US-1468 Add line height as a property of
TextChunk - US-1416 Make PDF font subset prefix deterministic to ensure reproducible output
- US-1398 Improve benchmark CI to auto-trigger in a release PR
Performances
- US-1384 PERF-02: Upgrade PdfObjectDictionary to sync.RWMutex
- US-1405 PERF-04: Use existing buffer pool in parser hot paths
- US-1406 PERF-05: Pool image decode buffers in encoders
- US-1409 PERF-08: Fix O(n²) removeWord in text extractor
- US-1433 PERF-12: Persist font cache across pages in renderer
- US-1463 PERF-15: Eliminate copyObjects() in PdfWriter
- US-1464 PERF-16: Optimize PdfAppender change detection
- US-1465 PERF-17: Streaming filter pipeline in core/encoding.go
- US-1466 PERF-18: Deduplicate streams during merge
- US-1436 PERF-20: Replace pixel loop in Image.Crop() with draw.Draw
Bug Fixes
- US-1383 PERF-01: PdfObjectDictionary.Remove() Race Condition fix
- US-1395 Fix and extend PDF object comparison methods
- US-1419 Benchmark CI ran every time the PR has new comment fix
- US-1420 Logging could causes huge memory usages fix
- US-1446 Renderer panics with index out of range on a PDF with a subsetted embedded font fix
- US-1453 Undetected regression in text shaping result fix
- US-1484 US-1444 mis-renders embedded TrueType subset fonts whose only cmap subtable is on Unicode platform 0 (PID=0) fix
- US-1358 High level function for
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
UniPDF - PDF for Go
UniDoc UniPDF is a PDF library for Go (golang) with capabilities for creating and reading, processing PDF files. The library is written and supported by FoxyUtils.com, where the library is used to power many of its services.
Features
- Create PDF reports. Example output: unidoc-report.pdf.
- Table PDF reports. Example output: unipdf-tables.pdf.
- Invoice creation
- Styled paragraphs
- Merge PDF pages
- Split PDF pages and change page order
- Rotate pages
- Extract text from PDF files
- Text extraction support with size, position and formatting info
- PDF to CSV illustrates extracting tabular data from PDF.
- Extract images with coordinates
- Images to PDF
- Add images to pages
- Compress and optimize PDF
- Watermark PDF files
- Advanced page manipulation: Put 4 pages on 1
- Load PDF templates and modify
- Form creation
- Fill and flatten forms
- Fill out forms and FDF merging
- Unlock PDF files / remove password
- Protect PDF files with a password
- Digital signing validation and signing
- CCITTFaxDecode decoding and encoding support
- JBIG2 decoding support
Multiple examples are provided in our example repository https://github.com/unidoc/unipdf-examples.
Contact us if you need any specific examples.
Installation
With modules:
go get github.com/unidoc/unipdf/v5
License key
This software package (unipdf) is a commercial product and requires a license code to operate.
To Get a Metered License API Key in for free in the Free Tier, sign up on https://cloud.unidoc.io
How can I convince myself and my boss to buy unipdf rather using a free alternative?
The choice is yours. There are multiple respectable efforts out there that can do many useful things.
In UniDoc, we work hard to provide production quality builds taking every detail into consideration and providing excellent support to our customers. See our testimonials for example.
Security. We take security very seriously and we restrict access to github.com/unidoc/unipdf repository with protected branches and only the founders have access and every commit is reviewed prior to being accepted.
The profits are invested back into making unipdf better. We want to make the best possible product and in order to do that we need the best people to contribute. A large fraction of the profits made goes back into developing unipdf. That way we have been able to get many excellent people to work and contribute to unipdf that would not be able to contribute their work for free.
Contributing
If you are interested in contributing, please contact us.
Go Version Compatibility
We support three latest Go versions.
Support and consulting
Please email us at [email protected] for any queries.
If you have any specific tasks that need to be done, we offer consulting in certain cases. Please contact us with a brief summary of what you need and we will get back to you with a quote, if appropriate.
License agreement
The use of this software package is governed by the end-user license agreement (EULA) available at: https://unidoc.io/eula/