HomeUniDoc
...

Package pdfa

Overview ▾

Package pdfa provides abstraction to optimize and verify documents with respect to the PDF/A standards. NOTE: This implementation is in experimental development state.

Keep in mind that it might change in the subsequent minor versions.

func Validate

func Validate(d *model.CompliancePdfReader, profile Profile) error

Validate checks if provided input document reader matches given PDF/A profile.

type Profile

Profile is the model.StandardImplementer enhanced by the information about the profile conformance level.

type Profile interface {
    model.StandardImplementer
    Conformance() string
    Part() int
}

type Profile1A

Profile1A is the implementation of the PDF/A-1A standard profile. Implements model.StandardImplementer, Profile interfaces.

type Profile1A struct {
    // contains filtered or unexported fields
}

func NewProfile1A

func NewProfile1A(options *Profile1Options) *Profile1A

NewProfile1A creates a new Profile1A with given options.

func (*Profile1A) ApplyStandard

func (p *Profile1A) ApplyStandard(document *docutil.Document) (err error)

ApplyStandard tries to change the content of the writer to match the PDF/A-1 standard. Implements model.StandardApplier.

func (*Profile1A) Conformance

func (p *Profile1A) Conformance() string

Conformance gets the PDF/A conformance.

func (*Profile1A) Part

func (p *Profile1A) Part() int

Part gets the PDF/A version level.

func (*Profile1A) StandardName

func (p *Profile1A) StandardName() string

StandardName gets the name of the standard.

func (*Profile1A) ValidateStandard

func (p *Profile1A) ValidateStandard(r *model.CompliancePdfReader) error

ValidateStandard checks if provided input CompliancePdfReader matches rules that conforms PDF/A-1 standard.

type Profile1B

Profile1B is the implementation of the PDF/A-1B standard profile. Implements model.StandardImplementer, Profile interfaces.

type Profile1B struct {
    // contains filtered or unexported fields
}

func NewProfile1B

func NewProfile1B(options *Profile1Options) *Profile1B

NewProfile1B creates a new Profile1B with the given options.

func (*Profile1B) ApplyStandard

func (p *Profile1B) ApplyStandard(document *docutil.Document) (err error)

ApplyStandard tries to change the content of the writer to match the PDF/A-1 standard. Implements model.StandardApplier.

func (*Profile1B) Conformance

func (p *Profile1B) Conformance() string

Conformance gets the PDF/A conformance.

func (*Profile1B) Part

func (p *Profile1B) Part() int

Part gets the PDF/A version level.

func (*Profile1B) StandardName

func (p *Profile1B) StandardName() string

StandardName gets the name of the standard.

func (*Profile1B) ValidateStandard

func (p *Profile1B) ValidateStandard(r *model.CompliancePdfReader) error

ValidateStandard checks if provided input CompliancePdfReader matches rules that conforms PDF/A-1 standard.

type Profile1Options

Profile1Options are the options that changes the way how optimizer may try to adapt document into PDF/A standard.

type Profile1Options struct {
    // CMYKDefaultColorSpace is an option that refers PDF/A-1
    CMYKDefaultColorSpace bool
    // Now is a function that returns current time.
    Now func() time.Time
    // UUIDGenerator is the generator function of the document UUID.
    UUIDGenerator UUIDGenerator
}

func DefaultProfile1Options

func DefaultProfile1Options() *Profile1Options

DefaultProfile1Options are the default options for the Profile1.

type UUID

UUID is the unique universe identifier. It is used to generate XMP document uuid identifier.

type UUID [16]byte

func NewUUID

func NewUUID() UUID

NewUUID is the UUIDGenerator function used for determining new UUID value.

type UUIDGenerator

UUIDGenerator is the generator for the UUID.

type UUIDGenerator func() UUID

type VerificationError

VerificationError is the PDF/A verification error structure, that contains all violated rules.

type VerificationError struct {
    // ViolatedRules are the rules that were violated during error verification.
    ViolatedRules []ViolatedRule
    // ConformanceLevel defines the standard on verification failed.
    ConformanceLevel int
    // ConformanceVariant is the standard variant used on verification.
    ConformanceVariant string
}

func (VerificationError) Error

func (v VerificationError) Error() string

Error implements error interface.

type ViolatedRule

ViolatedRule is the structure that defines violated PDF/A rule.

type ViolatedRule struct {
    RuleNo string
    Detail string
}

func (ViolatedRule) String

func (v ViolatedRule) String() string

String gets a string representation of the violated rule.