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.

Index ▾

func Validate(d *model.CompliancePdfReader, profile Profile) error
type Profile
type Profile1A
    func NewProfile1A(options *Profile1Options) *Profile1A
    func (p *Profile1A) ApplyStandard(document *docutil.Document) (err error)
    func (p *Profile1A) Conformance() string
    func (p *Profile1A) Part() int
    func (p *Profile1A) StandardName() string
    func (p *Profile1A) ValidateStandard(r *model.CompliancePdfReader) error
type Profile1B
    func NewProfile1B(options *Profile1Options) *Profile1B
    func (p *Profile1B) ApplyStandard(document *docutil.Document) (err error)
    func (p *Profile1B) Conformance() string
    func (p *Profile1B) Part() int
    func (p *Profile1B) StandardName() string
    func (p *Profile1B) ValidateStandard(r *model.CompliancePdfReader) error
type Profile1Options
    func DefaultProfile1Options() *Profile1Options
type Profile2A
    func NewProfile2A(options *Profile2Options) *Profile2A
    func (p *Profile2A) ApplyStandard(document *docutil.Document) (err error)
    func (p *Profile2A) Conformance() string
    func (p *Profile2A) Part() int
    func (p *Profile2A) StandardName() string
    func (p *Profile2A) ValidateStandard(r *model.CompliancePdfReader) error
type Profile2B
    func NewProfile2B(options *Profile2Options) *Profile2B
    func (p *Profile2B) ApplyStandard(document *docutil.Document) (err error)
    func (p *Profile2B) Conformance() string
    func (p *Profile2B) Part() int
    func (p *Profile2B) StandardName() string
    func (p *Profile2B) ValidateStandard(r *model.CompliancePdfReader) error
type Profile2Options
    func DefaultProfile2Options() *Profile2Options
type Profile2U
    func NewProfile2U(options *Profile2Options) *Profile2U
    func (p *Profile2U) ApplyStandard(document *docutil.Document) (err error)
    func (p *Profile2U) Conformance() string
    func (p *Profile2U) Part() int
    func (p *Profile2U) StandardName() string
    func (p *Profile2U) ValidateStandard(r *model.CompliancePdfReader) error
type VerificationError
    func (v VerificationError) Error() string
type ViolatedRule
    func (v ViolatedRule) String() string
type XmpOptions

Package files

conformance_level.go doc.go error.go images.go optimizers.go optimizers_2.go profile_1.go profile_2.go profiles.go verifiers.go verifiers_2.go xmp.go

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
    // Xmp is the xmp options information.
    Xmp XmpOptions
}

func DefaultProfile1Options

func DefaultProfile1Options() *Profile1Options

DefaultProfile1Options are the default options for the Profile1.

type Profile2A

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

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

func NewProfile2A

func NewProfile2A(options *Profile2Options) *Profile2A

NewProfile2A creates a new Profile2A with given options.

func (*Profile2A) ApplyStandard

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

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

func (*Profile2A) Conformance

func (p *Profile2A) Conformance() string

Conformance gets the PDF/A conformance.

func (*Profile2A) Part

func (p *Profile2A) Part() int

Part gets the PDF/A version level.

func (*Profile2A) StandardName

func (p *Profile2A) StandardName() string

StandardName gets the name of the standard.

func (*Profile2A) ValidateStandard

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

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

type Profile2B

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

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

func NewProfile2B

func NewProfile2B(options *Profile2Options) *Profile2B

NewProfile2B creates a new Profile2B with the given options.

func (*Profile2B) ApplyStandard

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

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

func (*Profile2B) Conformance

func (p *Profile2B) Conformance() string

Conformance gets the PDF/A conformance.

func (*Profile2B) Part

func (p *Profile2B) Part() int

Part gets the PDF/A version level.

func (*Profile2B) StandardName

func (p *Profile2B) StandardName() string

StandardName gets the name of the standard.

func (*Profile2B) ValidateStandard

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

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

type Profile2Options

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

type Profile2Options struct {
    // CMYKDefaultColorSpace is an option that refers PDF/A
    CMYKDefaultColorSpace bool
    // Now is a function that returns current time.
    Now func() time.Time
    // Xmp is the xmp options information.
    Xmp XmpOptions
}

func DefaultProfile2Options

func DefaultProfile2Options() *Profile2Options

DefaultProfile2Options are the default options for the Profile2.

type Profile2U

Profile2U is the implementation of the PDF/A-2U standard profile. Implements model.StandardImplementer, Profile interfaces.

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

func NewProfile2U

func NewProfile2U(options *Profile2Options) *Profile2U

NewProfile2U creates a new Profile2U with the given options.

func (*Profile2U) ApplyStandard

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

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

func (*Profile2U) Conformance

func (p *Profile2U) Conformance() string

Conformance gets the PDF/A conformance.

func (*Profile2U) Part

func (p *Profile2U) Part() int

Part gets the PDF/A version level.

func (*Profile2U) StandardName

func (p *Profile2U) StandardName() string

StandardName gets the name of the standard.

func (*Profile2U) ValidateStandard

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

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

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.

type XmpOptions

XmpOptions are the options used by the optimization of the XMP metadata.

type XmpOptions struct {
    // Copyright information.
    Copyright string
    // OriginalDocumentID is the original document identifier.
    // By default, if this field is empty the value is extracted from the XMP Metadata or generated UUID.
    OriginalDocumentID string
    // DocumentID is the original document identifier.
    // By default, if this field is empty the value is extracted from the XMP Metadata or generated UUID.
    DocumentID string
    // InstanceID is the original document identifier.
    // By default, if this field is empty the value is set to generated UUID.
    InstanceID string

    // NewDocumentVersion is a flag that defines if a document was overwritten.
    // If the new document was created this should be true. On changing given document file, and overwriting it it should be true.
    NewDocumentVersion bool
    // MarshalIndent defines marshaling indent of the XMP metadata.
    MarshalIndent string
    // MarshalPrefix defines marshaling prefix of the XMP metadata.
    MarshalPrefix string
}