mirror of
https://github.com/unidoc/unipdf.git
synced 2025-04-30 13:48:51 +08:00
Doc fixes
This commit is contained in:
parent
dcf9262bf6
commit
0edf3b11bf
@ -9,23 +9,24 @@ import (
|
|||||||
. "github.com/unidoc/unidoc/pdf/core"
|
. "github.com/unidoc/unidoc/pdf/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
// A PDFModel is a higher level PDF construct which can be collapsed into a PDF primitive.
|
// PdfModel represents a high level PDF type which can be collapsed into a PDF primitive (typically a dictionary
|
||||||
// Each PDFModel has an underlying Primitive and vice versa.
|
// contained within an indirect object).
|
||||||
// Copies can be made, but care must be taken to do it properly.
|
|
||||||
type PdfModel interface {
|
type PdfModel interface {
|
||||||
ToPdfObject() PdfObject
|
ToPdfObject() PdfObject
|
||||||
GetContainingPdfObject() PdfObject
|
GetContainingPdfObject() PdfObject
|
||||||
}
|
}
|
||||||
|
|
||||||
// The model manager is used to cache Primitive <-> Model mappings where needed.
|
// modelManager is used to cache PdfObject <-> Model mappings where needed.
|
||||||
// In many cases only Model -> Primitive mapping is needed and only a reference to the Primitive
|
// In many cases only Model -> PdfObject mapping is needed and only a reference to the PdfObject
|
||||||
// is stored in the Model. In some cases, the Model needs to be found from the Primitive,
|
// is stored in the Model. In some cases, the Model needs to be found given the PdfObject,
|
||||||
// and that is where the modelManager can be used (in both directions).
|
// and that is where the modelManager can be used (in both directions).
|
||||||
//
|
//
|
||||||
// Note that it is not always used, the Primitive <-> Model mapping needs to be registered
|
// Note that it is not always used, the Primitive <-> Model mapping needs to be registered
|
||||||
// for each time it is used. Thus, it is only used for special cases, commonly where the same
|
// for each time it is used. Thus, it is only used for special cases, commonly where the same
|
||||||
// object is used by two higher level objects. (Example PDF Widgets owned by both Page Annotations,
|
// object is used by two higher level objects.
|
||||||
// and the interactive form - AcroForm).
|
//
|
||||||
|
// Example use case: PDF Annotation Widgets can be referenced by both Page Annotations, and the interactive
|
||||||
|
// form - AcroForm. With the cache, can check if already loaded and get the underlying model without duplication.
|
||||||
type modelManager struct {
|
type modelManager struct {
|
||||||
primitiveCache map[PdfModel]PdfObject
|
primitiveCache map[PdfModel]PdfObject
|
||||||
modelCache map[PdfObject]PdfModel
|
modelCache map[PdfObject]PdfModel
|
||||||
|
Loading…
x
Reference in New Issue
Block a user