Documentation
¶
Overview ¶
Convert and verify PDF files for PDF/A conformance.
Index ¶
- Constants
- Variables
- type Check
- type ConvertResult
- type Document
- func (d *Document) ClaimedConformance() (part, conformance string, err error)
- func (d *Document) Close() error
- func (d *Document) Convert(p *Profile) (ConvertResult, error)
- func (d *Document) GetMetadata() (map[string]string, error)
- func (d *Document) GetPageCount() (int, error)
- func (d *Document) GetVersion() (string, error)
- func (d *Document) IsPDFA() (bool, error)
- func (d *Document) Verify(p *Profile) (Result, error)
- func (d *Document) XMPMetadata() ([]byte, error)
- type FileResult
- type LevelType
- type PDFError
- type Profile
- type Result
Constants ¶
const ( A_1B = pdf.A_1B Undefined = pdf.Undefined )
PDF/A conformance levels.
Variables ¶
var ( // PDFA_1B is the canonical PDF/A-1b profile PDFA_1B = pdf.PDFA_1B // Legacy_1B is stricter in some areas and compatible with the original Isartor PDF/A-1b test suite. Legacy_1B = pdf.Legacy_1B )
PDF/A profiles.
var Checks = pdf.Checks
Checks is the registry of every selectable PDF/A check, grouped by area.
Functions ¶
This section is empty.
Types ¶
type Check ¶
func AllChecks ¶
func AllChecks() []Check
AllChecks returns every registered check with its name, description, and clause number.
func CheckByClause ¶
CheckByClause looks up the registered check for a specific (clause, subclause) pair.
func ChecksForClause ¶
func ChecksForClause(clause string) []Check
ChecksForClause returns every registered check under the given clause.
type ConvertResult ¶ added in v0.2.0
type ConvertResult = convert.ConvertResult
func Convert ¶ added in v0.2.0
Convert reads the PDF at path and attempts to produce a PDF/A-1b conformant rewrite.
func ConvertBytes ¶ added in v0.2.0
ConvertBytes is Convert for an in-memory PDF.
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
Document represents an open PDF file.
func (*Document) ClaimedConformance ¶
ClaimedConformance returns the PDF/A part and conformance level the document's XMP metadata claims, read from the pdfaid namespace. This reflects what the file claims, not whether it actually validates — use Verify or IsPDFA to check actual compliance.
func (*Document) Convert ¶ added in v0.2.0
Convert converts d, an already-open document, attempting to produce a PDF/A-1b conformant rewrite.
func (*Document) GetMetadata ¶
GetMetadata extracts info from the Info dictionary.
func (*Document) GetPageCount ¶
GetPageCount retrieves the page count.
func (*Document) GetVersion ¶
GetVersion extracts the PDF version from the document header.
func (*Document) IsPDFA ¶
IsPDFA reports whether the document is valid PDF/A-1b. It is equivalent to calling Verify(PDFA_1B) and checking the result's Valid field.
func (*Document) XMPMetadata ¶
XMPMetadata returns the document's raw XMP metadata packet (Root/Metadata), decoded and normalised to UTF-8. It returns an error if the document has no XMP metadata stream.
type FileResult ¶
type FileResult[T any] = pdf.FileResult[T]
func ConvertAll ¶ added in v0.2.0
func ConvertAll(paths []string, p *Profile) ([]FileResult[ConvertResult], error)
ConvertAll opens, converts, and closes a batch of files concurrently.
type Profile ¶
func NewProfile ¶
func NewProfile(level LevelType) *Profile
NewProfile returns an empty profile for the given conformance level.
Directories
¶
| Path | Synopsis |
|---|---|
|
benchmarks
|
|
|
cmd/gopdfrab-bench
command
Command gopdfrab-bench drives the gopdfrab library for benchmarking against other PDF/A verifiers (veraPDF, PDFBox Preflight, a JS validator).
|
Command gopdfrab-bench drives the gopdfrab library for benchmarking against other PDF/A verifiers (veraPDF, PDFBox Preflight, a JS validator). |
|
internal
|
|
|
convert
Package-level pipeline for converting an arbitrary PDF into a PDF/A-1b rewrite:
|
Package-level pipeline for converting an arbitrary PDF into a PDF/A-1b rewrite: |
|
Command wasm is a syscall/js thin wrapper around gopdfrab that exposes VerifyBytes and ConvertBytes as awaitable JavaScript functions registered on the global object.
|
Command wasm is a syscall/js thin wrapper around gopdfrab that exposes VerifyBytes and ConvertBytes as awaitable JavaScript functions registered on the global object. |