unipdf/pdf/model/annotations.go

1710 lines
37 KiB
Go
Raw Normal View History

2016-09-05 09:57:16 +00:00
/*
* This file is subject to the terms and conditions defined in
* file 'LICENSE.md', which is part of this source code package.
*/
package model
2016-09-05 09:57:16 +00:00
import (
"fmt"
2016-09-05 09:57:16 +00:00
"github.com/unidoc/unidoc/common"
. "github.com/unidoc/unidoc/pdf/core"
2016-09-05 09:57:16 +00:00
)
/*
markup annotations:
T, popup, ..., ExData
markup annotaitons are:
Text, FreeText, Line, Square, Circle, Polygon, PolyLine, Highlight, Underline, Squiggly, StrikeOut, Stamp, Caret, Ink, FileAttachment,
Sound, Redact
*/
2016-09-05 09:57:16 +00:00
type PdfAnnotation struct {
context PdfModel // Sub-annotation.
2016-09-05 09:57:16 +00:00
Rect PdfObject
Contents PdfObject
P PdfObject // Reference to page object.
NM PdfObject
M PdfObject
F PdfObject
AP PdfObject
AS PdfObject
Border PdfObject
C PdfObject
StructParent PdfObject
OC PdfObject
primitive *PdfIndirectObject
2016-09-05 09:57:16 +00:00
}
// Context in this case is a reference to the subannotation.
func (this *PdfAnnotation) GetContext() PdfModel {
2016-09-07 17:56:45 +00:00
return this.context
}
// Additional elements for mark-up annotations.
type PdfAnnotationMarkup struct {
T PdfObject
Popup PdfObject
CA PdfObject
RC PdfObject
CreationDate PdfObject
IRT PdfObject
Subj PdfObject
RT PdfObject
IT PdfObject
ExData PdfObject
}
2016-09-05 09:57:16 +00:00
// Subtype: Text
type PdfAnnotationText struct {
*PdfAnnotation
*PdfAnnotationMarkup
2016-09-05 09:57:16 +00:00
Open PdfObject
Name PdfObject
State PdfObject
StateModel PdfObject
}
// Subtype: Link
type PdfAnnotationLink struct {
*PdfAnnotation
2016-09-05 09:57:16 +00:00
A PdfObject
Dest PdfObject
H PdfObject
PA PdfObject
QuadPoints PdfObject
BS PdfObject
}
// Subtype: FreeText
type PdfAnnotationFreeText struct {
*PdfAnnotation
*PdfAnnotationMarkup
2016-09-05 09:57:16 +00:00
DA PdfObject
Q PdfObject
RC PdfObject
DS PdfObject
CL PdfObject
IT PdfObject
BE PdfObject
RD PdfObject
BS PdfObject
LE PdfObject
}
// Subtype: Line
type PdfAnnotationLine struct {
*PdfAnnotation
*PdfAnnotationMarkup
2016-09-05 09:57:16 +00:00
L PdfObject
BS PdfObject
LE PdfObject
IC PdfObject
LL PdfObject
LLE PdfObject
Cap PdfObject
IT PdfObject
LLO PdfObject
CP PdfObject
Measure PdfObject
CO PdfObject
}
// Subtype: Square
type PdfAnnotationSquare struct {
*PdfAnnotation
*PdfAnnotationMarkup
2016-09-05 09:57:16 +00:00
BS PdfObject
IC PdfObject
BE PdfObject
RD PdfObject
}
// Subtype: Circle
type PdfAnnotationCircle struct {
*PdfAnnotation
*PdfAnnotationMarkup
2016-09-05 09:57:16 +00:00
BS PdfObject
IC PdfObject
BE PdfObject
RD PdfObject
}
// Subtype: Polygon
type PdfAnnotationPolygon struct {
*PdfAnnotation
*PdfAnnotationMarkup
2016-09-05 09:57:16 +00:00
Vertices PdfObject
LE PdfObject
BS PdfObject
IC PdfObject
BE PdfObject
IT PdfObject
Measure PdfObject
}
// Subtype: PolyLine
type PdfAnnotationPolyLine struct {
*PdfAnnotation
*PdfAnnotationMarkup
2016-09-05 09:57:16 +00:00
Vertices PdfObject
LE PdfObject
BS PdfObject
IC PdfObject
BE PdfObject
IT PdfObject
Measure PdfObject
}
// Subtype: Highlight
type PdfAnnotationHighlight struct {
*PdfAnnotation
*PdfAnnotationMarkup
2016-09-05 09:57:16 +00:00
QuadPoints PdfObject
}
// Subtype: Underline
type PdfAnnotationUnderline struct {
*PdfAnnotation
*PdfAnnotationMarkup
2016-09-05 09:57:16 +00:00
QuadPoints PdfObject
}
// Subtype: Squiggly
type PdfAnnotationSquiggly struct {
*PdfAnnotation
*PdfAnnotationMarkup
2016-09-05 09:57:16 +00:00
QuadPoints PdfObject
}
// Subtype: StrikeOut
type PdfAnnotationStrikeOut struct {
*PdfAnnotation
*PdfAnnotationMarkup
2016-09-05 09:57:16 +00:00
QuadPoints PdfObject
}
// Subtype: Caret
type PdfAnnotationCaret struct {
*PdfAnnotation
*PdfAnnotationMarkup
2016-09-05 09:57:16 +00:00
RD PdfObject
Sy PdfObject
}
// Subtype: Stamp
type PdfAnnotationStamp struct {
*PdfAnnotation
*PdfAnnotationMarkup
2016-09-05 09:57:16 +00:00
Name PdfObject
}
// Subtype: Ink
type PdfAnnotationInk struct {
*PdfAnnotation
*PdfAnnotationMarkup
2016-09-05 09:57:16 +00:00
InkList PdfObject
BS PdfObject
}
// Subtype: Popup
type PdfAnnotationPopup struct {
*PdfAnnotation
2016-09-05 09:57:16 +00:00
Parent PdfObject
Open PdfObject
}
// Subtype: FileAttachment
type PdfAnnotationFileAttachment struct {
*PdfAnnotation
*PdfAnnotationMarkup
2016-09-05 09:57:16 +00:00
FS PdfObject
Name PdfObject
}
// Subtype: Sound
type PdfAnnotationSound struct {
*PdfAnnotation
*PdfAnnotationMarkup
2016-09-05 09:57:16 +00:00
Sound PdfObject
Name PdfObject
}
// Subtype: Rich Media
type PdfAnnotationRichMedia struct {
*PdfAnnotation
RichMediaSettings PdfObject
RichMediaContent PdfObject
}
2016-09-05 09:57:16 +00:00
// Subtype: Movie
type PdfAnnotationMovie struct {
*PdfAnnotation
2016-09-05 09:57:16 +00:00
T PdfObject
Movie PdfObject
A PdfObject
}
// Subtype: Screen
type PdfAnnotationScreen struct {
*PdfAnnotation
2016-09-05 09:57:16 +00:00
T PdfObject
MK PdfObject
A PdfObject
AA PdfObject
}
// Subtype: Widget
type PdfAnnotationWidget struct {
*PdfAnnotation
2016-09-05 09:57:16 +00:00
H PdfObject
MK PdfObject
A PdfObject
AA PdfObject
BS PdfObject
Parent PdfObject
}
// Subtype: Watermark
type PdfAnnotationWatermark struct {
*PdfAnnotation
2016-09-05 09:57:16 +00:00
FixedPrint PdfObject
}
// Subtype: PrinterMark
type PdfAnnotationPrinterMark struct {
*PdfAnnotation
2016-09-05 09:57:16 +00:00
MN PdfObject
}
// Subtype: TrapNet
type PdfAnnotationTrapNet struct {
*PdfAnnotation
2016-09-05 09:57:16 +00:00
}
// Subtype: 3D
type PdfAnnotation3D struct {
*PdfAnnotation
2016-09-05 09:57:16 +00:00
T3DD PdfObject
T3DV PdfObject
T3DA PdfObject
T3DI PdfObject
T3DB PdfObject
}
// Subtype: Projection
type PdfAnnotationProjection struct {
*PdfAnnotation
*PdfAnnotationMarkup
}
// Subtype: Redact
2016-09-05 09:57:16 +00:00
type PdfAnnotationRedact struct {
*PdfAnnotation
*PdfAnnotationMarkup
2016-09-05 09:57:16 +00:00
QuadPoints PdfObject
IC PdfObject
RO PdfObject
OverlayText PdfObject
Repeat PdfObject
DA PdfObject
Q PdfObject
}
// Construct a new PDF annotation model and initializes the underlying
// PDF primitive.
func NewPdfAnnotation() *PdfAnnotation {
annot := &PdfAnnotation{}
container := &PdfIndirectObject{}
container.PdfObject = &PdfObjectDictionary{}
annot.primitive = container
return annot
2016-09-05 09:57:16 +00:00
}
// Used for PDF parsing. Loads a PDF annotation model from a PDF primitive dictionary object.
// Loads the common PDF annotation dictionary, and anything needed for the annotation subtype.
2016-09-07 17:56:45 +00:00
func (r *PdfReader) newPdfAnnotationFromDict(d *PdfObjectDictionary) (*PdfAnnotation, error) {
// Check if cached, return cached model if exists.
if model := r.modelManager.GetModelFromPrimitive(d); model != nil {
annot, ok := model.(*PdfAnnotation)
if !ok {
return nil, fmt.Errorf("Cached model not a PDF annotation")
}
return annot, nil
}
annot := NewPdfAnnotation()
r.modelManager.Register(d, annot)
2016-09-05 09:57:16 +00:00
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["Type"]; has {
str, ok := obj.(*PdfObjectName)
2016-09-05 09:57:16 +00:00
if !ok {
return nil, fmt.Errorf("Invalid type of Type (%T)", obj)
}
if *str != "Annot" {
// Log a debug message.
// Not returning an error on this.
common.Log.Debug("Unsuspected Type != Annot (%s)", *str)
}
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["Rect"]; has {
2016-09-05 09:57:16 +00:00
annot.Rect = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["Contents"]; has {
2016-09-05 09:57:16 +00:00
annot.Contents = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["P"]; has {
2016-09-05 09:57:16 +00:00
annot.P = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["NM"]; has {
2016-09-05 09:57:16 +00:00
annot.NM = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["M"]; has {
2016-09-05 09:57:16 +00:00
annot.M = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["F"]; has {
2016-09-05 09:57:16 +00:00
annot.F = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["AP"]; has {
2016-09-05 09:57:16 +00:00
annot.AP = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["AS"]; has {
2016-09-05 09:57:16 +00:00
annot.AS = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["Border"]; has {
2016-09-05 09:57:16 +00:00
annot.Border = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["C"]; has {
2016-09-05 09:57:16 +00:00
annot.C = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["StructParent"]; has {
2016-09-05 09:57:16 +00:00
annot.StructParent = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["OC"]; has {
2016-09-05 09:57:16 +00:00
annot.OC = obj
}
2016-09-07 17:56:45 +00:00
subtypeObj, has := (*d)["Subtype"]
2016-09-05 09:57:16 +00:00
if !has {
return nil, fmt.Errorf("Missing Subtype")
}
subtype, ok := subtypeObj.(*PdfObjectName)
if !ok {
return nil, fmt.Errorf("Invalid Subtype object type != name (%T)", subtypeObj)
}
switch *subtype {
case "Text":
ctx, err := newPdfAnnotationTextFromDict(d)
if err != nil {
return nil, err
}
ctx.PdfAnnotation = annot
annot.context = ctx
return annot, nil
2016-09-05 09:57:16 +00:00
case "Link":
ctx, err := newPdfAnnotationLinkFromDict(d)
if err != nil {
return nil, err
}
ctx.PdfAnnotation = annot
annot.context = ctx
return annot, nil
2016-09-05 09:57:16 +00:00
case "FreeText":
2016-09-06 09:33:58 +00:00
ctx, err := newPdfAnnotationFreeTextFromDict(d)
if err != nil {
return nil, err
}
ctx.PdfAnnotation = annot
annot.context = ctx
return annot, nil
2016-09-05 09:57:16 +00:00
case "Line":
2016-09-06 09:33:58 +00:00
ctx, err := newPdfAnnotationLineFromDict(d)
if err != nil {
return nil, err
}
ctx.PdfAnnotation = annot
annot.context = ctx
return annot, nil
2016-09-05 09:57:16 +00:00
case "Square":
2016-09-06 09:33:58 +00:00
ctx, err := newPdfAnnotationSquareFromDict(d)
if err != nil {
return nil, err
}
ctx.PdfAnnotation = annot
annot.context = ctx
return annot, nil
2016-09-05 09:57:16 +00:00
case "Circle":
2016-09-06 09:33:58 +00:00
ctx, err := newPdfAnnotationCircleFromDict(d)
if err != nil {
return nil, err
}
ctx.PdfAnnotation = annot
annot.context = ctx
return annot, nil
2016-09-05 09:57:16 +00:00
case "Polygon":
2016-09-06 09:33:58 +00:00
ctx, err := newPdfAnnotationPolygonFromDict(d)
if err != nil {
return nil, err
}
ctx.PdfAnnotation = annot
annot.context = ctx
return annot, nil
2016-09-05 09:57:16 +00:00
case "PolyLine":
2016-09-06 09:33:58 +00:00
ctx, err := newPdfAnnotationPolyLineFromDict(d)
if err != nil {
return nil, err
}
ctx.PdfAnnotation = annot
annot.context = ctx
return annot, nil
2016-09-06 09:33:58 +00:00
case "Highlight":
ctx, err := newPdfAnnotationHighlightFromDict(d)
if err != nil {
return nil, err
}
ctx.PdfAnnotation = annot
annot.context = ctx
return annot, nil
case "Underline":
ctx, err := newPdfAnnotationUnderlineFromDict(d)
if err != nil {
return nil, err
}
ctx.PdfAnnotation = annot
annot.context = ctx
return annot, nil
case "Squiggly":
ctx, err := newPdfAnnotationSquigglyFromDict(d)
if err != nil {
return nil, err
}
ctx.PdfAnnotation = annot
annot.context = ctx
return annot, nil
case "StrikeOut":
ctx, err := newPdfAnnotationStrikeOut(d)
if err != nil {
return nil, err
}
ctx.PdfAnnotation = annot
annot.context = ctx
return annot, nil
2016-09-05 09:57:16 +00:00
case "Caret":
2016-09-06 09:33:58 +00:00
ctx, err := newPdfAnnotationCaretFromDict(d)
if err != nil {
return nil, err
}
ctx.PdfAnnotation = annot
annot.context = ctx
return annot, nil
2016-09-05 09:57:16 +00:00
case "Stamp":
2016-09-06 09:33:58 +00:00
ctx, err := newPdfAnnotationStampFromDict(d)
if err != nil {
return nil, err
}
ctx.PdfAnnotation = annot
annot.context = ctx
return annot, nil
2016-09-05 09:57:16 +00:00
case "Ink":
2016-09-06 09:33:58 +00:00
ctx, err := newPdfAnnotationInkFromDict(d)
if err != nil {
return nil, err
}
ctx.PdfAnnotation = annot
annot.context = ctx
return annot, nil
2016-09-05 09:57:16 +00:00
case "Popup":
2016-09-06 09:33:58 +00:00
ctx, err := newPdfAnnotationPopupFromDict(d)
if err != nil {
return nil, err
}
ctx.PdfAnnotation = annot
annot.context = ctx
return annot, nil
2016-09-05 09:57:16 +00:00
case "FileAttachment":
2016-09-06 09:33:58 +00:00
ctx, err := newPdfAnnotationFileAttachmentFromDict(d)
if err != nil {
return nil, err
}
ctx.PdfAnnotation = annot
annot.context = ctx
return annot, nil
2016-09-05 09:57:16 +00:00
case "Sound":
2016-09-06 09:33:58 +00:00
ctx, err := newPdfAnnotationSoundFromDict(d)
if err != nil {
return nil, err
}
ctx.PdfAnnotation = annot
annot.context = ctx
return annot, nil
case "RichMedia":
ctx, err := newPdfAnnotationRichMediaFromDict(d)
if err != nil {
return nil, err
}
ctx.PdfAnnotation = annot
annot.context = ctx
return annot, nil
2016-09-05 09:57:16 +00:00
case "Movie":
2016-09-06 09:33:58 +00:00
ctx, err := newPdfAnnotationMovieFromDict(d)
if err != nil {
return nil, err
}
ctx.PdfAnnotation = annot
annot.context = ctx
return annot, nil
2016-09-05 09:57:16 +00:00
case "Screen":
2016-09-06 09:33:58 +00:00
ctx, err := newPdfAnnotationScreenFromDict(d)
if err != nil {
return nil, err
}
ctx.PdfAnnotation = annot
annot.context = ctx
return annot, nil
2016-09-05 09:57:16 +00:00
case "Widget":
2016-09-06 09:33:58 +00:00
ctx, err := newPdfAnnotationWidgetFromDict(d)
if err != nil {
return nil, err
}
ctx.PdfAnnotation = annot
annot.context = ctx
return annot, nil
2016-09-05 09:57:16 +00:00
case "PrinterMark":
2016-09-06 09:33:58 +00:00
ctx, err := newPdfAnnotationPrinterMarkFromDict(d)
if err != nil {
return nil, err
}
ctx.PdfAnnotation = annot
annot.context = ctx
return annot, nil
2016-09-05 09:57:16 +00:00
case "TrapNet":
2016-09-06 09:33:58 +00:00
ctx, err := newPdfAnnotationTrapNetFromDict(d)
if err != nil {
return nil, err
}
ctx.PdfAnnotation = annot
annot.context = ctx
return annot, nil
2016-09-05 09:57:16 +00:00
case "Watermark":
2016-09-06 09:33:58 +00:00
ctx, err := newPdfAnnotationWatermarkFromDict(d)
if err != nil {
return nil, err
}
ctx.PdfAnnotation = annot
annot.context = ctx
return annot, nil
2016-09-05 09:57:16 +00:00
case "3D":
2016-09-06 09:33:58 +00:00
ctx, err := newPdfAnnotation3DFromDict(d)
if err != nil {
return nil, err
}
ctx.PdfAnnotation = annot
annot.context = ctx
return annot, nil
case "Projection":
ctx, err := newPdfAnnotationProjectionFromDict(d)
if err != nil {
return nil, err
}
ctx.PdfAnnotation = annot
annot.context = ctx
return annot, nil
2016-09-05 09:57:16 +00:00
case "Redact":
2016-09-06 09:33:58 +00:00
ctx, err := newPdfAnnotationRedactFromDict(d)
if err != nil {
return nil, err
}
ctx.PdfAnnotation = annot
annot.context = ctx
return annot, nil
2016-09-05 09:57:16 +00:00
}
2016-09-06 09:33:58 +00:00
err := fmt.Errorf("Unknown annotation (%s)", *subtype)
return nil, err
2016-09-05 09:57:16 +00:00
}
// Load data for markup annotation subtypes.
func newPdfAnnotationMarkupFromDict(d *PdfObjectDictionary) (*PdfAnnotationMarkup, error) {
annot := &PdfAnnotationMarkup{}
if obj, has := (*d)["T"]; has {
annot.T = obj
}
if obj, has := (*d)["CA"]; has {
annot.CA = obj
}
if obj, has := (*d)["RC"]; has {
annot.RC = obj
}
if obj, has := (*d)["CreationDate"]; has {
annot.CreationDate = obj
}
if obj, has := (*d)["IRT"]; has {
annot.IRT = obj
}
if obj, has := (*d)["Subj"]; has {
annot.Subj = obj
}
if obj, has := (*d)["RT"]; has {
annot.RT = obj
}
if obj, has := (*d)["IT"]; has {
annot.IT = obj
}
if obj, has := (*d)["ExData"]; has {
annot.ExData = obj
}
return annot, nil
}
2016-09-07 17:56:45 +00:00
func newPdfAnnotationTextFromDict(d *PdfObjectDictionary) (*PdfAnnotationText, error) {
2016-09-05 09:57:16 +00:00
annot := PdfAnnotationText{}
markup, err := newPdfAnnotationMarkupFromDict(d)
if err != nil {
return nil, err
}
annot.PdfAnnotationMarkup = markup
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["Open"]; has {
2016-09-05 09:57:16 +00:00
annot.Open = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["Name"]; has {
2016-09-05 09:57:16 +00:00
annot.Name = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["State"]; has {
2016-09-05 09:57:16 +00:00
annot.State = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["StateModel"]; has {
2016-09-05 09:57:16 +00:00
annot.StateModel = obj
}
return &annot, nil
}
2016-09-07 17:56:45 +00:00
func newPdfAnnotationLinkFromDict(d *PdfObjectDictionary) (*PdfAnnotationLink, error) {
2016-09-05 09:57:16 +00:00
annot := PdfAnnotationLink{}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["A"]; has {
2016-09-05 09:57:16 +00:00
annot.A = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["Dest"]; has {
2016-09-05 09:57:16 +00:00
annot.Dest = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["H"]; has {
2016-09-05 09:57:16 +00:00
annot.H = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["PA"]; has {
2016-09-05 09:57:16 +00:00
annot.PA = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["QuadPoints"]; has {
2016-09-05 09:57:16 +00:00
annot.QuadPoints = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["BS"]; has {
2016-09-05 09:57:16 +00:00
annot.BS = obj
}
return &annot, nil
}
2016-09-07 17:56:45 +00:00
func newPdfAnnotationFreeTextFromDict(d *PdfObjectDictionary) (*PdfAnnotationFreeText, error) {
2016-09-05 09:57:16 +00:00
annot := PdfAnnotationFreeText{}
markup, err := newPdfAnnotationMarkupFromDict(d)
if err != nil {
return nil, err
}
annot.PdfAnnotationMarkup = markup
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["DA"]; has {
2016-09-05 09:57:16 +00:00
annot.DA = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["Q"]; has {
2016-09-05 09:57:16 +00:00
annot.Q = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["RC"]; has {
2016-09-05 09:57:16 +00:00
annot.RC = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["DS"]; has {
2016-09-05 09:57:16 +00:00
annot.DS = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["CL"]; has {
2016-09-05 09:57:16 +00:00
annot.CL = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["IT"]; has {
2016-09-05 09:57:16 +00:00
annot.IT = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["BE"]; has {
2016-09-05 09:57:16 +00:00
annot.BE = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["RD"]; has {
2016-09-05 09:57:16 +00:00
annot.RD = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["BS"]; has {
2016-09-05 09:57:16 +00:00
annot.BS = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["LE"]; has {
2016-09-05 09:57:16 +00:00
annot.LE = obj
}
return &annot, nil
}
2016-09-07 17:56:45 +00:00
func newPdfAnnotationLineFromDict(d *PdfObjectDictionary) (*PdfAnnotationLine, error) {
2016-09-05 09:57:16 +00:00
annot := PdfAnnotationLine{}
markup, err := newPdfAnnotationMarkupFromDict(d)
if err != nil {
return nil, err
}
annot.PdfAnnotationMarkup = markup
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["L"]; has {
2016-09-05 09:57:16 +00:00
annot.L = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["BS"]; has {
2016-09-05 09:57:16 +00:00
annot.BS = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["LE"]; has {
2016-09-05 09:57:16 +00:00
annot.LE = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["IC"]; has {
2016-09-05 09:57:16 +00:00
annot.IC = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["LL"]; has {
2016-09-05 09:57:16 +00:00
annot.LL = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["LLE"]; has {
2016-09-05 09:57:16 +00:00
annot.LLE = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["Cap"]; has {
2016-09-05 09:57:16 +00:00
annot.Cap = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["IT"]; has {
2016-09-05 09:57:16 +00:00
annot.IT = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["LLO"]; has {
2016-09-05 09:57:16 +00:00
annot.LLO = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["CP"]; has {
2016-09-05 09:57:16 +00:00
annot.CP = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["Measure"]; has {
2016-09-05 09:57:16 +00:00
annot.Measure = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["CO"]; has {
2016-09-05 09:57:16 +00:00
annot.CO = obj
}
return &annot, nil
}
2016-09-07 17:56:45 +00:00
func newPdfAnnotationSquareFromDict(d *PdfObjectDictionary) (*PdfAnnotationSquare, error) {
2016-09-05 09:57:16 +00:00
annot := PdfAnnotationSquare{}
markup, err := newPdfAnnotationMarkupFromDict(d)
if err != nil {
return nil, err
}
annot.PdfAnnotationMarkup = markup
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["BS"]; has {
2016-09-05 09:57:16 +00:00
annot.BS = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["IC"]; has {
2016-09-05 09:57:16 +00:00
annot.IC = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["BE"]; has {
2016-09-05 09:57:16 +00:00
annot.BE = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["RD"]; has {
2016-09-05 09:57:16 +00:00
annot.RD = obj
}
return &annot, nil
}
2016-09-07 17:56:45 +00:00
func newPdfAnnotationCircleFromDict(d *PdfObjectDictionary) (*PdfAnnotationCircle, error) {
2016-09-05 09:57:16 +00:00
annot := PdfAnnotationCircle{}
markup, err := newPdfAnnotationMarkupFromDict(d)
if err != nil {
return nil, err
}
annot.PdfAnnotationMarkup = markup
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["BS"]; has {
2016-09-05 09:57:16 +00:00
annot.BS = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["IC"]; has {
2016-09-05 09:57:16 +00:00
annot.IC = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["BE"]; has {
2016-09-05 09:57:16 +00:00
annot.BE = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["RD"]; has {
2016-09-05 09:57:16 +00:00
annot.RD = obj
}
return &annot, nil
}
2016-09-07 17:56:45 +00:00
func newPdfAnnotationPolygonFromDict(d *PdfObjectDictionary) (*PdfAnnotationPolygon, error) {
2016-09-05 09:57:16 +00:00
annot := PdfAnnotationPolygon{}
2016-09-07 17:56:45 +00:00
markup, err := newPdfAnnotationMarkupFromDict(d)
if err != nil {
return nil, err
}
annot.PdfAnnotationMarkup = markup
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["Vertices"]; has {
2016-09-05 09:57:16 +00:00
annot.Vertices = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["LE"]; has {
2016-09-05 09:57:16 +00:00
annot.LE = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["BS"]; has {
2016-09-05 09:57:16 +00:00
annot.BS = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["IC"]; has {
2016-09-05 09:57:16 +00:00
annot.IC = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["BE"]; has {
2016-09-05 09:57:16 +00:00
annot.BE = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["IT"]; has {
2016-09-05 09:57:16 +00:00
annot.IT = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["Measure"]; has {
2016-09-05 09:57:16 +00:00
annot.Measure = obj
}
return &annot, nil
}
2016-09-07 17:56:45 +00:00
func newPdfAnnotationPolyLineFromDict(d *PdfObjectDictionary) (*PdfAnnotationPolyLine, error) {
2016-09-05 09:57:16 +00:00
annot := PdfAnnotationPolyLine{}
2016-09-07 17:56:45 +00:00
markup, err := newPdfAnnotationMarkupFromDict(d)
if err != nil {
return nil, err
}
annot.PdfAnnotationMarkup = markup
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["Vertices"]; has {
2016-09-05 09:57:16 +00:00
annot.Vertices = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["LE"]; has {
2016-09-05 09:57:16 +00:00
annot.LE = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["BS"]; has {
2016-09-05 09:57:16 +00:00
annot.BS = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["IC"]; has {
2016-09-05 09:57:16 +00:00
annot.IC = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["BE"]; has {
2016-09-05 09:57:16 +00:00
annot.BE = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["IT"]; has {
2016-09-05 09:57:16 +00:00
annot.IT = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["Measure"]; has {
2016-09-05 09:57:16 +00:00
annot.Measure = obj
}
return &annot, nil
}
2016-09-07 17:56:45 +00:00
func newPdfAnnotationHighlightFromDict(d *PdfObjectDictionary) (*PdfAnnotationHighlight, error) {
2016-09-05 09:57:16 +00:00
annot := PdfAnnotationHighlight{}
markup, err := newPdfAnnotationMarkupFromDict(d)
if err != nil {
return nil, err
}
annot.PdfAnnotationMarkup = markup
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["QuadPoints"]; has {
2016-09-05 09:57:16 +00:00
annot.QuadPoints = obj
}
return &annot, nil
}
2016-09-07 17:56:45 +00:00
func newPdfAnnotationUnderlineFromDict(d *PdfObjectDictionary) (*PdfAnnotationUnderline, error) {
2016-09-05 09:57:16 +00:00
annot := PdfAnnotationUnderline{}
markup, err := newPdfAnnotationMarkupFromDict(d)
if err != nil {
return nil, err
}
annot.PdfAnnotationMarkup = markup
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["QuadPoints"]; has {
2016-09-05 09:57:16 +00:00
annot.QuadPoints = obj
}
return &annot, nil
}
2016-09-07 17:56:45 +00:00
func newPdfAnnotationSquigglyFromDict(d *PdfObjectDictionary) (*PdfAnnotationSquiggly, error) {
2016-09-05 09:57:16 +00:00
annot := PdfAnnotationSquiggly{}
markup, err := newPdfAnnotationMarkupFromDict(d)
if err != nil {
return nil, err
}
annot.PdfAnnotationMarkup = markup
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["QuadPoints"]; has {
2016-09-05 09:57:16 +00:00
annot.QuadPoints = obj
}
return &annot, nil
}
2016-09-07 17:56:45 +00:00
func newPdfAnnotationStrikeOut(d *PdfObjectDictionary) (*PdfAnnotationStrikeOut, error) {
2016-09-05 09:57:16 +00:00
annot := PdfAnnotationStrikeOut{}
markup, err := newPdfAnnotationMarkupFromDict(d)
if err != nil {
return nil, err
}
annot.PdfAnnotationMarkup = markup
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["QuadPoints"]; has {
2016-09-05 09:57:16 +00:00
annot.QuadPoints = obj
}
return &annot, nil
}
2016-09-07 17:56:45 +00:00
func newPdfAnnotationCaretFromDict(d *PdfObjectDictionary) (*PdfAnnotationCaret, error) {
2016-09-05 09:57:16 +00:00
annot := PdfAnnotationCaret{}
markup, err := newPdfAnnotationMarkupFromDict(d)
if err != nil {
return nil, err
}
annot.PdfAnnotationMarkup = markup
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["RD"]; has {
2016-09-05 09:57:16 +00:00
annot.RD = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["Sy"]; has {
2016-09-05 09:57:16 +00:00
annot.Sy = obj
}
return &annot, nil
}
2016-09-07 17:56:45 +00:00
func newPdfAnnotationStampFromDict(d *PdfObjectDictionary) (*PdfAnnotationStamp, error) {
2016-09-05 09:57:16 +00:00
annot := PdfAnnotationStamp{}
markup, err := newPdfAnnotationMarkupFromDict(d)
if err != nil {
return nil, err
}
annot.PdfAnnotationMarkup = markup
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["Name"]; has {
2016-09-05 09:57:16 +00:00
annot.Name = obj
}
return &annot, nil
}
2016-09-07 17:56:45 +00:00
func newPdfAnnotationInkFromDict(d *PdfObjectDictionary) (*PdfAnnotationInk, error) {
2016-09-05 09:57:16 +00:00
annot := PdfAnnotationInk{}
markup, err := newPdfAnnotationMarkupFromDict(d)
if err != nil {
return nil, err
}
annot.PdfAnnotationMarkup = markup
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["InkList"]; has {
2016-09-05 09:57:16 +00:00
annot.InkList = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["BS"]; has {
2016-09-05 09:57:16 +00:00
annot.BS = obj
}
return &annot, nil
}
2016-09-07 17:56:45 +00:00
func newPdfAnnotationPopupFromDict(d *PdfObjectDictionary) (*PdfAnnotationPopup, error) {
2016-09-06 09:33:58 +00:00
annot := PdfAnnotationPopup{}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["Parent"]; has {
2016-09-06 09:33:58 +00:00
annot.Parent = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["Open"]; has {
2016-09-06 09:33:58 +00:00
annot.Open = obj
}
return &annot, nil
2016-09-05 09:57:16 +00:00
}
2016-09-07 17:56:45 +00:00
func newPdfAnnotationFileAttachmentFromDict(d *PdfObjectDictionary) (*PdfAnnotationFileAttachment, error) {
2016-09-06 09:33:58 +00:00
annot := PdfAnnotationFileAttachment{}
markup, err := newPdfAnnotationMarkupFromDict(d)
if err != nil {
return nil, err
}
annot.PdfAnnotationMarkup = markup
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["FS"]; has {
2016-09-06 09:33:58 +00:00
annot.FS = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["Name"]; has {
2016-09-06 09:33:58 +00:00
annot.Name = obj
}
return &annot, nil
2016-09-05 09:57:16 +00:00
}
2016-09-07 17:56:45 +00:00
func newPdfAnnotationSoundFromDict(d *PdfObjectDictionary) (*PdfAnnotationSound, error) {
2016-09-06 09:33:58 +00:00
annot := PdfAnnotationSound{}
markup, err := newPdfAnnotationMarkupFromDict(d)
if err != nil {
return nil, err
}
annot.PdfAnnotationMarkup = markup
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["Name"]; has {
2016-09-06 09:33:58 +00:00
annot.Name = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["Sound"]; has {
2016-09-06 09:33:58 +00:00
annot.Sound = obj
}
return &annot, nil
2016-09-05 09:57:16 +00:00
}
func newPdfAnnotationRichMediaFromDict(d *PdfObjectDictionary) (*PdfAnnotationRichMedia, error) {
annot := &PdfAnnotationRichMedia{}
if obj, has := (*d)["RichMediaSettings"]; has {
annot.RichMediaSettings = obj
}
if obj, has := (*d)["RichMediaContent"]; has {
annot.RichMediaContent = obj
}
return annot, nil
}
2016-09-07 17:56:45 +00:00
func newPdfAnnotationMovieFromDict(d *PdfObjectDictionary) (*PdfAnnotationMovie, error) {
2016-09-06 09:33:58 +00:00
annot := PdfAnnotationMovie{}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["T"]; has {
2016-09-06 09:33:58 +00:00
annot.T = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["Movie"]; has {
2016-09-06 09:33:58 +00:00
annot.Movie = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["A"]; has {
2016-09-06 09:33:58 +00:00
annot.A = obj
}
return &annot, nil
}
2016-09-07 17:56:45 +00:00
func newPdfAnnotationScreenFromDict(d *PdfObjectDictionary) (*PdfAnnotationScreen, error) {
2016-09-06 09:33:58 +00:00
annot := PdfAnnotationScreen{}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["T"]; has {
2016-09-06 09:33:58 +00:00
annot.T = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["MK"]; has {
2016-09-06 09:33:58 +00:00
annot.MK = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["A"]; has {
2016-09-06 09:33:58 +00:00
annot.A = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["AA"]; has {
2016-09-06 09:33:58 +00:00
annot.AA = obj
}
return &annot, nil
}
2016-09-07 17:56:45 +00:00
func newPdfAnnotationWidgetFromDict(d *PdfObjectDictionary) (*PdfAnnotationWidget, error) {
2016-09-06 09:33:58 +00:00
annot := PdfAnnotationWidget{}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["H"]; has {
2016-09-06 09:33:58 +00:00
annot.H = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["MK"]; has {
2016-09-06 09:33:58 +00:00
annot.MK = obj
// MK can be an indirect object...
// Expected to be a dictionary.
2016-09-06 09:33:58 +00:00
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["A"]; has {
2016-09-06 09:33:58 +00:00
annot.A = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["AA"]; has {
2016-09-06 09:33:58 +00:00
annot.AA = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["BS"]; has {
2016-09-06 09:33:58 +00:00
annot.BS = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["Parent"]; has {
2016-09-06 09:33:58 +00:00
annot.Parent = obj
}
return &annot, nil
}
2016-09-07 17:56:45 +00:00
func newPdfAnnotationPrinterMarkFromDict(d *PdfObjectDictionary) (*PdfAnnotationPrinterMark, error) {
2016-09-06 09:33:58 +00:00
annot := PdfAnnotationPrinterMark{}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["MN"]; has {
2016-09-06 09:33:58 +00:00
annot.MN = obj
}
return &annot, nil
}
2016-09-07 17:56:45 +00:00
func newPdfAnnotationTrapNetFromDict(d *PdfObjectDictionary) (*PdfAnnotationTrapNet, error) {
2016-09-06 09:33:58 +00:00
annot := PdfAnnotationTrapNet{}
// empty?e
return &annot, nil
}
2016-09-07 17:56:45 +00:00
func newPdfAnnotationWatermarkFromDict(d *PdfObjectDictionary) (*PdfAnnotationWatermark, error) {
2016-09-06 09:33:58 +00:00
annot := PdfAnnotationWatermark{}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["FixedPrint"]; has {
2016-09-06 09:33:58 +00:00
annot.FixedPrint = obj
}
return &annot, nil
}
2016-09-07 17:56:45 +00:00
func newPdfAnnotation3DFromDict(d *PdfObjectDictionary) (*PdfAnnotation3D, error) {
2016-09-06 09:33:58 +00:00
annot := PdfAnnotation3D{}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["3DD"]; has {
2016-09-06 09:33:58 +00:00
annot.T3DD = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["3DV"]; has {
2016-09-06 09:33:58 +00:00
annot.T3DV = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["3DA"]; has {
2016-09-06 09:33:58 +00:00
annot.T3DA = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["3DI"]; has {
2016-09-06 09:33:58 +00:00
annot.T3DI = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["3DB"]; has {
2016-09-06 09:33:58 +00:00
annot.T3DB = obj
}
return &annot, nil
}
func newPdfAnnotationProjectionFromDict(d *PdfObjectDictionary) (*PdfAnnotationProjection, error) {
annot := &PdfAnnotationProjection{}
markup, err := newPdfAnnotationMarkupFromDict(d)
if err != nil {
return nil, err
}
annot.PdfAnnotationMarkup = markup
return annot, nil
}
2016-09-07 17:56:45 +00:00
func newPdfAnnotationRedactFromDict(d *PdfObjectDictionary) (*PdfAnnotationRedact, error) {
2016-09-06 09:33:58 +00:00
annot := PdfAnnotationRedact{}
markup, err := newPdfAnnotationMarkupFromDict(d)
if err != nil {
return nil, err
}
annot.PdfAnnotationMarkup = markup
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["QuadPoints"]; has {
2016-09-06 09:33:58 +00:00
annot.QuadPoints = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["IC"]; has {
2016-09-06 09:33:58 +00:00
annot.IC = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["RO"]; has {
2016-09-06 09:33:58 +00:00
annot.RO = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["OverlayText"]; has {
2016-09-06 09:33:58 +00:00
annot.OverlayText = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["Repeat"]; has {
2016-09-06 09:33:58 +00:00
annot.Repeat = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["DA"]; has {
2016-09-06 09:33:58 +00:00
annot.DA = obj
}
2016-09-07 17:56:45 +00:00
if obj, has := (*d)["Q"]; has {
2016-09-06 09:33:58 +00:00
annot.Q = obj
}
return &annot, nil
}
func (this *PdfAnnotation) GetContainingPdfObject() PdfObject {
return this.primitive
}
2016-09-06 09:33:58 +00:00
func (this *PdfAnnotation) ToPdfObject() PdfObject {
container := this.primitive
2016-09-06 09:33:58 +00:00
d := container.PdfObject.(*PdfObjectDictionary)
2016-09-07 17:56:45 +00:00
d.SetIfNotNil("Type", MakeName("Annot"))
d.SetIfNotNil("Rect", this.Rect)
d.SetIfNotNil("Contents", this.Contents)
d.SetIfNotNil("P", this.P)
d.SetIfNotNil("NM", this.NM)
d.SetIfNotNil("M", this.M)
d.SetIfNotNil("F", this.F)
2016-09-06 09:33:58 +00:00
d.SetIfNotNil("AP", this.AP)
d.SetIfNotNil("AS", this.AS)
d.SetIfNotNil("Border", this.Border)
d.SetIfNotNil("C", this.C)
2016-09-07 17:56:45 +00:00
d.SetIfNotNil("StructParent", this.StructParent)
d.SetIfNotNil("OC", this.OC)
2016-09-06 09:33:58 +00:00
return container
}
// Markup portion of the annotation.
func (this *PdfAnnotationMarkup) appendToPdfDictionary(d *PdfObjectDictionary) {
d.SetIfNotNil("T", this.T)
d.SetIfNotNil("CA", this.CA)
d.SetIfNotNil("RC", this.RC)
d.SetIfNotNil("CreationDate", this.CreationDate)
d.SetIfNotNil("IRT", this.IRT)
d.SetIfNotNil("Subj", this.Subj)
d.SetIfNotNil("RT", this.RT)
d.SetIfNotNil("IT", this.IT)
d.SetIfNotNil("ExData", this.ExData)
}
func (this *PdfAnnotationText) ToPdfObject() PdfObject {
this.PdfAnnotation.ToPdfObject()
container := this.primitive
2016-09-06 09:33:58 +00:00
d := container.PdfObject.(*PdfObjectDictionary)
this.PdfAnnotationMarkup.appendToPdfDictionary(d)
2016-09-06 09:33:58 +00:00
2016-09-07 17:56:45 +00:00
d.SetIfNotNil("Subtype", MakeName("Text"))
2016-09-06 09:33:58 +00:00
d.SetIfNotNil("Open", this.Open)
d.SetIfNotNil("Name", this.Name)
d.SetIfNotNil("State", this.State)
d.SetIfNotNil("StateModel", this.StateModel)
return container
}
func (this *PdfAnnotationLink) ToPdfObject() PdfObject {
this.PdfAnnotation.ToPdfObject()
container := this.primitive
2016-09-06 09:33:58 +00:00
d := container.PdfObject.(*PdfObjectDictionary)
2016-09-07 17:56:45 +00:00
d.SetIfNotNil("Subtype", MakeName("Link"))
2016-09-06 09:33:58 +00:00
d.SetIfNotNil("A", this.A)
d.SetIfNotNil("Dest", this.Dest)
d.SetIfNotNil("H", this.H)
d.SetIfNotNil("PA", this.PA)
d.SetIfNotNil("QuadPoints", this.QuadPoints)
d.SetIfNotNil("BS", this.BS)
return container
}
func (this *PdfAnnotationFreeText) ToPdfObject() PdfObject {
this.PdfAnnotation.ToPdfObject()
container := this.primitive
2016-09-06 09:33:58 +00:00
d := container.PdfObject.(*PdfObjectDictionary)
this.PdfAnnotationMarkup.appendToPdfDictionary(d)
2016-09-06 09:33:58 +00:00
2016-09-07 17:56:45 +00:00
d.SetIfNotNil("Subtype", MakeName("FreeText"))
2016-09-06 09:33:58 +00:00
d.SetIfNotNil("DA", this.DA)
d.SetIfNotNil("Q", this.Q)
d.SetIfNotNil("RC", this.RC)
d.SetIfNotNil("DS", this.DS)
d.SetIfNotNil("CL", this.CL)
d.SetIfNotNil("IT", this.IT)
d.SetIfNotNil("BE", this.BE)
d.SetIfNotNil("RD", this.RD)
d.SetIfNotNil("BS", this.BS)
d.SetIfNotNil("LE", this.LE)
return container
}
func (this *PdfAnnotationLine) ToPdfObject() PdfObject {
this.PdfAnnotation.ToPdfObject()
container := this.primitive
2016-09-06 09:33:58 +00:00
d := container.PdfObject.(*PdfObjectDictionary)
this.PdfAnnotationMarkup.appendToPdfDictionary(d)
2016-09-06 09:33:58 +00:00
2016-09-07 17:56:45 +00:00
d.SetIfNotNil("Subtype", MakeName("Line"))
2016-09-06 09:33:58 +00:00
d.SetIfNotNil("L", this.L)
d.SetIfNotNil("BS", this.BS)
d.SetIfNotNil("LE", this.LE)
d.SetIfNotNil("IC", this.IC)
d.SetIfNotNil("LL", this.LL)
d.SetIfNotNil("LLE", this.LLE)
d.SetIfNotNil("Cap", this.Cap)
d.SetIfNotNil("IT", this.IT)
d.SetIfNotNil("LLO", this.LLO)
d.SetIfNotNil("CP", this.CP)
d.SetIfNotNil("Measure", this.Measure)
d.SetIfNotNil("CO", this.CO)
return container
}
func (this *PdfAnnotationSquare) ToPdfObject() PdfObject {
this.PdfAnnotation.ToPdfObject()
container := this.primitive
2016-09-06 09:33:58 +00:00
d := container.PdfObject.(*PdfObjectDictionary)
this.PdfAnnotationMarkup.appendToPdfDictionary(d)
2016-09-06 09:33:58 +00:00
2016-09-07 17:56:45 +00:00
d.SetIfNotNil("Subtype", MakeName("Square"))
2016-09-06 09:33:58 +00:00
d.SetIfNotNil("BS", this.BS)
d.SetIfNotNil("IC", this.IC)
d.SetIfNotNil("BE", this.BE)
d.SetIfNotNil("RD", this.RD)
return container
}
func (this *PdfAnnotationCircle) ToPdfObject() PdfObject {
this.PdfAnnotation.ToPdfObject()
container := this.primitive
2016-09-06 09:33:58 +00:00
d := container.PdfObject.(*PdfObjectDictionary)
this.PdfAnnotationMarkup.appendToPdfDictionary(d)
2016-09-06 09:33:58 +00:00
2016-09-07 17:56:45 +00:00
d.SetIfNotNil("Subtype", MakeName("Circle"))
2016-09-06 09:33:58 +00:00
d.SetIfNotNil("BS", this.BS)
d.SetIfNotNil("IC", this.IC)
d.SetIfNotNil("BE", this.BE)
d.SetIfNotNil("RD", this.RD)
return container
}
func (this *PdfAnnotationPolygon) ToPdfObject() PdfObject {
this.PdfAnnotation.ToPdfObject()
container := this.primitive
2016-09-06 09:33:58 +00:00
d := container.PdfObject.(*PdfObjectDictionary)
this.PdfAnnotationMarkup.appendToPdfDictionary(d)
2016-09-06 09:33:58 +00:00
2016-09-07 17:56:45 +00:00
d.SetIfNotNil("Subtype", MakeName("Polygon"))
2016-09-06 09:33:58 +00:00
d.SetIfNotNil("Vertices", this.Vertices)
d.SetIfNotNil("LE", this.LE)
d.SetIfNotNil("BS", this.BS)
d.SetIfNotNil("IC", this.IC)
d.SetIfNotNil("BE", this.BE)
d.SetIfNotNil("IT", this.IT)
d.SetIfNotNil("Measure", this.Measure)
return container
}
func (this *PdfAnnotationPolyLine) ToPdfObject() PdfObject {
this.PdfAnnotation.ToPdfObject()
container := this.primitive
2016-09-06 09:33:58 +00:00
d := container.PdfObject.(*PdfObjectDictionary)
this.PdfAnnotationMarkup.appendToPdfDictionary(d)
2016-09-06 09:33:58 +00:00
2016-09-07 17:56:45 +00:00
d.SetIfNotNil("Subtype", MakeName("PolyLine"))
2016-09-06 09:33:58 +00:00
d.SetIfNotNil("Vertices", this.Vertices)
d.SetIfNotNil("LE", this.LE)
d.SetIfNotNil("BS", this.BS)
d.SetIfNotNil("IC", this.IC)
d.SetIfNotNil("BE", this.BE)
d.SetIfNotNil("IT", this.IT)
d.SetIfNotNil("Measure", this.Measure)
return container
}
func (this *PdfAnnotationHighlight) ToPdfObject() PdfObject {
this.PdfAnnotation.ToPdfObject()
container := this.primitive
2016-09-06 09:33:58 +00:00
d := container.PdfObject.(*PdfObjectDictionary)
this.PdfAnnotationMarkup.appendToPdfDictionary(d)
2016-09-06 09:33:58 +00:00
2016-09-07 17:56:45 +00:00
d.SetIfNotNil("Subtype", MakeName("Highlight"))
2016-09-06 09:33:58 +00:00
d.SetIfNotNil("QuadPoints", this.QuadPoints)
return container
}
func (this *PdfAnnotationUnderline) ToPdfObject() PdfObject {
this.PdfAnnotation.ToPdfObject()
container := this.primitive
2016-09-06 13:51:28 +00:00
d := container.PdfObject.(*PdfObjectDictionary)
this.PdfAnnotationMarkup.appendToPdfDictionary(d)
2016-09-06 13:51:28 +00:00
2016-09-07 17:56:45 +00:00
d.SetIfNotNil("Subtype", MakeName("Underline"))
2016-09-06 13:51:28 +00:00
d.SetIfNotNil("QuadPoints", this.QuadPoints)
return container
2016-09-06 09:33:58 +00:00
}
func (this *PdfAnnotationSquiggly) ToPdfObject() PdfObject {
this.PdfAnnotation.ToPdfObject()
container := this.primitive
2016-09-06 13:51:28 +00:00
d := container.PdfObject.(*PdfObjectDictionary)
this.PdfAnnotationMarkup.appendToPdfDictionary(d)
2016-09-06 13:51:28 +00:00
2016-09-07 17:56:45 +00:00
d.SetIfNotNil("Subtype", MakeName("Squiggly"))
2016-09-06 13:51:28 +00:00
d.SetIfNotNil("QuadPoints", this.QuadPoints)
return container
2016-09-06 09:33:58 +00:00
}
func (this *PdfAnnotationStrikeOut) ToPdfObject() PdfObject {
this.PdfAnnotation.ToPdfObject()
container := this.primitive
2016-09-06 13:51:28 +00:00
d := container.PdfObject.(*PdfObjectDictionary)
this.PdfAnnotationMarkup.appendToPdfDictionary(d)
2016-09-06 13:51:28 +00:00
2016-09-07 17:56:45 +00:00
d.SetIfNotNil("Subtype", MakeName("StrikeOut"))
2016-09-06 13:51:28 +00:00
d.SetIfNotNil("QuadPoints", this.QuadPoints)
return container
2016-09-06 09:33:58 +00:00
}
func (this *PdfAnnotationCaret) ToPdfObject() PdfObject {
this.PdfAnnotation.ToPdfObject()
container := this.primitive
2016-09-06 13:51:28 +00:00
d := container.PdfObject.(*PdfObjectDictionary)
this.PdfAnnotationMarkup.appendToPdfDictionary(d)
2016-09-06 13:51:28 +00:00
2016-09-07 17:56:45 +00:00
d.SetIfNotNil("Subtype", MakeName("Caret"))
2016-09-06 13:51:28 +00:00
d.SetIfNotNil("RD", this.RD)
d.SetIfNotNil("Sy", this.Sy)
return container
2016-09-06 09:33:58 +00:00
}
2016-09-06 13:51:28 +00:00
func (this *PdfAnnotationStamp) ToPdfObject() PdfObject {
this.PdfAnnotation.ToPdfObject()
container := this.primitive
2016-09-06 13:51:28 +00:00
d := container.PdfObject.(*PdfObjectDictionary)
this.PdfAnnotationMarkup.appendToPdfDictionary(d)
2016-09-06 13:51:28 +00:00
2016-09-07 17:56:45 +00:00
d.SetIfNotNil("Subtype", MakeName("Stamp"))
2016-09-06 13:51:28 +00:00
d.SetIfNotNil("Name", this.Name)
return container
2016-09-06 09:33:58 +00:00
}
func (this *PdfAnnotationInk) ToPdfObject() PdfObject {
this.PdfAnnotation.ToPdfObject()
container := this.primitive
2016-09-06 13:51:28 +00:00
d := container.PdfObject.(*PdfObjectDictionary)
this.PdfAnnotationMarkup.appendToPdfDictionary(d)
2016-09-06 13:51:28 +00:00
2016-09-07 17:56:45 +00:00
d.SetIfNotNil("Subtype", MakeName("Ink"))
2016-09-06 13:51:28 +00:00
d.SetIfNotNil("InkList", this.InkList)
d.SetIfNotNil("BS", this.BS)
return container
2016-09-06 09:33:58 +00:00
}
func (this *PdfAnnotationPopup) ToPdfObject() PdfObject {
this.PdfAnnotation.ToPdfObject()
container := this.primitive
2016-09-06 13:51:28 +00:00
d := container.PdfObject.(*PdfObjectDictionary)
2016-09-07 17:56:45 +00:00
d.SetIfNotNil("Subtype", MakeName("Popup"))
2016-09-06 13:51:28 +00:00
d.SetIfNotNil("Parent", this.Parent)
d.SetIfNotNil("Open", this.Open)
return container
2016-09-06 09:33:58 +00:00
}
func (this *PdfAnnotationFileAttachment) ToPdfObject() PdfObject {
this.PdfAnnotation.ToPdfObject()
container := this.primitive
2016-09-06 13:51:28 +00:00
d := container.PdfObject.(*PdfObjectDictionary)
this.PdfAnnotationMarkup.appendToPdfDictionary(d)
2016-09-06 13:51:28 +00:00
2016-09-07 17:56:45 +00:00
d.SetIfNotNil("Subtype", MakeName("FileAttachment"))
2016-09-06 13:51:28 +00:00
d.SetIfNotNil("FS", this.FS)
d.SetIfNotNil("Name", this.Name)
return container
2016-09-05 09:57:16 +00:00
}
func (this *PdfAnnotationRichMedia) ToPdfObject() PdfObject {
this.PdfAnnotation.ToPdfObject()
container := this.primitive
d := container.PdfObject.(*PdfObjectDictionary)
d.SetIfNotNil("Subtype", MakeName("RichMedia"))
d.SetIfNotNil("RichMediaSettings", this.RichMediaSettings)
d.SetIfNotNil("RichMediaContent", this.RichMediaContent)
return container
}
func (this *PdfAnnotationSound) ToPdfObject() PdfObject {
this.PdfAnnotation.ToPdfObject()
container := this.primitive
2016-09-06 13:51:28 +00:00
d := container.PdfObject.(*PdfObjectDictionary)
this.PdfAnnotationMarkup.appendToPdfDictionary(d)
2016-09-05 09:57:16 +00:00
2016-09-07 17:56:45 +00:00
d.SetIfNotNil("Subtype", MakeName("Sound"))
2016-09-06 13:51:28 +00:00
d.SetIfNotNil("Sound", this.Sound)
d.SetIfNotNil("Name", this.Name)
return container
2016-09-06 09:33:58 +00:00
}
func (this *PdfAnnotationMovie) ToPdfObject() PdfObject {
this.PdfAnnotation.ToPdfObject()
container := this.primitive
2016-09-06 13:51:28 +00:00
d := container.PdfObject.(*PdfObjectDictionary)
2016-09-05 09:57:16 +00:00
2016-09-07 17:56:45 +00:00
d.SetIfNotNil("Subtype", MakeName("Movie"))
2016-09-06 13:51:28 +00:00
d.SetIfNotNil("T", this.T)
d.SetIfNotNil("Movie", this.Movie)
d.SetIfNotNil("A", this.A)
return container
2016-09-05 09:57:16 +00:00
}
func (this *PdfAnnotationScreen) ToPdfObject() PdfObject {
this.PdfAnnotation.ToPdfObject()
container := this.primitive
2016-09-06 13:51:28 +00:00
d := container.PdfObject.(*PdfObjectDictionary)
2016-09-05 09:57:16 +00:00
2016-09-07 17:56:45 +00:00
d.SetIfNotNil("Subtype", MakeName("Screen"))
2016-09-06 13:51:28 +00:00
d.SetIfNotNil("T", this.T)
d.SetIfNotNil("MK", this.MK)
d.SetIfNotNil("A", this.A)
d.SetIfNotNil("AA", this.AA)
return container
2016-09-05 09:57:16 +00:00
}
func (this *PdfAnnotationWidget) ToPdfObject() PdfObject {
this.PdfAnnotation.ToPdfObject()
container := this.primitive
2016-09-06 13:51:28 +00:00
d := container.PdfObject.(*PdfObjectDictionary)
2016-09-07 17:56:45 +00:00
d.SetIfNotNil("Subtype", MakeName("Widget"))
2016-09-06 13:51:28 +00:00
d.SetIfNotNil("H", this.H)
d.SetIfNotNil("MK", this.MK)
d.SetIfNotNil("A", this.A)
d.SetIfNotNil("AA", this.AA)
d.SetIfNotNil("BS", this.BS)
d.SetIfNotNil("Parent", this.Parent)
2016-09-06 13:51:28 +00:00
return container
2016-09-06 09:33:58 +00:00
}
func (this *PdfAnnotationPrinterMark) ToPdfObject() PdfObject {
this.PdfAnnotation.ToPdfObject()
container := this.primitive
2016-09-06 13:51:28 +00:00
d := container.PdfObject.(*PdfObjectDictionary)
2016-09-07 17:56:45 +00:00
d.SetIfNotNil("Subtype", MakeName("PrinterMark"))
2016-09-06 13:51:28 +00:00
d.SetIfNotNil("MN", this.MN)
return container
2016-09-05 09:57:16 +00:00
}
2016-09-06 13:51:28 +00:00
func (this *PdfAnnotationTrapNet) ToPdfObject() PdfObject {
this.PdfAnnotation.ToPdfObject()
container := this.primitive
2016-09-07 17:56:45 +00:00
d := container.PdfObject.(*PdfObjectDictionary)
2016-09-07 17:56:45 +00:00
d.SetIfNotNil("Subtype", MakeName("PrinterMark"))
2016-09-06 13:51:28 +00:00
return container
2016-09-05 09:57:16 +00:00
}
func (this *PdfAnnotationWatermark) ToPdfObject() PdfObject {
this.PdfAnnotation.ToPdfObject()
container := this.primitive
2016-09-06 13:51:28 +00:00
d := container.PdfObject.(*PdfObjectDictionary)
2016-09-07 17:56:45 +00:00
d.SetIfNotNil("Subtype", MakeName("Watermark"))
2016-09-06 13:51:28 +00:00
d.SetIfNotNil("FixedPrint", this.FixedPrint)
2016-09-06 13:51:28 +00:00
return container
2016-09-05 09:57:16 +00:00
}
func (this *PdfAnnotation3D) ToPdfObject() PdfObject {
this.PdfAnnotation.ToPdfObject()
container := this.primitive
2016-09-06 13:51:28 +00:00
d := container.PdfObject.(*PdfObjectDictionary)
2016-09-07 17:56:45 +00:00
d.SetIfNotNil("Subtype", MakeName("3D"))
2016-09-06 13:51:28 +00:00
d.SetIfNotNil("3DD", this.T3DD)
d.SetIfNotNil("3DV", this.T3DV)
d.SetIfNotNil("3DA", this.T3DA)
d.SetIfNotNil("3DI", this.T3DI)
d.SetIfNotNil("3DB", this.T3DB)
return container
}
func (this *PdfAnnotationProjection) ToPdfObject() PdfObject {
this.PdfAnnotation.ToPdfObject()
container := this.primitive
d := container.PdfObject.(*PdfObjectDictionary)
this.PdfAnnotationMarkup.appendToPdfDictionary(d)
return container
}
func (this *PdfAnnotationRedact) ToPdfObject() PdfObject {
this.PdfAnnotation.ToPdfObject()
container := this.primitive
2016-09-06 13:51:28 +00:00
d := container.PdfObject.(*PdfObjectDictionary)
this.PdfAnnotationMarkup.appendToPdfDictionary(d)
2016-09-05 09:57:16 +00:00
2016-09-07 17:56:45 +00:00
d.SetIfNotNil("Subtype", MakeName("Redact"))
2016-09-06 13:51:28 +00:00
d.SetIfNotNil("QuadPoints", this.QuadPoints)
d.SetIfNotNil("IC", this.IC)
d.SetIfNotNil("RO", this.RO)
d.SetIfNotNil("OverlayText", this.OverlayText)
d.SetIfNotNil("Repeat", this.Repeat)
d.SetIfNotNil("DA", this.DA)
d.SetIfNotNil("Q", this.Q)
return container
}