HomeUniDoc
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 Profile3A
    func NewProfile3A(options *Profile3Options) *Profile3A
    func (p *Profile3A) ApplyStandard(document *docutil.Document) (err error)
    func (p *Profile3A) Conformance() string
    func (p *Profile3A) Part() int
    func (p *Profile3A) StandardName() string
    func (p *Profile3A) ValidateStandard(r *model.CompliancePdfReader) error
type Profile3B
    func NewProfile3B(options *Profile3Options) *Profile3B
    func (p *Profile3B) ApplyStandard(document *docutil.Document) (err error)
    func (p *Profile3B) Conformance() string
    func (p *Profile3B) Part() int
    func (p *Profile3B) StandardName() string
    func (p *Profile3B) ValidateStandard(r *model.CompliancePdfReader) error
type Profile3Options
    func DefaultProfile3Options() *Profile3Options
type Profile3U
    func NewProfile3U(options *Profile3Options) *Profile3U
    func (p *Profile3U) ApplyStandard(document *docutil.Document) (err error)
    func (p *Profile3U) Conformance() string
    func (p *Profile3U) Part() int
    func (p *Profile3U) StandardName() string
    func (p *Profile3U) 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 optimizers_3.go profile_1.go profile_2.go profile_3.go profiles.go verifiers.go verifiers_2.go verifiers_3.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 Profile3A

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

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

func NewProfile3A

func NewProfile3A(options *Profile3Options) *Profile3A

NewProfile3A creates a new Profile3A with given options.

func (*Profile3A) ApplyStandard

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

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

func (*Profile3A) Conformance

func (p *Profile3A) Conformance() string

Conformance gets the PDF/A conformance.

func (*Profile3A) Part

func (p *Profile3A) Part() int

Part gets the PDF/A version level.

func (*Profile3A) StandardName

func (p *Profile3A) StandardName() string

StandardName gets the name of the standard.

func (*Profile3A) ValidateStandard

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

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

type Profile3B

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

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

func NewProfile3B

func NewProfile3B(options *Profile3Options) *Profile3B

NewProfile3B creates a new Profile3B with the given options.

func (*Profile3B) ApplyStandard

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

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

func (*Profile3B) Conformance

func (p *Profile3B) Conformance() string

Conformance gets the PDF/A conformance.

func (*Profile3B) Part

func (p *Profile3B) Part() int

Part gets the PDF/A version level.

func (*Profile3B) StandardName

func (p *Profile3B) StandardName() string

StandardName gets the name of the standard.

func (*Profile3B) ValidateStandard

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

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

type Profile3Options

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

type Profile3Options 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 DefaultProfile3Options

func DefaultProfile3Options() *Profile3Options

DefaultProfile3Options the default options for the Profile3.

type Profile3U

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

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

func NewProfile3U

func NewProfile3U(options *Profile3Options) *Profile3U

NewProfile3U creates a new Profile3U with the given options.

func (*Profile3U) ApplyStandard

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

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

func (*Profile3U) Conformance

func (p *Profile3U) Conformance() string

Conformance gets the PDF/A conformance.

func (*Profile3U) Part

func (p *Profile3U) Part() int

Part gets the PDF/A version level.

func (*Profile3U) StandardName

func (p *Profile3U) StandardName() string

StandardName gets the name of the standard.

func (*Profile3U) ValidateStandard

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

ValidateStandard checks if provided input CompliancePdfReader matches rules that conforms PDF/A-3 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
}