Package mdp

Overview ▾

type DiffPolicy

DiffPolicy interface for comparing two revisions of the Pdf document.

type DiffPolicy interface {
    // ReviewFile should check the revisions of the old and new parsers
    // and evaluate the differences between the revisions.
    // Each implementation of this interface must decide
    // how to handle cases where there are multiple revisions between the old and new revisions.
    ReviewFile(oldParser *core.PdfParser, newParser *core.PdfParser, params *MDPParameters) (*DiffResults, error)

func NewDefaultDiffPolicy

func NewDefaultDiffPolicy() DiffPolicy

type DiffResult

DiffResult describes the warning or the error for the DiffPolicy results.

type DiffResult struct {
    Revision    int
    Description string

func (*DiffResult) String

func (dr *DiffResult) String() string

String returns the state of the warning.

type DiffResults

DiffResults describes the results of the DiffPolicy.

type DiffResults struct {
    Warnings []*DiffResult
    Errors   []*DiffResult

func (*DiffResults) IsPermitted

func (dr *DiffResults) IsPermitted() bool

IsPermitted returns true if changes permitted.

type DocMDPPermission

DocMDPPermission is values for set up access permissions for DocMDP. (Section, Table 254 - Entries in a signature dictionary p. 471 in PDF32000_2008).

type DocMDPPermission int64
const (
    // NoRestrictions All changes are possible in the document
    NoRestrictions DocMDPPermission = 0
    // NoChanges No changes to the document shall be permitted; any change to the
    // document shall invalidate the signature
    NoChanges DocMDPPermission = 1
    // FillForms Permitted changes shall be filling in forms, instantiating page
    // templates, and signing; other changes shall invalidate the signature.
    FillForms DocMDPPermission = 2
    // FillFormsAndAnnots Permitted changes shall be the same as for 2, as well as annotation
    // creation, deletion, and modification; other changes shall invalidate the
    // signature.
    FillFormsAndAnnots DocMDPPermission = 3

type MDPParameters

MDPParameters describes parameters for the MDP checks (now only DocMDP).

type MDPParameters struct {
    DocMDPLevel DocMDPPermission