mirror of
https://github.com/unidoc/unipdf.git
synced 2025-05-02 22:17:06 +08:00
4994 lines
742 KiB
Go
4994 lines
742 KiB
Go
//
|
||
// Copyright 2020 FoxyUtils ehf. All rights reserved.
|
||
//
|
||
// This is a commercial product and requires a license to operate.
|
||
// A trial license can be obtained at https://unidoc.io
|
||
//
|
||
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
|
||
//
|
||
// Use of this source code is governed by the UniDoc End User License Agreement
|
||
// terms that can be accessed at https://unidoc.io/eula/
|
||
|
||
// Package model provides an interface for working with high-level objects (models) in PDF files, including
|
||
// reading and writing documents.
|
||
//
|
||
// The document structure of a PDF is constructed of a hierarchy of data models, representing a tree
|
||
// of information starting from the Document catalog (Figure 5 p. 80).
|
||
// It is based on the core package which handles core functionality such as file i/o, parsing and
|
||
// handling of primitive PDF objects (core.PdfObject).
|
||
//
|
||
// As an example of the interface, the following snippet can read the PDF and output the number of pages:
|
||
//
|
||
// f, err := os.Open(inputPath)
|
||
// if err != nil {
|
||
// return nil, err
|
||
// }
|
||
// defer f.Close()
|
||
// pdfReader, err := unipdf.NewPdfReader(f)
|
||
// if err != nil {
|
||
// fmt.Printf("Failed to read PDF file: %v\n", err)
|
||
// os.Exit(1)
|
||
// }
|
||
// numPages, err := pdfReader.GetNumPages()
|
||
// if err != nil {
|
||
// fmt.Printf("Failed to get number of pages: %v\n", err)
|
||
// os.Exit(1)
|
||
// }
|
||
// fmt.Printf("The PDF file has %d pages\n", numPages)
|
||
//
|
||
// For more examples, see the unidoc-examples repository on GitHub: https://github.com/unidoc/unidoc-examples
|
||
package model ;import (_da "bufio";_cb "bytes";_fd "crypto/md5";_eg "crypto/rand";_gee "crypto/sha1";_ge "crypto/x509";_df "encoding/binary";_ed "encoding/hex";_ce "errors";_d "fmt";_ffe "github.com/unidoc/pkcs7";_aa "github.com/unidoc/unipdf/v3/common";
|
||
_fg "github.com/unidoc/unipdf/v3/core";_gb "github.com/unidoc/unipdf/v3/core/security";_bgf "github.com/unidoc/unipdf/v3/core/security/crypt";_fc "github.com/unidoc/unipdf/v3/internal/cmap";_cc "github.com/unidoc/unipdf/v3/internal/imageutil";_bec "github.com/unidoc/unipdf/v3/internal/license";
|
||
_ade "github.com/unidoc/unipdf/v3/internal/sampling";_dg "github.com/unidoc/unipdf/v3/internal/textencoding";_ag "github.com/unidoc/unipdf/v3/internal/timeutils";_gbe "github.com/unidoc/unipdf/v3/internal/transform";_dab "github.com/unidoc/unipdf/v3/model/internal/docutil";
|
||
_eed "github.com/unidoc/unipdf/v3/model/internal/fonts";_gbb "github.com/unidoc/unipdf/v3/model/mdp";_af "github.com/unidoc/unipdf/v3/model/sigutil";_bc "github.com/unidoc/unipdf/v3/ps";_eee "github.com/unidoc/unitype";_bb "golang.org/x/xerrors";_e "hash";
|
||
_ac "image";_be "image/color";_ "image/gif";_ "image/png";_ff "io";_ga "io/ioutil";_ef "math";_bf "math/rand";_c "os";_ee "regexp";_ad "sort";_bad "strconv";_dc "strings";_f "sync";_g "time";_dfa "unicode";_bg "unicode/utf8";);
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_egcbc *PdfAnnotationCircle )ToPdfObject ()_fg .PdfObject {_egcbc .PdfAnnotation .ToPdfObject ();_cfccc :=_egcbc ._agb ;_aed :=_cfccc .PdfObject .(*_fg .PdfObjectDictionary );_egcbc .PdfAnnotationMarkup .appendToPdfDictionary (_aed );_aed .SetIfNotNil ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u0043\u0069\u0072\u0063\u006c\u0065"));
|
||
_aed .SetIfNotNil ("\u0042\u0053",_egcbc .BS );_aed .SetIfNotNil ("\u0049\u0043",_egcbc .IC );_aed .SetIfNotNil ("\u0042\u0045",_egcbc .BE );_aed .SetIfNotNil ("\u0052\u0044",_egcbc .RD );return _cfccc ;};
|
||
|
||
// Width returns the width of `rect`.
|
||
func (_dgeg *PdfRectangle )Width ()float64 {return _ef .Abs (_dgeg .Urx -_dgeg .Llx )};
|
||
|
||
// EncryptionAlgorithm is used in EncryptOptions to change the default algorithm used to encrypt the document.
|
||
type EncryptionAlgorithm int ;
|
||
|
||
// NewPdfColorPatternType2 returns an empty color shading pattern type 2 (Axial).
|
||
func NewPdfColorPatternType2 ()*PdfColorPatternType2 {_fbbdf :=&PdfColorPatternType2 {};return _fbbdf ;};
|
||
|
||
// AddCRLs adds CRLs to DSS.
|
||
func (_gacb *DSS )AddCRLs (crls [][]byte )([]*_fg .PdfObjectStream ,error ){return _gacb .add (&_gacb .CRLs ,_gacb ._fdcc ,crls );};
|
||
|
||
// NewPdfColorspaceDeviceCMYK returns a new CMYK32 colorspace object.
|
||
func NewPdfColorspaceDeviceCMYK ()*PdfColorspaceDeviceCMYK {return &PdfColorspaceDeviceCMYK {}};func (_dgcgc *PdfAcroForm )fill (_ebbac FieldValueProvider ,_adff FieldAppearanceGenerator )error {if _dgcgc ==nil {return nil ;};_caabf ,_daadf :=_ebbac .FieldValues ();
|
||
if _daadf !=nil {return _daadf ;};for _ ,_cagcf :=range _dgcgc .AllFields (){_bfagf :=_cagcf .PartialName ();_cgbgd ,_fcbgf :=_caabf [_bfagf ];if !_fcbgf {if _aacbg ,_cfbe :=_cagcf .FullName ();_cfbe ==nil {_cgbgd ,_fcbgf =_caabf [_aacbg ];};};if !_fcbgf {_aa .Log .Debug ("\u0057\u0041\u0052\u004e\u003a\u0020f\u006f\u0072\u006d \u0066\u0069\u0065l\u0064\u0020\u0025\u0073\u0020\u006e\u006f\u0074\u0020\u0066o\u0075\u006e\u0064\u0020\u0069n \u0074\u0068\u0065\u0020\u0070\u0072\u006f\u0076\u0069\u0064\u0065\u0072\u002e\u0020\u0053\u006b\u0069\u0070\u0070\u0069\u006e\u0067\u002e",_bfagf );
|
||
continue ;};if _fagaf :=_dcbce (_cagcf ,_cgbgd );_fagaf !=nil {return _fagaf ;};if _adff ==nil {continue ;};for _ ,_ccgad :=range _cagcf .Annotations {_gbde ,_ddfc :=_adff .GenerateAppearanceDict (_dgcgc ,_cagcf ,_ccgad );if _ddfc !=nil {return _ddfc ;
|
||
};_ccgad .AP =_gbde ;_ccgad .ToPdfObject ();};};return nil ;};
|
||
|
||
// PdfAnnotationMarkup represents additional fields for mark-up annotations.
|
||
// (Section 12.5.6.2 p. 399).
|
||
type PdfAnnotationMarkup struct{T _fg .PdfObject ;Popup *PdfAnnotationPopup ;CA _fg .PdfObject ;RC _fg .PdfObject ;CreationDate _fg .PdfObject ;IRT _fg .PdfObject ;Subj _fg .PdfObject ;RT _fg .PdfObject ;IT _fg .PdfObject ;ExData _fg .PdfObject ;};
|
||
|
||
// NewPdfColorspaceCalRGB returns a new CalRGB colorspace object.
|
||
func NewPdfColorspaceCalRGB ()*PdfColorspaceCalRGB {_deddb :=&PdfColorspaceCalRGB {};_deddb .BlackPoint =[]float64 {0.0,0.0,0.0};_deddb .Gamma =[]float64 {1.0,1.0,1.0};_deddb .Matrix =[]float64 {1,0,0,0,1,0,0,0,1};return _deddb ;};var _cdaa =_ee .MustCompile ("\u005b\\\u006e\u005c\u0072\u005d\u002b");
|
||
|
||
|
||
// AnnotFilterFunc represents a PDF annotation filtering function. If the function
|
||
// returns true, the annotation is kept, otherwise it is discarded.
|
||
type AnnotFilterFunc func (*PdfAnnotation )bool ;
|
||
|
||
// SetAnnotations sets the annotations list.
|
||
func (_ccdbd *PdfPage )SetAnnotations (annotations []*PdfAnnotation ){_ccdbd ._fbbb =annotations };
|
||
|
||
// SetContext sets the sub annotation (context).
|
||
func (_fgag *PdfAnnotation )SetContext (ctx PdfModel ){_fgag ._cbea =ctx };
|
||
|
||
// PdfColorspaceLab is a L*, a*, b* 3 component colorspace.
|
||
type PdfColorspaceLab struct{WhitePoint []float64 ;BlackPoint []float64 ;Range []float64 ;_fabgc *_fg .PdfIndirectObject ;};
|
||
|
||
// Subtype returns the font's "Subtype" field.
|
||
func (_cebeb *PdfFont )Subtype ()string {_fegaf :=_cebeb .baseFields ()._ggcfc ;if _aeaf ,_acdc :=_cebeb ._gcaeff .(*pdfFontType0 );_acdc {_fegaf =_fegaf +"\u003a"+_aeaf .DescendantFont .Subtype ();};return _fegaf ;};func _afggf ()string {_baacg .Lock ();
|
||
defer _baacg .Unlock ();return _dfeegf };
|
||
|
||
// GetStructRoot gets the StructTreeRoot object
|
||
func (_fabgd *PdfPage )GetStructTreeRoot ()(*_fg .PdfObject ,bool ){_edaab ,_gdefb :=_fabgd ._dedef .GetCatalogStructTreeRoot ();return &_edaab ,_gdefb ;};
|
||
|
||
// GetModelFromPrimitive returns the model corresponding to the `primitive` PdfObject.
|
||
func (_egdfb *modelManager )GetModelFromPrimitive (primitive _fg .PdfObject )PdfModel {model ,_bggaf :=_egdfb ._fbbfaf [primitive ];if !_bggaf {return nil ;};return model ;};
|
||
|
||
// NewPdfColorspaceDeviceGray returns a new grayscale colorspace.
|
||
func NewPdfColorspaceDeviceGray ()*PdfColorspaceDeviceGray {return &PdfColorspaceDeviceGray {}};
|
||
|
||
// GetContainingPdfObject implements interface PdfModel.
|
||
func (_fggd *PdfAnnotation )GetContainingPdfObject ()_fg .PdfObject {return _fggd ._agb };
|
||
|
||
// PdfColorspaceDeviceCMYK represents a CMYK32 colorspace.
|
||
type PdfColorspaceDeviceCMYK struct{};func (_abada *pdfFontType0 )bytesToCharcodes (_egae []byte )([]_dg .CharCode ,bool ){if _abada ._abeac ==nil {return nil ,false ;};_ebgdc ,_ebgce :=_abada ._abeac .BytesToCharcodes (_egae );if !_ebgce {return nil ,false ;
|
||
};_cece :=make ([]_dg .CharCode ,len (_ebgdc ));for _efccb ,_bfadc :=range _ebgdc {_cece [_efccb ]=_dg .CharCode (_bfadc );};return _cece ,true ;};func (_egcca *PdfSignature )extractChainFromCert ()([]*_ge .Certificate ,error ){var _cdeaa *_fg .PdfObjectArray ;
|
||
switch _gdfd :=_egcca .Cert .(type ){case *_fg .PdfObjectString :_cdeaa =_fg .MakeArray (_gdfd );case *_fg .PdfObjectArray :_cdeaa =_gdfd ;default:return nil ,_d .Errorf ("\u0069n\u0076\u0061l\u0069\u0064\u0020s\u0069\u0067\u006e\u0061\u0074\u0075\u0072e\u0020\u0063\u0065\u0072\u0074\u0069f\u0069\u0063\u0061\u0074\u0065\u0020\u006f\u0062\u006a\u0065\u0063t\u0020\u0074\u0079\u0070\u0065\u003a\u0020\u0025\u0054",_gdfd );
|
||
};var _dddae _cb .Buffer ;for _ ,_fdgad :=range _cdeaa .Elements (){_ccbed ,_adda :=_fg .GetString (_fdgad );if !_adda {return nil ,_d .Errorf ("\u0069\u006ev\u0061\u006c\u0069\u0064\u0020\u0063\u0065\u0072\u0074\u0069\u0066\u0069\u0063\u0061\u0074\u0065\u0020\u006f\u0062j\u0065\u0063\u0074\u0020\u0074\u0079p\u0065\u0020\u0069\u006e\u0020\u0073\u0069\u0067\u006e\u0061\u0074\u0075\u0072\u0065 \u0063\u0065r\u0074\u0069\u0066\u0069c\u0061\u0074\u0065\u0020\u0063h\u0061\u0069\u006e\u003a\u0020\u0025\u0054",_fdgad );
|
||
};if _ ,_efbff :=_dddae .Write (_ccbed .Bytes ());_efbff !=nil {return nil ,_efbff ;};};return _ge .ParseCertificates (_dddae .Bytes ());};
|
||
|
||
// CheckAccessRights checks access rights and permissions for a specified password. If either user/owner
|
||
// password is specified, full rights are granted, otherwise the access rights are specified by the
|
||
// Permissions flag.
|
||
//
|
||
// The bool flag indicates that the user can access and view the file.
|
||
// The AccessPermissions shows what access the user has for editing etc.
|
||
// An error is returned if there was a problem performing the authentication.
|
||
func (_dbfad *PdfReader )CheckAccessRights (password []byte )(bool ,_gb .Permissions ,error ){return _dbfad ._ccgg .CheckAccessRights (password );};func (_dafc *DSS )add (_ddfg *[]*_fg .PdfObjectStream ,_feaa map[string ]*_fg .PdfObjectStream ,_fgga [][]byte )([]*_fg .PdfObjectStream ,error ){_cegd :=make ([]*_fg .PdfObjectStream ,0,len (_fgga ));
|
||
for _ ,_dgea :=range _fgga {_daef ,_cbgc :=_egbc (_dgea );if _cbgc !=nil {return nil ,_cbgc ;};_fbged ,_baccc :=_feaa [string (_daef )];if !_baccc {_fbged ,_cbgc =_fg .MakeStream (_dgea ,_fg .NewRawEncoder ());if _cbgc !=nil {return nil ,_cbgc ;};_feaa [string (_daef )]=_fbged ;
|
||
*_ddfg =append (*_ddfg ,_fbged );};_cegd =append (_cegd ,_fbged );};return _cegd ,nil ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_befb *PdfAnnotationLine )ToPdfObject ()_fg .PdfObject {_befb .PdfAnnotation .ToPdfObject ();_aggd :=_befb ._agb ;_ccf :=_aggd .PdfObject .(*_fg .PdfObjectDictionary );_befb .PdfAnnotationMarkup .appendToPdfDictionary (_ccf );_ccf .SetIfNotNil ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u004c\u0069\u006e\u0065"));
|
||
_ccf .SetIfNotNil ("\u004c",_befb .L );_ccf .SetIfNotNil ("\u0042\u0053",_befb .BS );_ccf .SetIfNotNil ("\u004c\u0045",_befb .LE );_ccf .SetIfNotNil ("\u0049\u0043",_befb .IC );_ccf .SetIfNotNil ("\u004c\u004c",_befb .LL );_ccf .SetIfNotNil ("\u004c\u004c\u0045",_befb .LLE );
|
||
_ccf .SetIfNotNil ("\u0043\u0061\u0070",_befb .Cap );_ccf .SetIfNotNil ("\u0049\u0054",_befb .IT );_ccf .SetIfNotNil ("\u004c\u004c\u004f",_befb .LLO );_ccf .SetIfNotNil ("\u0043\u0050",_befb .CP );_ccf .SetIfNotNil ("\u004de\u0061\u0073\u0075\u0072\u0065",_befb .Measure );
|
||
_ccf .SetIfNotNil ("\u0043\u004f",_befb .CO );return _aggd ;};func (_gcd *PdfReader )newPdfActionHideFromDict (_dedd *_fg .PdfObjectDictionary )(*PdfActionHide ,error ){return &PdfActionHide {T :_dedd .Get ("\u0054"),H :_dedd .Get ("\u0048")},nil ;};
|
||
|
||
// NewPdfActionSound returns a new "sound" action.
|
||
func NewPdfActionSound ()*PdfActionSound {_cbe :=NewPdfAction ();_cf :=&PdfActionSound {};_cf .PdfAction =_cbe ;_cbe .SetContext (_cf );return _cf ;};func (_ecgeb *PdfWriter )writeAcroFormFields ()error {if _ecgeb ._feaea ==nil {return nil ;};_aa .Log .Trace ("\u0057r\u0069t\u0069\u006e\u0067\u0020\u0061c\u0072\u006f \u0066\u006f\u0072\u006d\u0073");
|
||
_ceaaf :=_ecgeb ._feaea .ToPdfObject ();_aa .Log .Trace ("\u0041\u0063\u0072\u006f\u0046\u006f\u0072\u006d\u003a\u0020\u0025\u002b\u0076",_ceaaf );_ecgeb ._cgacf .Set ("\u0041\u0063\u0072\u006f\u0046\u006f\u0072\u006d",_ceaaf );_eedeec :=_ecgeb .addObjects (_ceaaf );
|
||
if _eedeec !=nil {return _eedeec ;};return nil ;};
|
||
|
||
// NewGrayImageFromGoImage creates a new grayscale unidoc Image from a golang Image.
|
||
func (_cbffe DefaultImageHandler )NewGrayImageFromGoImage (goimg _ac .Image )(*Image ,error ){_bbede :=goimg .Bounds ();_dgagbd :=&Image {Width :int64 (_bbede .Dx ()),Height :int64 (_bbede .Dy ()),ColorComponents :1,BitsPerComponent :8};switch _egdbf :=goimg .(type ){case *_ac .Gray :if len (_egdbf .Pix )!=_bbede .Dx ()*_bbede .Dy (){_dbbcc ,_afeef :=_cc .GrayConverter .Convert (goimg );
|
||
if _afeef !=nil {return nil ,_afeef ;};_dgagbd .Data =_dbbcc .Pix ();}else {_dgagbd .Data =_egdbf .Pix ;};case *_ac .Gray16 :_dgagbd .BitsPerComponent =16;if len (_egdbf .Pix )!=_bbede .Dx ()*_bbede .Dy ()*2{_cgfae ,_bfbge :=_cc .Gray16Converter .Convert (goimg );
|
||
if _bfbge !=nil {return nil ,_bfbge ;};_dgagbd .Data =_cgfae .Pix ();}else {_dgagbd .Data =_egdbf .Pix ;};case _cc .Image :_fafcb :=_egdbf .Base ();if _fafcb .ColorComponents ==1{_dgagbd .BitsPerComponent =int64 (_fafcb .BitsPerComponent );_dgagbd .Data =_fafcb .Data ;
|
||
return _dgagbd ,nil ;};_badea ,_fdbfc :=_cc .GrayConverter .Convert (goimg );if _fdbfc !=nil {return nil ,_fdbfc ;};_dgagbd .Data =_badea .Pix ();default:_ebgaa ,_bbbc :=_cc .GrayConverter .Convert (goimg );if _bbbc !=nil {return nil ,_bbbc ;};_dgagbd .Data =_ebgaa .Pix ();
|
||
};return _dgagbd ,nil ;};
|
||
|
||
// GetContext returns the annotation context which contains the specific type-dependent context.
|
||
// The context represents the subannotation.
|
||
func (_acc *PdfAnnotation )GetContext ()PdfModel {if _acc ==nil {return nil ;};return _acc ._cbea ;};
|
||
|
||
// NewPdfAnnotationPopup returns a new popup annotation.
|
||
func NewPdfAnnotationPopup ()*PdfAnnotationPopup {_dcba :=NewPdfAnnotation ();_cgg :=&PdfAnnotationPopup {};_cgg .PdfAnnotation =_dcba ;_dcba .SetContext (_cgg );return _cgg ;};
|
||
|
||
// Flags returns the field flags for the field accounting for any inherited flags.
|
||
func (_ddfa *PdfField )Flags ()FieldFlag {var _ceff FieldFlag ;_dgag ,_agfebc :=_ddfa .inherit (func (_fbcad *PdfField )bool {if _fbcad .Ff !=nil {_ceff =FieldFlag (*_fbcad .Ff );return true ;};return false ;});if _agfebc !=nil {_aa .Log .Debug ("\u0045\u0072\u0072o\u0072\u0020\u0065\u0076\u0061\u006c\u0075\u0061\u0074\u0069\u006e\u0067\u0020\u0066\u006c\u0061\u0067\u0073\u0020\u0076\u0069\u0061\u0020\u0069\u006e\u0068\u0065\u0072\u0069t\u0061\u006e\u0063\u0065\u003a\u0020\u0025\u0076",_agfebc );
|
||
};if !_dgag {_aa .Log .Trace ("N\u006f\u0020\u0066\u0069\u0065\u006cd\u0020\u0066\u006c\u0061\u0067\u0073 \u0066\u006f\u0075\u006e\u0064\u0020\u002d \u0061\u0073\u0073\u0075\u006d\u0065\u0020\u0063\u006c\u0065a\u0072");};return _ceff ;};
|
||
|
||
// NewPdfAnnotation3D returns a new 3d annotation.
|
||
func NewPdfAnnotation3D ()*PdfAnnotation3D {_cfab :=NewPdfAnnotation ();_eeda :=&PdfAnnotation3D {};_eeda .PdfAnnotation =_cfab ;_cfab .SetContext (_eeda );return _eeda ;};
|
||
|
||
// ColorFromFloats returns a new PdfColor based on the input slice of color
|
||
// components.
|
||
func (_fdac *PdfColorspaceSpecialPattern )ColorFromFloats (vals []float64 )(PdfColor ,error ){if _fdac .UnderlyingCS ==nil {return nil ,_ce .New ("u\u006e\u0064\u0065\u0072\u006c\u0079i\u006e\u0067\u0020\u0043\u0053\u0020\u006e\u006f\u0074 \u0073\u0070\u0065c\u0069f\u0069\u0065\u0064");
|
||
};return _fdac .UnderlyingCS .ColorFromFloats (vals );};
|
||
|
||
// SetBorderWidth sets the style's border width.
|
||
func (_cgfa *PdfBorderStyle )SetBorderWidth (width float64 ){_cgfa .W =&width };
|
||
|
||
// IsShading specifies if the pattern is a shading pattern.
|
||
func (_ddeed *PdfPattern )IsShading ()bool {return _ddeed .PatternType ==2};func (_eaff *PdfColorspaceCalGray )String ()string {return "\u0043a\u006c\u0047\u0072\u0061\u0079"};func (_fddg *PdfPage )getParentResources ()(*PdfPageResources ,error ){_edbd :=_fddg .Parent ;
|
||
for _edbd !=nil {_ccbdce ,_gbagc :=_fg .GetDict (_edbd );if !_gbagc {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0069\u006e\u0076\u0061l\u0069\u0064\u0020\u0070\u0061\u0072\u0065\u006e\u0074\u0020n\u006f\u0064\u0065");return nil ,_ce .New ("i\u006e\u0076\u0061\u006cid\u0020p\u0061\u0072\u0065\u006e\u0074 \u006f\u0062\u006a\u0065\u0063\u0074");
|
||
};if _cdce :=_ccbdce .Get ("\u0052e\u0073\u006f\u0075\u0072\u0063\u0065s");_cdce !=nil {_cgabe ,_defcc :=_fg .GetDict (_cdce );if !_defcc {return nil ,_ce .New ("i\u006e\u0076\u0061\u006cid\u0020r\u0065\u0073\u006f\u0075\u0072c\u0065\u0020\u0064\u0069\u0063\u0074");
|
||
};_cafce ,_fcbbd :=NewPdfPageResourcesFromDict (_cgabe );if _fcbbd !=nil {return nil ,_fcbbd ;};return _cafce ,nil ;};_edbd =_ccbdce .Get ("\u0050\u0061\u0072\u0065\u006e\u0074");};return nil ,nil ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_abfba *PdfAnnotationPrinterMark )ToPdfObject ()_fg .PdfObject {_abfba .PdfAnnotation .ToPdfObject ();_bdbg :=_abfba ._agb ;_bcfd :=_bdbg .PdfObject .(*_fg .PdfObjectDictionary );_bcfd .SetIfNotNil ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("P\u0072\u0069\u006e\u0074\u0065\u0072\u004d\u0061\u0072\u006b"));
|
||
_bcfd .SetIfNotNil ("\u004d\u004e",_abfba .MN );return _bdbg ;};func _ffaa (_ggfg *fontCommon )*pdfCIDFontType2 {return &pdfCIDFontType2 {fontCommon :*_ggfg }};
|
||
|
||
// ToPdfObject returns colorspace in a PDF object format [name dictionary]
|
||
func (_gdf *PdfColorspaceLab )ToPdfObject ()_fg .PdfObject {_dcbaf :=_fg .MakeArray ();_dcbaf .Append (_fg .MakeName ("\u004c\u0061\u0062"));_deca :=_fg .MakeDict ();if _gdf .WhitePoint !=nil {_fbdd :=_fg .MakeArray (_fg .MakeFloat (_gdf .WhitePoint [0]),_fg .MakeFloat (_gdf .WhitePoint [1]),_fg .MakeFloat (_gdf .WhitePoint [2]));
|
||
_deca .Set ("\u0057\u0068\u0069\u0074\u0065\u0050\u006f\u0069\u006e\u0074",_fbdd );}else {_aa .Log .Error ("\u004c\u0061\u0062: \u004d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0057h\u0069t\u0065P\u006fi\u006e\u0074\u0020\u0028\u0052\u0065\u0071\u0075\u0069\u0072\u0065\u0064\u0029");
|
||
};if _gdf .BlackPoint !=nil {_cdga :=_fg .MakeArray (_fg .MakeFloat (_gdf .BlackPoint [0]),_fg .MakeFloat (_gdf .BlackPoint [1]),_fg .MakeFloat (_gdf .BlackPoint [2]));_deca .Set ("\u0042\u006c\u0061\u0063\u006b\u0050\u006f\u0069\u006e\u0074",_cdga );};
|
||
if _gdf .Range !=nil {_edafd :=_fg .MakeArray (_fg .MakeFloat (_gdf .Range [0]),_fg .MakeFloat (_gdf .Range [1]),_fg .MakeFloat (_gdf .Range [2]),_fg .MakeFloat (_gdf .Range [3]));_deca .Set ("\u0052\u0061\u006eg\u0065",_edafd );};_dcbaf .Append (_deca );
|
||
if _gdf ._fabgc !=nil {_gdf ._fabgc .PdfObject =_dcbaf ;return _gdf ._fabgc ;};return _dcbaf ;};func (_acgg *PdfReader )newPdfActionRenditionFromDict (_aef *_fg .PdfObjectDictionary )(*PdfActionRendition ,error ){return &PdfActionRendition {R :_aef .Get ("\u0052"),AN :_aef .Get ("\u0041\u004e"),OP :_aef .Get ("\u004f\u0050"),JS :_aef .Get ("\u004a\u0053")},nil ;
|
||
};
|
||
|
||
// SetImageHandler sets the image handler used by the package.
|
||
func SetImageHandler (imgHandling ImageHandler ){ImageHandling =imgHandling };
|
||
|
||
// PdfAnnotationCircle represents Circle annotations.
|
||
// (Section 12.5.6.8).
|
||
type PdfAnnotationCircle struct{*PdfAnnotation ;*PdfAnnotationMarkup ;BS _fg .PdfObject ;IC _fg .PdfObject ;BE _fg .PdfObject ;RD _fg .PdfObject ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_adac *PdfAnnotationInk )ToPdfObject ()_fg .PdfObject {_adac .PdfAnnotation .ToPdfObject ();_dfbgd :=_adac ._agb ;_ddge :=_dfbgd .PdfObject .(*_fg .PdfObjectDictionary );_adac .PdfAnnotationMarkup .appendToPdfDictionary (_ddge );_ddge .SetIfNotNil ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u0049\u006e\u006b"));
|
||
_ddge .SetIfNotNil ("\u0049n\u006b\u004c\u0069\u0073\u0074",_adac .InkList );_ddge .SetIfNotNil ("\u0042\u0053",_adac .BS );return _dfbgd ;};
|
||
|
||
// PdfColorspaceSpecialSeparation is a Separation colorspace.
|
||
// At the moment the colour space is set to a Separation space, the conforming reader shall determine whether the
|
||
// device has an available colorant (e.g. dye) corresponding to the name of the requested space. If so, the conforming
|
||
// reader shall ignore the alternateSpace and tintTransform parameters; subsequent painting operations within the
|
||
// space shall apply the designated colorant directly, according to the tint values supplied.
|
||
//
|
||
// Format: [/Separation name alternateSpace tintTransform]
|
||
type PdfColorspaceSpecialSeparation struct{ColorantName *_fg .PdfObjectName ;AlternateSpace PdfColorspace ;TintTransform PdfFunction ;_adacb *_fg .PdfIndirectObject ;};func (_abdcf *PdfWriter )copyObjects (){_bfdfa :=make (map[_fg .PdfObject ]_fg .PdfObject );
|
||
_gbba :=make ([]_fg .PdfObject ,0,len (_abdcf ._bbfd ));_aabbd :=make (map[_fg .PdfObject ]struct{},len (_abdcf ._bbfd ));_cbdae :=make (map[_fg .PdfObject ]struct{});for _ ,_bgcef :=range _abdcf ._bbfd {_cdeca :=_abdcf .copyObject (_bgcef ,_bfdfa ,_cbdae ,false );
|
||
if _ ,_dgagg :=_cbdae [_bgcef ];_dgagg {continue ;};_gbba =append (_gbba ,_cdeca );_aabbd [_cdeca ]=struct{}{};};_abdcf ._bbfd =_gbba ;_abdcf ._gcbec =_aabbd ;_abdcf ._deabg =_abdcf .copyObject (_abdcf ._deabg ,_bfdfa ,nil ,false ).(*_fg .PdfIndirectObject );
|
||
_abdcf ._cegde =_abdcf .copyObject (_abdcf ._cegde ,_bfdfa ,nil ,false ).(*_fg .PdfIndirectObject );if _abdcf ._abgdg !=nil {_abdcf ._abgdg =_abdcf .copyObject (_abdcf ._abgdg ,_bfdfa ,nil ,false ).(*_fg .PdfIndirectObject );};if _abdcf ._cdafg {_fccadb :=make (map[_fg .PdfObject ]int64 );
|
||
for _cedad ,_daaeb :=range _abdcf ._cbeab {if _cedeed ,_dccge :=_bfdfa [_cedad ];_dccge {_fccadb [_cedeed ]=_daaeb ;}else {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020a\u0070\u0070\u0065n\u0064\u0020\u006d\u006fd\u0065\u0020\u002d\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u0020\u0063\u006f\u0070\u0079\u0020\u006e\u006f\u0074\u0020\u0069\u006e\u0020\u006d\u0061\u0070");
|
||
};};_abdcf ._cbeab =_fccadb ;};};
|
||
|
||
// PageFromIndirectObject returns the PdfPage and page number for a given indirect object.
|
||
func (_agbeg *PdfReader )PageFromIndirectObject (ind *_fg .PdfIndirectObject )(*PdfPage ,int ,error ){if len (_agbeg .PageList )!=len (_agbeg ._bgce ){return nil ,0,_ce .New ("\u0070\u0061\u0067\u0065\u0020\u006c\u0069\u0073\u0074\u0020\u0069\u006ev\u0061\u006c\u0069\u0064");
|
||
};for _agaef ,_gacg :=range _agbeg ._bgce {if _gacg ==ind {return _agbeg .PageList [_agaef ],_agaef +1,nil ;};};return nil ,0,_ce .New ("\u0070\u0061\u0067\u0065\u0020\u006e\u006f\u0074\u0020f\u006f\u0075\u006e\u0064");};
|
||
|
||
// IsTiling specifies if the pattern is a tiling pattern.
|
||
func (_ccbfg *PdfPattern )IsTiling ()bool {return _ccbfg .PatternType ==1};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_deed *PdfAnnotationPopup )ToPdfObject ()_fg .PdfObject {_deed .PdfAnnotation .ToPdfObject ();_adc :=_deed ._agb ;_beec :=_adc .PdfObject .(*_fg .PdfObjectDictionary );_beec .SetIfNotNil ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u0050\u006f\u0070u\u0070"));
|
||
_beec .SetIfNotNil ("\u0050\u0061\u0072\u0065\u006e\u0074",_deed .Parent );_beec .SetIfNotNil ("\u004f\u0070\u0065\u006e",_deed .Open );return _adc ;};func (_ddf *PdfReader )newPdfActionGoTo3DViewFromDict (_eeea *_fg .PdfObjectDictionary )(*PdfActionGoTo3DView ,error ){return &PdfActionGoTo3DView {TA :_eeea .Get ("\u0054\u0041"),V :_eeea .Get ("\u0056")},nil ;
|
||
};
|
||
|
||
// PdfDate represents a date, which is a PDF string of the form:
|
||
// (D:YYYYMMDDHHmmSSOHH'mm)
|
||
type PdfDate struct{_fddef int64 ;_agbab int64 ;_adaba int64 ;_bedbf int64 ;_fgdec int64 ;_cfebe int64 ;_ebdc byte ;_eedgc int64 ;_gfcga int64 ;};
|
||
|
||
// GetContext returns the PdfField context which is the more specific field data type, e.g. PdfFieldButton
|
||
// for a button field.
|
||
func (_cfgeaf *PdfField )GetContext ()PdfModel {return _cfgeaf ._abcbb };
|
||
|
||
// PdfAnnotationLine represents Line annotations.
|
||
// (Section 12.5.6.7).
|
||
type PdfAnnotationLine struct{*PdfAnnotation ;*PdfAnnotationMarkup ;L _fg .PdfObject ;BS _fg .PdfObject ;LE _fg .PdfObject ;IC _fg .PdfObject ;LL _fg .PdfObject ;LLE _fg .PdfObject ;Cap _fg .PdfObject ;IT _fg .PdfObject ;LLO _fg .PdfObject ;CP _fg .PdfObject ;
|
||
Measure _fg .PdfObject ;CO _fg .PdfObject ;};
|
||
|
||
// FillWithAppearance populates `form` with values provided by `provider`.
|
||
// If not nil, `appGen` is used to generate appearance dictionaries for the
|
||
// field annotations, based on the specified settings. Otherwise, appearance
|
||
// generation is skipped.
|
||
// e.g.: appGen := annotator.FieldAppearance{OnlyIfMissing: true, RegenerateTextFields: true}
|
||
// NOTE: In next major version this functionality will be part of Fill. (v4)
|
||
func (_acbcb *PdfAcroForm )FillWithAppearance (provider FieldValueProvider ,appGen FieldAppearanceGenerator )error {_gdbb :=_acbcb .fill (provider ,appGen );if _gdbb !=nil {return _gdbb ;};if _ ,_feaab :=provider .(FieldImageProvider );_feaab {_gdbb =_acbcb .fillImageWithAppearance (provider .(FieldImageProvider ),appGen );
|
||
};return _gdbb ;};
|
||
|
||
// AddCustomInfo adds a custom info into document info dictionary.
|
||
func (_eebdc *PdfInfo )AddCustomInfo (name string ,value string )error {if _eebdc ._aaee ==nil {_eebdc ._aaee =_fg .MakeDict ();};if _ ,_fafgb :=_dcede [name ];_fafgb {return _d .Errorf ("\u0063\u0061\u006e\u006e\u006ft\u0020\u0075\u0073\u0065\u0020\u0073\u0074\u0061\u006e\u0064\u0061\u0072\u0064 \u0069\u006e\u0066\u006f\u0020\u006b\u0065\u0079\u0020\u0025\u0073\u0020\u0061\u0073\u0020\u0063\u0075\u0073\u0074\u006f\u006d\u0020\u0066\u0069\u0065\u006c\u0064\u0020\u006b\u0065y",name );
|
||
};_eebdc ._aaee .SetIfNotNil (*_fg .MakeName (name ),_fg .MakeString (value ));return nil ;};
|
||
|
||
// ColorToRGB only converts color used with uncolored patterns (defined in underlying colorspace). Does not go into the
|
||
// pattern objects and convert those. If that is desired, needs to be done separately. See for example
|
||
// grayscale conversion example in unidoc-examples repo.
|
||
func (_ccdfc *PdfColorspaceSpecialPattern )ColorToRGB (color PdfColor )(PdfColor ,error ){_dadga ,_bgdc :=color .(*PdfColorPattern );if !_bgdc {_aa .Log .Debug ("\u0043\u006f\u006c\u006f\u0072\u0020\u006e\u006f\u0074\u0020\u0070a\u0074\u0074\u0065\u0072\u006e\u0020\u0028\u0067\u006f\u0074 \u0025\u0054\u0029",color );
|
||
return nil ,ErrTypeCheck ;};if _dadga .Color ==nil {return color ,nil ;};if _ccdfc .UnderlyingCS ==nil {return nil ,_ce .New ("\u0075n\u0064\u0065\u0072\u006cy\u0069\u006e\u0067\u0020\u0043S\u0020n\u006ft\u0020\u0064\u0065\u0066\u0069\u006e\u0065d");};
|
||
return _ccdfc .UnderlyingCS .ColorToRGB (_dadga .Color );};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_aeg *PdfActionThread )ToPdfObject ()_fg .PdfObject {_aeg .PdfAction .ToPdfObject ();_dac :=_aeg ._bda ;_caa :=_dac .PdfObject .(*_fg .PdfObjectDictionary );_caa .SetIfNotNil ("\u0053",_fg .MakeName (string (ActionTypeThread )));if _aeg .F !=nil {_caa .Set ("\u0046",_aeg .F .ToPdfObject ());
|
||
};_caa .SetIfNotNil ("\u0044",_aeg .D );_caa .SetIfNotNil ("\u0042",_aeg .B );return _dac ;};func (_bdfab *PdfWriter )writeObject (_ggadd int ,_fgdfde _fg .PdfObject ){_aa .Log .Trace ("\u0057\u0072\u0069\u0074\u0065\u0020\u006f\u0062\u006a \u0023\u0025\u0064\u000a",_ggadd );
|
||
if _bdbca ,_egbed :=_fgdfde .(*_fg .PdfIndirectObject );_egbed {_bdfab ._aafgd [_ggadd ]=crossReference {Type :1,Offset :_bdfab ._fcgga ,Generation :_bdbca .GenerationNumber };_cgdaf :=_d .Sprintf ("\u0025d\u0020\u0030\u0020\u006f\u0062\u006a\n",_ggadd );
|
||
if _ddaee ,_badbge :=_bdbca .PdfObject .(*pdfSignDictionary );_badbge {_ddaee ._gaage =_bdfab ._fcgga +int64 (len (_cgdaf ));};if _bdbca .PdfObject ==nil {_aa .Log .Debug ("E\u0072\u0072\u006fr\u003a\u0020\u0069\u006e\u0064\u0069\u0072\u0065\u0063\u0074\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u0027\u0073\u0020\u0050\u0064\u0066\u004f\u0062j\u0065\u0063\u0074 \u0073\u0068\u006f\u0075\u006c\u0064\u0020\u006e\u0065\u0076\u0065\u0072\u0020b\u0065\u0020\u006e\u0069l\u0020\u002d\u0020\u0073e\u0074\u0074\u0069\u006e\u0067\u0020\u0074\u006f\u0020\u0050\u0064\u0066\u004f\u0062\u006a\u0065\u0063t\u004e\u0075\u006c\u006c");
|
||
_bdbca .PdfObject =_fg .MakeNull ();};_cgdaf +=_bdbca .PdfObject .WriteString ();_cgdaf +="\u000a\u0065\u006e\u0064\u006f\u0062\u006a\u000a";_bdfab .writeString (_cgdaf );return ;};if _aefbg ,_aabge :=_fgdfde .(*_fg .PdfObjectStream );_aabge {_bdfab ._aafgd [_ggadd ]=crossReference {Type :1,Offset :_bdfab ._fcgga ,Generation :_aefbg .GenerationNumber };
|
||
_dcbcfa :=_d .Sprintf ("\u0025d\u0020\u0030\u0020\u006f\u0062\u006a\n",_ggadd );_dcbcfa +=_aefbg .PdfObjectDictionary .WriteString ();_dcbcfa +="\u000a\u0073\u0074\u0072\u0065\u0061\u006d\u000a";_bdfab .writeString (_dcbcfa );_bdfab .writeBytes (_aefbg .Stream );
|
||
_bdfab .writeString ("\u000ae\u006ed\u0073\u0074\u0072\u0065\u0061m\u000a\u0065n\u0064\u006f\u0062\u006a\u000a");return ;};if _dfbfb ,_eecbb :=_fgdfde .(*_fg .PdfObjectStreams );_eecbb {_bdfab ._aafgd [_ggadd ]=crossReference {Type :1,Offset :_bdfab ._fcgga ,Generation :_dfbfb .GenerationNumber };
|
||
_geafd :=_d .Sprintf ("\u0025d\u0020\u0030\u0020\u006f\u0062\u006a\n",_ggadd );var _caaea []string ;var _ffeee string ;var _cgcdf int64 ;for _acbaf ,_cdeaf :=range _dfbfb .Elements (){_cgee ,_aebcf :=_cdeaf .(*_fg .PdfIndirectObject );if !_aebcf {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u004f\u0062\u006a\u0065\u0063\u0074\u0020\u0073\u0074\u0072\u0065am\u0073 \u004e\u0020\u0025\u0064\u0020\u0063\u006f\u006e\u0074\u0061\u0069\u006es\u0020\u006e\u006f\u006e\u0020\u0069\u006e\u0064\u0069\u0072\u0065\u0063\u0074\u0020\u0070\u0064\u0066 \u006f\u0062\u006a\u0065\u0063\u0074\u0020\u0025\u0076",_ggadd ,_cdeaf );
|
||
continue ;};_eedfd :=_cgee .PdfObject .WriteString ()+"\u0020";_ffeee =_ffeee +_eedfd ;_caaea =append (_caaea ,_d .Sprintf ("\u0025\u0064\u0020%\u0064",_cgee .ObjectNumber ,_cgcdf ));_bdfab ._aafgd [int (_cgee .ObjectNumber )]=crossReference {Type :2,ObjectNumber :_ggadd ,Index :_acbaf };
|
||
_cgcdf =_cgcdf +int64 (len ([]byte (_eedfd )));};_abgfa :=_dc .Join (_caaea ,"\u0020")+"\u0020";_aeabf :=_fg .NewFlateEncoder ();_dfeega :=_aeabf .MakeStreamDict ();_dfeega .Set (_fg .PdfObjectName ("\u0054\u0079\u0070\u0065"),_fg .MakeName ("\u004f\u0062\u006a\u0053\u0074\u006d"));
|
||
_aadfb :=int64 (_dfbfb .Len ());_dfeega .Set (_fg .PdfObjectName ("\u004e"),_fg .MakeInteger (_aadfb ));_ceafe :=int64 (len (_abgfa ));_dfeega .Set (_fg .PdfObjectName ("\u0046\u0069\u0072s\u0074"),_fg .MakeInteger (_ceafe ));_bfgg ,_ :=_aeabf .EncodeBytes ([]byte (_abgfa +_ffeee ));
|
||
_gecac :=int64 (len (_bfgg ));_dfeega .Set (_fg .PdfObjectName ("\u004c\u0065\u006e\u0067\u0074\u0068"),_fg .MakeInteger (_gecac ));_geafd +=_dfeega .WriteString ();_geafd +="\u000a\u0073\u0074\u0072\u0065\u0061\u006d\u000a";_bdfab .writeString (_geafd );
|
||
_bdfab .writeBytes (_bfgg );_bdfab .writeString ("\u000ae\u006ed\u0073\u0074\u0072\u0065\u0061m\u000a\u0065n\u0064\u006f\u0062\u006a\u000a");return ;};_bdfab .writeString (_fgdfde .WriteString ());};
|
||
|
||
// PdfAnnotationUnderline represents Underline annotations.
|
||
// (Section 12.5.6.10).
|
||
type PdfAnnotationUnderline struct{*PdfAnnotation ;*PdfAnnotationMarkup ;QuadPoints _fg .PdfObject ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_bcbdd *PdfFilespec )ToPdfObject ()_fg .PdfObject {_aaed :=_bcbdd .getDict ();_aaed .Clear ();_aaed .Set ("\u0054\u0079\u0070\u0065",_fg .MakeName ("\u0046\u0069\u006c\u0065\u0073\u0070\u0065\u0063"));_aaed .SetIfNotNil ("\u0046\u0053",_bcbdd .FS );
|
||
_aaed .SetIfNotNil ("\u0046",_bcbdd .F );_aaed .SetIfNotNil ("\u0055\u0046",_bcbdd .UF );_aaed .SetIfNotNil ("\u0044\u004f\u0053",_bcbdd .DOS );_aaed .SetIfNotNil ("\u004d\u0061\u0063",_bcbdd .Mac );_aaed .SetIfNotNil ("\u0055\u006e\u0069\u0078",_bcbdd .Unix );
|
||
_aaed .SetIfNotNil ("\u0049\u0044",_bcbdd .ID );_aaed .SetIfNotNil ("\u0056",_bcbdd .V );_aaed .SetIfNotNil ("\u0045\u0046",_bcbdd .EF );_aaed .SetIfNotNil ("\u0052\u0046",_bcbdd .RF );_aaed .SetIfNotNil ("\u0044\u0065\u0073\u0063",_bcbdd .Desc );_aaed .SetIfNotNil ("\u0043\u0049",_bcbdd .CI );
|
||
return _bcbdd ._ccbdc ;};func (_eccc *PdfReader )newPdfAnnotationLinkFromDict (_egca *_fg .PdfObjectDictionary )(*PdfAnnotationLink ,error ){_efa :=PdfAnnotationLink {};_efa .A =_egca .Get ("\u0041");_efa .Dest =_egca .Get ("\u0044\u0065\u0073\u0074");
|
||
_efa .H =_egca .Get ("\u0048");_efa .PA =_egca .Get ("\u0050\u0041");_efa .QuadPoints =_egca .Get ("\u0051\u0075\u0061\u0064\u0050\u006f\u0069\u006e\u0074\u0073");_efa .BS =_egca .Get ("\u0042\u0053");return &_efa ,nil ;};func (_gead *fontFile )loadFromSegments (_dfae ,_bageg []byte )error {_aa .Log .Trace ("\u006c\u006f\u0061dF\u0072\u006f\u006d\u0053\u0065\u0067\u006d\u0065\u006e\u0074\u0073\u003a\u0020\u0025\u0064\u0020\u0025\u0064",len (_dfae ),len (_bageg ));
|
||
_eaace :=_gead .parseASCIIPart (_dfae );if _eaace !=nil {return _eaace ;};_aa .Log .Trace ("f\u006f\u006e\u0074\u0066\u0069\u006c\u0065\u003d\u0025\u0073",_gead );if len (_bageg )==0{return nil ;};_aa .Log .Trace ("f\u006f\u006e\u0074\u0066\u0069\u006c\u0065\u003d\u0025\u0073",_gead );
|
||
return nil ;};func _adggf ()string {_baacg .Lock ();defer _baacg .Unlock ();return _ggbag };var _ pdfFont =(*pdfFontType0 )(nil );func (_fggg *PdfReader )newPdfAnnotationFileAttachmentFromDict (_fbbg *_fg .PdfObjectDictionary )(*PdfAnnotationFileAttachment ,error ){_bdbc :=PdfAnnotationFileAttachment {};
|
||
_feff ,_bfe :=_fggg .newPdfAnnotationMarkupFromDict (_fbbg );if _bfe !=nil {return nil ,_bfe ;};_bdbc .PdfAnnotationMarkup =_feff ;_bdbc .FS =_fbbg .Get ("\u0046\u0053");_bdbc .Name =_fbbg .Get ("\u004e\u0061\u006d\u0065");return &_bdbc ,nil ;};
|
||
|
||
// NewPdfAnnotationProjection returns a new projection annotation.
|
||
func NewPdfAnnotationProjection ()*PdfAnnotationProjection {_geg :=NewPdfAnnotation ();_gcab :=&PdfAnnotationProjection {};_gcab .PdfAnnotation =_geg ;_gcab .PdfAnnotationMarkup =&PdfAnnotationMarkup {};_geg .SetContext (_gcab );return _gcab ;};
|
||
|
||
// SetContentStream sets the pattern cell's content stream.
|
||
func (_bggffc *PdfTilingPattern )SetContentStream (content []byte ,encoder _fg .StreamEncoder )error {_dagbb ,_cabeg :=_bggffc ._gaac .(*_fg .PdfObjectStream );if !_cabeg {_aa .Log .Debug ("\u0054\u0069l\u0069\u006e\u0067\u0020\u0070\u0061\u0074\u0074\u0065\u0072\u006e\u0020\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0065\u0072\u0020\u006e\u006f\u0074\u0020\u0061\u0020\u0073\u0074\u0072\u0065\u0061\u006d\u0020\u0028\u0067\u006f\u0074\u0020\u0025\u0054\u0029",_bggffc ._gaac );
|
||
return _fg .ErrTypeError ;};if encoder ==nil {encoder =_fg .NewRawEncoder ();};_dbbe :=_dagbb .PdfObjectDictionary ;_cgge :=encoder .MakeStreamDict ();_dbbe .Merge (_cgge );_ebcad ,_fbad :=encoder .EncodeBytes (content );if _fbad !=nil {return _fbad ;};
|
||
_dbbe .Set ("\u004c\u0065\u006e\u0067\u0074\u0068",_fg .MakeInteger (int64 (len (_ebcad ))));_dagbb .Stream =_ebcad ;return nil ;};
|
||
|
||
// ToPdfObject converts the font to a PDF representation.
|
||
func (_dgeag *pdfFontType3 )ToPdfObject ()_fg .PdfObject {if _dgeag ._bdfc ==nil {_dgeag ._bdfc =&_fg .PdfIndirectObject {};};_agfdg :=_dgeag .baseFields ().asPdfObjectDictionary ("\u0054\u0079\u0070e\u0033");_dgeag ._bdfc .PdfObject =_agfdg ;if _dgeag .FirstChar !=nil {_agfdg .Set ("\u0046i\u0072\u0073\u0074\u0043\u0068\u0061r",_dgeag .FirstChar );
|
||
};if _dgeag .LastChar !=nil {_agfdg .Set ("\u004c\u0061\u0073\u0074\u0043\u0068\u0061\u0072",_dgeag .LastChar );};if _dgeag .Widths !=nil {_agfdg .Set ("\u0057\u0069\u0064\u0074\u0068\u0073",_dgeag .Widths );};if _dgeag .Encoding !=nil {_agfdg .Set ("\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067",_dgeag .Encoding );
|
||
}else if _dgeag ._efad !=nil {_defb :=_dgeag ._efad .ToPdfObject ();if _defb !=nil {_agfdg .Set ("\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067",_defb );};};if _dgeag .FontBBox !=nil {_agfdg .Set ("\u0046\u006f\u006e\u0074\u0042\u0042\u006f\u0078",_dgeag .FontBBox );
|
||
};if _dgeag .FontMatrix !=nil {_agfdg .Set ("\u0046\u006f\u006e\u0074\u004d\u0061\u0074\u0069\u0072\u0078",_dgeag .FontMatrix );};if _dgeag .CharProcs !=nil {_agfdg .Set ("\u0043h\u0061\u0072\u0050\u0072\u006f\u0063s",_dgeag .CharProcs );};if _dgeag .Resources !=nil {_agfdg .Set ("\u0052e\u0073\u006f\u0075\u0072\u0063\u0065s",_dgeag .Resources );
|
||
};return _dgeag ._bdfc ;};
|
||
|
||
// PdfActionSubmitForm represents a submitForm action.
|
||
type PdfActionSubmitForm struct{*PdfAction ;F *PdfFilespec ;Fields _fg .PdfObject ;Flags _fg .PdfObject ;};
|
||
|
||
// ToPdfObject returns the PDF representation of the function.
|
||
func (_aaegf *PdfFunctionType3 )ToPdfObject ()_fg .PdfObject {_aecaf :=_fg .MakeDict ();_aecaf .Set ("\u0046\u0075\u006ec\u0074\u0069\u006f\u006e\u0054\u0079\u0070\u0065",_fg .MakeInteger (3));_eceb :=&_fg .PdfObjectArray {};for _ ,_edgad :=range _aaegf .Domain {_eceb .Append (_fg .MakeFloat (_edgad ));
|
||
};_aecaf .Set ("\u0044\u006f\u006d\u0061\u0069\u006e",_eceb );if _aaegf .Range !=nil {_dfcd :=&_fg .PdfObjectArray {};for _ ,_dfcbe :=range _aaegf .Range {_dfcd .Append (_fg .MakeFloat (_dfcbe ));};_aecaf .Set ("\u0052\u0061\u006eg\u0065",_dfcd );};if _aaegf .Functions !=nil {_ddade :=&_fg .PdfObjectArray {};
|
||
for _ ,_dbdeg :=range _aaegf .Functions {_ddade .Append (_dbdeg .ToPdfObject ());};_aecaf .Set ("\u0046u\u006e\u0063\u0074\u0069\u006f\u006es",_ddade );};if _aaegf .Bounds !=nil {_dbbcb :=&_fg .PdfObjectArray {};for _ ,_cadc :=range _aaegf .Bounds {_dbbcb .Append (_fg .MakeFloat (_cadc ));
|
||
};_aecaf .Set ("\u0042\u006f\u0075\u006e\u0064\u0073",_dbbcb );};if _aaegf .Encode !=nil {_gcaa :=&_fg .PdfObjectArray {};for _ ,_bded :=range _aaegf .Encode {_gcaa .Append (_fg .MakeFloat (_bded ));};_aecaf .Set ("\u0045\u006e\u0063\u006f\u0064\u0065",_gcaa );
|
||
};if _aaegf ._daga !=nil {_aaegf ._daga .PdfObject =_aecaf ;return _aaegf ._daga ;};return _aecaf ;};func (_eaac *PdfReader )newPdfAnnotationHighlightFromDict (_gdc *_fg .PdfObjectDictionary )(*PdfAnnotationHighlight ,error ){_bddd :=PdfAnnotationHighlight {};
|
||
_ecace ,_eab :=_eaac .newPdfAnnotationMarkupFromDict (_gdc );if _eab !=nil {return nil ,_eab ;};_bddd .PdfAnnotationMarkup =_ecace ;_bddd .QuadPoints =_gdc .Get ("\u0051\u0075\u0061\u0064\u0050\u006f\u0069\u006e\u0074\u0073");return &_bddd ,nil ;};
|
||
|
||
// GetContainingPdfObject returns the container of the pattern object (indirect object).
|
||
func (_aaaga *PdfPattern )GetContainingPdfObject ()_fg .PdfObject {return _aaaga ._gaac };
|
||
|
||
// NewPdfActionRendition returns a new "rendition" action.
|
||
func NewPdfActionRendition ()*PdfActionRendition {_ddc :=NewPdfAction ();_agf :=&PdfActionRendition {};_agf .PdfAction =_ddc ;_ddc .SetContext (_agf );return _agf ;};var (_baacg _f .Mutex ;_dfeegf ="";_dfdeae _g .Time ;_gfebcg ="";_fdcca ="";_fbefe _g .Time ;
|
||
_egdda ="";_ggbag ="";_ebfgc ="";);
|
||
|
||
// ToPdfObject returns the PDF representation of the colorspace.
|
||
func (_gebb *PdfColorspaceSpecialPattern )ToPdfObject ()_fg .PdfObject {if _gebb .UnderlyingCS ==nil {return _fg .MakeName ("\u0050a\u0074\u0074\u0065\u0072\u006e");};_ccea :=_fg .MakeArray (_fg .MakeName ("\u0050a\u0074\u0074\u0065\u0072\u006e"));_ccea .Append (_gebb .UnderlyingCS .ToPdfObject ());
|
||
if _gebb ._agcec !=nil {_gebb ._agcec .PdfObject =_ccea ;return _gebb ._agcec ;};return _ccea ;};
|
||
|
||
// PageProcessCallback callback function used in page loading
|
||
// that could be used to modify the page content.
|
||
//
|
||
// If an error is returned, the `ToWriter` process would fail.
|
||
//
|
||
// This callback, if defined, will take precedence over `PageCallback` callback.
|
||
type PageProcessCallback func (_afad int ,_ebdbf *PdfPage )error ;
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
// Note: Call the sub-annotation's ToPdfObject to set both the generic and non-generic information.
|
||
func (_acbe *PdfAnnotation )ToPdfObject ()_fg .PdfObject {_dbe :=_acbe ._agb ;_acca :=_dbe .PdfObject .(*_fg .PdfObjectDictionary );_acca .Clear ();_acca .Set ("\u0054\u0079\u0070\u0065",_fg .MakeName ("\u0041\u006e\u006eo\u0074"));_acca .SetIfNotNil ("\u0052\u0065\u0063\u0074",_acbe .Rect );
|
||
_acca .SetIfNotNil ("\u0043\u006f\u006e\u0074\u0065\u006e\u0074\u0073",_acbe .Contents );_acca .SetIfNotNil ("\u0050",_acbe .P );_acca .SetIfNotNil ("\u004e\u004d",_acbe .NM );_acca .SetIfNotNil ("\u004d",_acbe .M );_acca .SetIfNotNil ("\u0046",_acbe .F );
|
||
_acca .SetIfNotNil ("\u0041\u0050",_acbe .AP );_acca .SetIfNotNil ("\u0041\u0053",_acbe .AS );_acca .SetIfNotNil ("\u0042\u006f\u0072\u0064\u0065\u0072",_acbe .Border );_acca .SetIfNotNil ("\u0043",_acbe .C );_acca .SetIfNotNil ("\u0053\u0074\u0072u\u0063\u0074\u0050\u0061\u0072\u0065\u006e\u0074",_acbe .StructParent );
|
||
_acca .SetIfNotNil ("\u004f\u0043",_acbe .OC );return _dbe ;};
|
||
|
||
// Set applies flag fl to the flag's bitmask and returns the combined flag.
|
||
func (_ccbdb FieldFlag )Set (fl FieldFlag )FieldFlag {return FieldFlag (_ccbdb .Mask ()|fl .Mask ())};func (_cddf *PdfReader )newPdfAnnotationWatermarkFromDict (_dddcb *_fg .PdfObjectDictionary )(*PdfAnnotationWatermark ,error ){_gede :=PdfAnnotationWatermark {};
|
||
_gede .FixedPrint =_dddcb .Get ("\u0046\u0069\u0078\u0065\u0064\u0050\u0072\u0069\u006e\u0074");return &_gede ,nil ;};func (_gcdf *PdfReader )newPdfActionSetOCGStateFromDict (_bdee *_fg .PdfObjectDictionary )(*PdfActionSetOCGState ,error ){return &PdfActionSetOCGState {State :_bdee .Get ("\u0053\u0074\u0061t\u0065"),PreserveRB :_bdee .Get ("\u0050\u0072\u0065\u0073\u0065\u0072\u0076\u0065\u0052\u0042")},nil ;
|
||
};
|
||
|
||
// IsCID returns true if the underlying font is CID.
|
||
func (_babc *PdfFont )IsCID ()bool {return _babc .baseFields ().isCIDFont ()};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_aggg *PdfAnnotation3D )ToPdfObject ()_fg .PdfObject {_aggg .PdfAnnotation .ToPdfObject ();_cgfc :=_aggg ._agb ;_afac :=_cgfc .PdfObject .(*_fg .PdfObjectDictionary );_afac .SetIfNotNil ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u0033\u0044"));
|
||
_afac .SetIfNotNil ("\u0033\u0044\u0044",_aggg .T3DD );_afac .SetIfNotNil ("\u0033\u0044\u0056",_aggg .T3DV );_afac .SetIfNotNil ("\u0033\u0044\u0041",_aggg .T3DA );_afac .SetIfNotNil ("\u0033\u0044\u0049",_aggg .T3DI );_afac .SetIfNotNil ("\u0033\u0044\u0042",_aggg .T3DB );
|
||
return _cgfc ;};func (_eafd *pdfFontType3 )baseFields ()*fontCommon {return &_eafd .fontCommon };func (_fcd *PdfReader )newPdfAnnotationWidgetFromDict (_fbfa *_fg .PdfObjectDictionary )(*PdfAnnotationWidget ,error ){_cafd :=PdfAnnotationWidget {};_cafd .H =_fbfa .Get ("\u0048");
|
||
_cafd .MK =_fbfa .Get ("\u004d\u004b");_cafd .A =_fbfa .Get ("\u0041");_cafd .AA =_fbfa .Get ("\u0041\u0041");_cafd .BS =_fbfa .Get ("\u0042\u0053");_cafd .Parent =_fbfa .Get ("\u0050\u0061\u0072\u0065\u006e\u0074");return &_cafd ,nil ;};func (_bdgc *PdfAppender )replaceObject (_cddb ,_cbfc _fg .PdfObject ){switch _bbgb :=_cddb .(type ){case *_fg .PdfIndirectObject :_bdgc ._dcbad [_cbfc ]=_bbgb .ObjectNumber ;
|
||
case *_fg .PdfObjectStream :_bdgc ._dcbad [_cbfc ]=_bbgb .ObjectNumber ;};};func (_gcgcb *Image )resampleLowBits (_fbffg []uint32 ){_cbbee :=_cc .BytesPerLine (int (_gcgcb .Width ),int (_gcgcb .BitsPerComponent ),_gcgcb .ColorComponents );_fgcae :=make ([]byte ,_gcgcb .ColorComponents *_cbbee *int (_gcgcb .Height ));
|
||
_dfbf :=int (_gcgcb .BitsPerComponent )*_gcgcb .ColorComponents *int (_gcgcb .Width );_bdgb :=uint8 (8);var (_gabe ,_afcbc int ;_gged uint32 ;);for _bdba :=0;_bdba < int (_gcgcb .Height );_bdba ++{_afcbc =_bdba *_cbbee ;for _accc :=0;_accc < _dfbf ;_accc ++{_gged =_fbffg [_gabe ];
|
||
_bdgb -=uint8 (_gcgcb .BitsPerComponent );_fgcae [_afcbc ]|=byte (_gged )<<_bdgb ;if _bdgb ==0{_bdgb =8;_afcbc ++;};_gabe ++;};};_gcgcb .Data =_fgcae ;};func (_cacf *PdfReader )newPdfAnnotationRichMediaFromDict (_bbcc *_fg .PdfObjectDictionary )(*PdfAnnotationRichMedia ,error ){_fbg :=&PdfAnnotationRichMedia {};
|
||
_fbg .RichMediaSettings =_bbcc .Get ("\u0052\u0069\u0063\u0068\u004d\u0065\u0064\u0069\u0061\u0053\u0065\u0074t\u0069\u006e\u0067\u0073");_fbg .RichMediaContent =_bbcc .Get ("\u0052\u0069c\u0068\u004d\u0065d\u0069\u0061\u0043\u006f\u006e\u0074\u0065\u006e\u0074");
|
||
return _fbg ,nil ;};
|
||
|
||
// NewPdfFontFromTTF loads a TTF font and returns a PdfFont type that can be
|
||
// used in text styling functions.
|
||
// Uses a WinAnsiTextEncoder and loads only character codes 32-255.
|
||
// NOTE: For composite fonts such as used in symbolic languages, use NewCompositePdfFontFromTTF.
|
||
func NewPdfFontFromTTF (r _ff .ReadSeeker )(*PdfFont ,error ){const _begcd =_dg .CharCode (32);const _bbgdg =_dg .CharCode (255);_cedag ,_gfcg :=_ga .ReadAll (r );if _gfcg !=nil {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0055\u006e\u0061\u0062\u006c\u0065 \u0074\u006f\u0020\u0072\u0065\u0061d\u0020\u0066\u006f\u006e\u0074\u0020\u0063\u006f\u006e\u0074\u0065\u006e\u0074s\u003a\u0020\u0025\u0076",_gfcg );
|
||
return nil ,_gfcg ;};_ffgf ,_gfcg :=_eed .TtfParse (_cb .NewReader (_cedag ));if _gfcg !=nil {_aa .Log .Debug ("E\u0052\u0052\u004f\u0052\u003a\u0020l\u006f\u0061\u0064\u0069\u006e\u0067\u0020\u0054\u0054F\u0020\u0066\u006fn\u0074:\u0020\u0025\u0076",_gfcg );
|
||
return nil ,_gfcg ;};_bcdcd :=&pdfFontSimple {_fcgbd :make (map[_dg .CharCode ]float64 ),fontCommon :fontCommon {_ggcfc :"\u0054\u0072\u0075\u0065\u0054\u0079\u0070\u0065"}};_bcdcd ._bdgda =_dg .NewWinAnsiEncoder ();_bcdcd ._aefg =_ffgf .PostScriptName ;
|
||
_bcdcd .FirstChar =_fg .MakeInteger (int64 (_begcd ));_bcdcd .LastChar =_fg .MakeInteger (int64 (_bbgdg ));_dcegcc :=1000.0/float64 (_ffgf .UnitsPerEm );if len (_ffgf .Widths )<=0{return nil ,_ce .New ("\u0045\u0052\u0052O\u0052\u003a\u0020\u004d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0072\u0065\u0071\u0075\u0069\u0072\u0065\u0064\u0020\u0061\u0074\u0074\u0072\u0069\u0062\u0075\u0074\u0065 \u0028\u0057\u0069\u0064\u0074\u0068\u0073\u0029");
|
||
};_fccb :=_dcegcc *float64 (_ffgf .Widths [0]);_eaagb :=make ([]float64 ,0,_bbgdg -_begcd +1);for _edcbd :=_begcd ;_edcbd <=_bbgdg ;_edcbd ++{_fgbge ,_bddgd :=_bcdcd .Encoder ().CharcodeToRune (_edcbd );if !_bddgd {_aa .Log .Debug ("\u0052u\u006e\u0065\u0020\u006eo\u0074\u0020\u0066\u006f\u0075n\u0064 \u0028c\u006f\u0064\u0065\u003a\u0020\u0025\u0064)",_edcbd );
|
||
_eaagb =append (_eaagb ,_fccb );continue ;};_feab ,_ccdgc :=_ffgf .Chars [_fgbge ];if !_ccdgc {_aa .Log .Debug ("R\u0075\u006e\u0065\u0020no\u0074 \u0069\u006e\u0020\u0054\u0054F\u0020\u0043\u0068\u0061\u0072\u0073");_eaagb =append (_eaagb ,_fccb );continue ;
|
||
};_gddf :=_dcegcc *float64 (_ffgf .Widths [_feab ]);_eaagb =append (_eaagb ,_gddf );};_bcdcd .Widths =_fg .MakeIndirectObject (_fg .MakeArrayFromFloats (_eaagb ));if len (_eaagb )< int (_bbgdg -_begcd +1){_aa .Log .Debug ("E\u0052\u0052\u004f\u0052\u003a\u0020\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u006c\u0065\u006e\u0067t\u0068\u0020\u006f\u0066\u0020\u0077\u0069\u0064\u0074\u0068s,\u0020\u0025\u0064 \u003c \u0025\u0064",len (_eaagb ),255-32+1);
|
||
return nil ,_fg .ErrRangeError ;};for _fefg :=_begcd ;_fefg <=_bbgdg ;_fefg ++{_bcdcd ._fcgbd [_fefg ]=_eaagb [_fefg -_begcd ];};_bcdcd .Encoding =_fg .MakeName ("\u0057i\u006eA\u006e\u0073\u0069\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067");_faccf :=&PdfFontDescriptor {};
|
||
_faccf .FontName =_fg .MakeName (_ffgf .PostScriptName );_faccf .Ascent =_fg .MakeFloat (_dcegcc *float64 (_ffgf .TypoAscender ));_faccf .Descent =_fg .MakeFloat (_dcegcc *float64 (_ffgf .TypoDescender ));_faccf .CapHeight =_fg .MakeFloat (_dcegcc *float64 (_ffgf .CapHeight ));
|
||
_faccf .FontBBox =_fg .MakeArrayFromFloats ([]float64 {_dcegcc *float64 (_ffgf .Xmin ),_dcegcc *float64 (_ffgf .Ymin ),_dcegcc *float64 (_ffgf .Xmax ),_dcegcc *float64 (_ffgf .Ymax )});_faccf .ItalicAngle =_fg .MakeFloat (_ffgf .ItalicAngle );_faccf .MissingWidth =_fg .MakeFloat (_dcegcc *float64 (_ffgf .Widths [0]));
|
||
_dfabd ,_gfcg :=_fg .MakeStream (_cedag ,_fg .NewFlateEncoder ());if _gfcg !=nil {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0055\u006e\u0061\u0062\u006c\u0065\u0020\u0074o\u0020m\u0061\u006b\u0065\u0020\u0073\u0074\u0072\u0065\u0061\u006d\u003a\u0020\u0025\u0076",_gfcg );
|
||
return nil ,_gfcg ;};_dfabd .PdfObjectDictionary .Set ("\u004ce\u006e\u0067\u0074\u0068\u0031",_fg .MakeInteger (int64 (len (_cedag ))));_faccf .FontFile2 =_dfabd ;if _ffgf .Bold {_faccf .StemV =_fg .MakeInteger (120);}else {_faccf .StemV =_fg .MakeInteger (70);
|
||
};_dedc :=_fdcfe ;if _ffgf .IsFixedPitch {_dedc |=_aeada ;};if _ffgf .ItalicAngle !=0{_dedc |=_aedcf ;};_faccf .Flags =_fg .MakeInteger (int64 (_dedc ));_bcdcd ._cdgef =_faccf ;_gfebg :=&PdfFont {_gcaeff :_bcdcd };return _gfebg ,nil ;};
|
||
|
||
// NewPdfActionGoToR returns a new "go to remote" action.
|
||
func NewPdfActionGoToR ()*PdfActionGoToR {_ecd :=NewPdfAction ();_ege :=&PdfActionGoToR {};_ege .PdfAction =_ecd ;_ecd .SetContext (_ege );return _ege ;};const (_aeada =0x00001;_feea =0x00002;_dbbc =0x00004;_ddcf =0x00008;_fdcfe =0x00020;_aedcf =0x00040;
|
||
_cccff =0x10000;_edcag =0x20000;_abfe =0x40000;);func (_eafb *LTV )validateSig (_gadb *PdfSignature )error {if _gadb ==nil ||_gadb .Contents ==nil ||len (_gadb .Contents .Bytes ())==0{return _d .Errorf ("i\u006e\u0076\u0061\u006c\u0069\u0064 \u0073\u0069\u0067\u006e\u0061\u0074\u0075\u0072\u0065 \u0066\u0069\u0065l\u0064:\u0020\u0025\u0076",_gadb );
|
||
};return nil ;};
|
||
|
||
// ImageToRGB converts an image in CMYK32 colorspace to an RGB image.
|
||
func (_geecb *PdfColorspaceDeviceCMYK )ImageToRGB (img Image )(Image ,error ){_aa .Log .Trace ("\u0043\u004d\u0059\u004b\u0033\u0032\u0020\u002d\u003e\u0020\u0052\u0047\u0042");_aa .Log .Trace ("I\u006d\u0061\u0067\u0065\u0020\u0042P\u0043\u003a\u0020\u0025\u0064\u002c \u0043\u006f\u006c\u006f\u0072\u0020\u0063o\u006d\u0070\u006f\u006e\u0065\u006e\u0074\u0073\u003a\u0020%\u0064",img .BitsPerComponent ,img .ColorComponents );
|
||
_aa .Log .Trace ("\u004c\u0065\u006e \u0064\u0061\u0074\u0061\u003a\u0020\u0025\u0064",len (img .Data ));_aa .Log .Trace ("H\u0065\u0069\u0067\u0068t:\u0020%\u0064\u002c\u0020\u0057\u0069d\u0074\u0068\u003a\u0020\u0025\u0064",img .Height ,img .Width );
|
||
_bggff ,_bfbg :=_cc .NewImage (int (img .Width ),int (img .Height ),int (img .BitsPerComponent ),img .ColorComponents ,img .Data ,img ._gccd ,img ._dbge );if _bfbg !=nil {return Image {},_bfbg ;};_bddg ,_bfbg :=_cc .NRGBAConverter .Convert (_bggff );if _bfbg !=nil {return Image {},_bfbg ;
|
||
};return _adad (_bddg .Base ()),nil ;};
|
||
|
||
// NewPdfAnnotationPolygon returns a new polygon annotation.
|
||
func NewPdfAnnotationPolygon ()*PdfAnnotationPolygon {_fegd :=NewPdfAnnotation ();_fgc :=&PdfAnnotationPolygon {};_fgc .PdfAnnotation =_fegd ;_fgc .PdfAnnotationMarkup =&PdfAnnotationMarkup {};_fegd .SetContext (_fgc );return _fgc ;};
|
||
|
||
// GetPdfName returns the PDF name used to indicate the border style.
|
||
// (Table 166 p. 395).
|
||
func (_eaad *BorderStyle )GetPdfName ()string {switch *_eaad {case BorderStyleSolid :return "\u0053";case BorderStyleDashed :return "\u0044";case BorderStyleBeveled :return "\u0042";case BorderStyleInset :return "\u0049";case BorderStyleUnderline :return "\u0055";
|
||
};return "";};func (_faa *PdfReader )newPdfActionURIFromDict (_gaad *_fg .PdfObjectDictionary )(*PdfActionURI ,error ){return &PdfActionURI {URI :_gaad .Get ("\u0055\u0052\u0049"),IsMap :_gaad .Get ("\u0049\u0073\u004da\u0070")},nil ;};
|
||
|
||
// WriteToFile writes the Appender output to file specified by path.
|
||
func (_fdbb *PdfAppender )WriteToFile (outputPath string )error {_bag ,_faefb :=_c .Create (outputPath );if _faefb !=nil {return _faefb ;};defer _bag .Close ();return _fdbb .Write (_bag );};
|
||
|
||
// PdfShadingPatternType3 is shading patterns that will use a Type 3 shading pattern (Radial).
|
||
type PdfShadingPatternType3 struct{*PdfPattern ;Shading *PdfShadingType3 ;Matrix *_fg .PdfObjectArray ;ExtGState _fg .PdfObject ;};
|
||
|
||
// SetXObjectImageByName adds the provided XObjectImage to the page resources.
|
||
// The added XObjectImage is identified by the specified name.
|
||
func (_dfgc *PdfPageResources )SetXObjectImageByName (keyName _fg .PdfObjectName ,ximg *XObjectImage )error {_cbggg :=ximg .ToPdfObject ().(*_fg .PdfObjectStream );_ddfd :=_dfgc .SetXObjectByName (keyName ,_cbggg );return _ddfd ;};
|
||
|
||
// PdfFont represents an underlying font structure which can be of type:
|
||
// - Type0
|
||
// - Type1
|
||
// - TrueType
|
||
// etc.
|
||
type PdfFont struct{_gcaeff pdfFont };
|
||
|
||
// NewPdfColorspaceFromPdfObject loads a PdfColorspace from a PdfObject. Returns an error if there is
|
||
// a failure in loading.
|
||
func NewPdfColorspaceFromPdfObject (obj _fg .PdfObject )(PdfColorspace ,error ){if obj ==nil {return nil ,nil ;};var _ccga *_fg .PdfIndirectObject ;var _dbba *_fg .PdfObjectName ;var _beed *_fg .PdfObjectArray ;if _abcf ,_cdfd :=obj .(*_fg .PdfIndirectObject );
|
||
_cdfd {_ccga =_abcf ;};obj =_fg .TraceToDirectObject (obj );switch _dcda :=obj .(type ){case *_fg .PdfObjectArray :_beed =_dcda ;case *_fg .PdfObjectName :_dbba =_dcda ;};if _dbba !=nil {switch *_dbba {case "\u0044\u0065\u0076\u0069\u0063\u0065\u0047\u0072\u0061\u0079":return NewPdfColorspaceDeviceGray (),nil ;
|
||
case "\u0044e\u0076\u0069\u0063\u0065\u0052\u0047B":return NewPdfColorspaceDeviceRGB (),nil ;case "\u0044\u0065\u0076\u0069\u0063\u0065\u0043\u004d\u0059\u004b":return NewPdfColorspaceDeviceCMYK (),nil ;case "\u0050a\u0074\u0074\u0065\u0072\u006e":return NewPdfColorspaceSpecialPattern (),nil ;
|
||
default:_aa .Log .Debug ("\u0045\u0052\u0052\u004fR\u003a\u0020\u0055\u006e\u006b\u006e\u006f\u0077\u006e\u0020c\u006fl\u006f\u0072\u0073\u0070\u0061\u0063\u0065 \u0025\u0073",*_dbba );return nil ,_gbfa ;};};if _beed !=nil &&_beed .Len ()> 0{var _eeaa _fg .PdfObject =_ccga ;
|
||
if _ccga ==nil {_eeaa =_beed ;};if _caaaa ,_bfbf :=_fg .GetName (_beed .Get (0));_bfbf {switch _caaaa .String (){case "\u0044\u0065\u0076\u0069\u0063\u0065\u0047\u0072\u0061\u0079":if _beed .Len ()==1{return NewPdfColorspaceDeviceGray (),nil ;};case "\u0044e\u0076\u0069\u0063\u0065\u0052\u0047B":if _beed .Len ()==1{return NewPdfColorspaceDeviceRGB (),nil ;
|
||
};case "\u0044\u0065\u0076\u0069\u0063\u0065\u0043\u004d\u0059\u004b":if _beed .Len ()==1{return NewPdfColorspaceDeviceCMYK (),nil ;};case "\u0043a\u006c\u0047\u0072\u0061\u0079":return _egdcc (_eeaa );case "\u0043\u0061\u006c\u0052\u0047\u0042":return _gfeff (_eeaa );
|
||
case "\u004c\u0061\u0062":return _adfa (_eeaa );case "\u0049\u0043\u0043\u0042\u0061\u0073\u0065\u0064":return _gbccc (_eeaa );case "\u0050a\u0074\u0074\u0065\u0072\u006e":return _aefba (_eeaa );case "\u0049n\u0064\u0065\u0078\u0065\u0064":return _fffa (_eeaa );
|
||
case "\u0053\u0065\u0070\u0061\u0072\u0061\u0074\u0069\u006f\u006e":return _fgbd (_eeaa );case "\u0044e\u0076\u0069\u0063\u0065\u004e":return _cagc (_eeaa );default:_aa .Log .Debug ("A\u0072\u0072\u0061\u0079\u0020\u0077i\u0074\u0068\u0020\u0069\u006e\u0076\u0061\u006c\u0069d\u0020\u006e\u0061m\u0065:\u0020\u0025\u0073",*_caaaa );
|
||
};};};_aa .Log .Debug ("\u0050\u0044\u0046\u0020\u0046i\u006c\u0065\u0020\u0045\u0072\u0072\u006f\u0072\u003a\u0020\u0043\u006f\u006co\u0072\u0073\u0070\u0061\u0063\u0065\u0020\u0074\u0079\u0070\u0065\u0020\u0065\u0072\u0072\u006f\u0072\u003a\u0020\u0025\u0073",obj .String ());
|
||
return nil ,ErrTypeCheck ;};func _aedef (_eaadce []*_fg .PdfObjectStream )*_fg .PdfObjectArray {if len (_eaadce )==0{return nil ;};_eccf :=make ([]_fg .PdfObject ,0,len (_eaadce ));for _ ,_dbgg :=range _eaadce {_eccf =append (_eccf ,_dbgg );};return _fg .MakeArray (_eccf ...);
|
||
};
|
||
|
||
// C returns the value of the C component of the color.
|
||
func (_edcae *PdfColorCalRGB )C ()float64 {return _edcae [2]};
|
||
|
||
// AlphaMap performs mapping of alpha data for transformations. Allows custom filtering of alpha data etc.
|
||
func (_acge *Image )AlphaMap (mapFunc AlphaMapFunc ){for _gaaaa ,_dddba :=range _acge ._gccd {_acge ._gccd [_gaaaa ]=mapFunc (_dddba );};};
|
||
|
||
// CharcodesToStrings returns the unicode strings corresponding to `charcodes`.
|
||
// The int returns are the number of strings and the number of unconvereted codes.
|
||
// NOTE: The number of strings returned is equal to the number of charcodes
|
||
func (_gaaee *PdfFont )CharcodesToStrings (charcodes []_dg .CharCode )([]string ,int ,int ){_gbabe :=_gaaee .baseFields ();_dedfg :=make ([]string ,0,len (charcodes ));_ddgbb :=0;_dagfc :=_gaaee .Encoder ();_ggef :=_gbabe ._agab !=nil &&_gaaee .IsSimple ()&&_gaaee .Subtype ()=="\u0054\u0072\u0075\u0065\u0054\u0079\u0070\u0065"&&!_dc .Contains (_gbabe ._agab .Name (),"\u0049d\u0065\u006e\u0074\u0069\u0074\u0079-");
|
||
if !_ggef &&_dagfc !=nil {switch _cdadb :=_dagfc .(type ){case _dg .SimpleEncoder :_cgecfd :=_cdadb .BaseName ();if _ ,_eeeg :=_cgdb [_cgecfd ];_eeeg {for _ ,_agcg :=range charcodes {if _dfebd ,_abcbe :=_dagfc .CharcodeToRune (_agcg );_abcbe {_dedfg =append (_dedfg ,string (_dfebd ));
|
||
}else {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u004e\u006f\u0020\u0072u\u006e\u0065\u002e\u0020\u0063\u006f\u0064\u0065=\u0030x\u0025\u0030\u0034\u0078\u0020\u0063\u0068\u0061\u0072\u0063\u006f\u0064\u0065\u0073\u003d\u005b\u0025\u00200\u0034\u0078\u005d\u0020\u0043\u0049\u0044\u003d\u0025\u0074\u000a"+"\t\u0066\u006f\u006e\u0074=%\u0073\n\u0009\u0065\u006e\u0063\u006fd\u0069\u006e\u0067\u003d\u0025\u0073",_agcg ,charcodes ,_gbabe .isCIDFont (),_gaaee ,_dagfc );
|
||
_ddgbb ++;_dedfg =append (_dedfg ,_fc .MissingCodeString );};};return _dedfg ,len (_dedfg ),_ddgbb ;};};};for _ ,_bcga :=range charcodes {if _gbabe ._agab !=nil {if _cgfbb ,_cgggb :=_gbabe ._agab .CharcodeToUnicode (_fc .CharCode (_bcga ));_cgggb {_dedfg =append (_dedfg ,_cgfbb );
|
||
continue ;};};if _dagfc !=nil {if _egb ,_baaaf :=_dagfc .CharcodeToRune (_bcga );_baaaf {_dedfg =append (_dedfg ,string (_egb ));continue ;};};_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u004e\u006f\u0020\u0072u\u006e\u0065\u002e\u0020\u0063\u006f\u0064\u0065=\u0030x\u0025\u0030\u0034\u0078\u0020\u0063\u0068\u0061\u0072\u0063\u006f\u0064\u0065\u0073\u003d\u005b\u0025\u00200\u0034\u0078\u005d\u0020\u0043\u0049\u0044\u003d\u0025\u0074\u000a"+"\t\u0066\u006f\u006e\u0074=%\u0073\n\u0009\u0065\u006e\u0063\u006fd\u0069\u006e\u0067\u003d\u0025\u0073",_bcga ,charcodes ,_gbabe .isCIDFont (),_gaaee ,_dagfc );
|
||
_ddgbb ++;_dedfg =append (_dedfg ,_fc .MissingCodeString );};if _ddgbb !=0{_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a \u0043\u006f\u0075\u006c\u0064\u006e\u0027\u0074\u0020\u0063\u006f\u006e\u0076\u0065\u0072\u0074\u0020\u0074\u006f\u0020u\u006e\u0069\u0063\u006f\u0064\u0065\u002e\u0020\u0055\u0073\u0069\u006e\u0067\u0020i\u006ep\u0075\u0074\u002e\u000a"+"\u0009\u006e\u0075\u006d\u0043\u0068\u0061\u0072\u0073\u003d\u0025d\u0020\u006e\u0075\u006d\u004d\u0069\u0073\u0073\u0065\u0073=\u0025\u0064\u000a"+"\u0009\u0066\u006f\u006e\u0074\u003d\u0025\u0073",len (charcodes ),_ddgbb ,_gaaee );
|
||
};return _dedfg ,len (_dedfg ),_ddgbb ;};
|
||
|
||
// PdfActionSetOCGState represents a SetOCGState action.
|
||
type PdfActionSetOCGState struct{*PdfAction ;State _fg .PdfObject ;PreserveRB _fg .PdfObject ;};
|
||
|
||
// ToPdfObject returns a PDF object representation of the outline destination.
|
||
func (_dbec OutlineDest )ToPdfObject ()_fg .PdfObject {if (_dbec .PageObj ==nil &&_dbec .Page < 0)||_dbec .Mode ==""{return _fg .MakeNull ();};_dedcf :=_fg .MakeArray ();if _dbec .PageObj !=nil {_dedcf .Append (_dbec .PageObj );}else {_dedcf .Append (_fg .MakeInteger (_dbec .Page ));
|
||
};_dedcf .Append (_fg .MakeName (_dbec .Mode ));switch _dbec .Mode {case "\u0046\u0069\u0074","\u0046\u0069\u0074\u0042":case "\u0046\u0069\u0074\u0048","\u0046\u0069\u0074B\u0048":_dedcf .Append (_fg .MakeFloat (_dbec .Y ));case "\u0046\u0069\u0074\u0056","\u0046\u0069\u0074B\u0056":_dedcf .Append (_fg .MakeFloat (_dbec .X ));
|
||
case "\u0058\u0059\u005a":_dedcf .Append (_fg .MakeFloat (_dbec .X ));_dedcf .Append (_fg .MakeFloat (_dbec .Y ));_dedcf .Append (_fg .MakeFloat (_dbec .Zoom ));default:_dedcf .Set (1,_fg .MakeName ("\u0046\u0069\u0074"));};return _dedcf ;};func (_ceac fontCommon )coreString ()string {_cbdc :="";
|
||
if _ceac ._cdgef !=nil {_cbdc =_ceac ._cdgef .String ();};return _d .Sprintf ("\u0025#\u0071\u0020%\u0023\u0071\u0020%\u0071\u0020\u006f\u0062\u006a\u003d\u0025d\u0020\u0054\u006f\u0055\u006e\u0069c\u006f\u0064\u0065\u003d\u0025\u0074\u0020\u0066\u006c\u0061\u0067s\u003d\u0030\u0078\u0025\u0030\u0078\u0020\u0025\u0073",_ceac ._ggcfc ,_ceac ._aefg ,_ceac ._edad ,_ceac ._dgagb ,_ceac ._eggb !=nil ,_ceac .fontFlags (),_cbdc );
|
||
};func (_ebggdb *PdfReader )newPdfSignatureFromIndirect (_dfdff *_fg .PdfIndirectObject )(*PdfSignature ,error ){_gegd ,_ffdbg :=_dfdff .PdfObject .(*_fg .PdfObjectDictionary );if !_ffdbg {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0053\u0069\u0067\u006e\u0061\u0074\u0075\u0072e\u0020\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0065\u0072\u0020\u006e\u006ft\u0020\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0069\u006e\u0067\u0020a \u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061\u0072\u0079");
|
||
return nil ,ErrTypeCheck ;};if _fdccb ,_fffec :=_ebggdb ._edebb .GetModelFromPrimitive (_dfdff ).(*PdfSignature );_fffec {return _fdccb ,nil ;};_aeea :=&PdfSignature {};_aeea ._fbbgf =_dfdff ;_aeea .Type ,_ =_fg .GetName (_gegd .Get ("\u0054\u0079\u0070\u0065"));
|
||
_aeea .Filter ,_ffdbg =_fg .GetName (_gegd .Get ("\u0046\u0069\u006c\u0074\u0065\u0072"));if !_ffdbg {_aa .Log .Error ("\u0045\u0052R\u004f\u0052\u003a\u0020\u0053i\u0067\u006e\u0061\u0074\u0075r\u0065\u0020\u0046\u0069\u006c\u0074\u0065\u0072\u0020\u0061\u0074\u0074\u0072\u0069\u0062\u0075\u0074\u0065\u0020\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u006f\u0072\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067");
|
||
return nil ,ErrInvalidAttribute ;};_aeea .SubFilter ,_ =_fg .GetName (_gegd .Get ("\u0053u\u0062\u0046\u0069\u006c\u0074\u0065r"));_aeea .Contents ,_ffdbg =_fg .GetString (_gegd .Get ("\u0043\u006f\u006e\u0074\u0065\u006e\u0074\u0073"));if !_ffdbg {_aa .Log .Error ("\u0045\u0052\u0052\u004f\u0052\u003a \u0053\u0069\u0067\u006e\u0061\u0074\u0075\u0072\u0065\u0020\u0063\u006f\u006et\u0065\u006e\u0074\u0073\u0020\u006d\u0069s\u0073\u0069\u006e\u0067");
|
||
return nil ,ErrInvalidAttribute ;};if _fdccd ,_aafedd :=_fg .GetArray (_gegd .Get ("\u0052e\u0066\u0065\u0072\u0065\u006e\u0063e"));_aafedd {_aeea .Reference =_fg .MakeArray ();for _ ,_eaab :=range _fdccd .Elements (){_gabcf ,_adfbg :=_fg .GetDict (_eaab );
|
||
if !_adfbg {_aa .Log .Error ("\u0045\u0052R\u004f\u0052\u003a\u0020R\u0065\u0066e\u0072\u0065\u006e\u0063\u0065\u0020\u0063\u006fn\u0074\u0065\u006e\u0074\u0073\u0020\u0069\u006e\u0076\u0061\u006c\u0069d\u0061\u0074\u0065\u0064");return nil ,ErrInvalidAttribute ;
|
||
};_gbcbe ,_cfgeb :=_ebggdb .newPdfSignatureReferenceFromDict (_gabcf );if _cfgeb !=nil {return nil ,_cfgeb ;};_aeea .Reference .Append (_gbcbe .ToPdfObject ());};};_aeea .Cert =_gegd .Get ("\u0043\u0065\u0072\u0074");_aeea .ByteRange ,_ =_fg .GetArray (_gegd .Get ("\u0042y\u0074\u0065\u0052\u0061\u006e\u0067e"));
|
||
_aeea .Changes ,_ =_fg .GetArray (_gegd .Get ("\u0043h\u0061\u006e\u0067\u0065\u0073"));_aeea .Name ,_ =_fg .GetString (_gegd .Get ("\u004e\u0061\u006d\u0065"));_aeea .M ,_ =_fg .GetString (_gegd .Get ("\u004d"));_aeea .Location ,_ =_fg .GetString (_gegd .Get ("\u004c\u006f\u0063\u0061\u0074\u0069\u006f\u006e"));
|
||
_aeea .Reason ,_ =_fg .GetString (_gegd .Get ("\u0052\u0065\u0061\u0073\u006f\u006e"));_aeea .ContactInfo ,_ =_fg .GetString (_gegd .Get ("C\u006f\u006e\u0074\u0061\u0063\u0074\u0049\u006e\u0066\u006f"));_aeea .R ,_ =_fg .GetInt (_gegd .Get ("\u0052"));
|
||
_aeea .V ,_ =_fg .GetInt (_gegd .Get ("\u0056"));_aeea .PropBuild ,_ =_fg .GetDict (_gegd .Get ("\u0050\u0072\u006f\u0070\u005f\u0042\u0075\u0069\u006c\u0064"));_aeea .PropAuthTime ,_ =_fg .GetInt (_gegd .Get ("\u0050\u0072\u006f\u0070\u005f\u0041\u0075\u0074\u0068\u0054\u0069\u006d\u0065"));
|
||
_aeea .PropAuthType ,_ =_fg .GetName (_gegd .Get ("\u0050\u0072\u006f\u0070\u005f\u0041\u0075\u0074\u0068\u0054\u0079\u0070\u0065"));_ebggdb ._edebb .Register (_dfdff ,_aeea );return _aeea ,nil ;};
|
||
|
||
// PdfSignatureReference represents a PDF signature reference dictionary and is used for signing via form signature fields.
|
||
// (Section 12.8.1, Table 253 - Entries in a signature reference dictionary p. 469 in PDF32000_2008).
|
||
type PdfSignatureReference struct{_gafdc *_fg .PdfObjectDictionary ;Type *_fg .PdfObjectName ;TransformMethod *_fg .PdfObjectName ;TransformParams _fg .PdfObject ;Data _fg .PdfObject ;DigestMethod *_fg .PdfObjectName ;};
|
||
|
||
// GetCharMetrics returns the char metrics for character code `code`.
|
||
func (_eggcf pdfCIDFontType0 )GetCharMetrics (code _dg .CharCode )(_eed .CharMetrics ,bool ){_afdfa :=_eggcf ._cgda ;if _cacfg ,_adae :=_eggcf ._fceed [code ];_adae {_afdfa =_cacfg ;};return _eed .CharMetrics {Wx :_afdfa },true ;};
|
||
|
||
// GetRuneMetrics returns the character metrics for the specified rune.
|
||
// A bool flag is returned to indicate whether or not the entry was found.
|
||
func (_fafcc pdfCIDFontType2 )GetRuneMetrics (r rune )(_eed .CharMetrics ,bool ){_dcad ,_ebgf :=_fafcc ._ebda [r ];if !_ebgf {_bbcga ,_bacg :=_fg .GetInt (_fafcc .DW );if !_bacg {return _eed .CharMetrics {},false ;};_dcad =int (*_bbcga );};return _eed .CharMetrics {Wx :float64 (_dcad )},true ;
|
||
};
|
||
|
||
// DetermineColorspaceNameFromPdfObject determines PDF colorspace from a PdfObject. Returns the colorspace name and
|
||
// an error on failure. If the colorspace was not found, will return an empty string.
|
||
func DetermineColorspaceNameFromPdfObject (obj _fg .PdfObject )(_fg .PdfObjectName ,error ){var _cafc *_fg .PdfObjectName ;var _abee *_fg .PdfObjectArray ;if _ebgd ,_bdgdd :=obj .(*_fg .PdfIndirectObject );_bdgdd {if _bbdg ,_feadd :=_ebgd .PdfObject .(*_fg .PdfObjectArray );
|
||
_feadd {_abee =_bbdg ;}else if _bfcc ,_gege :=_ebgd .PdfObject .(*_fg .PdfObjectName );_gege {_cafc =_bfcc ;};}else if _bebee ,_aaeg :=obj .(*_fg .PdfObjectArray );_aaeg {_abee =_bebee ;}else if _eac ,_ecdd :=obj .(*_fg .PdfObjectName );_ecdd {_cafc =_eac ;
|
||
};if _cafc !=nil {switch *_cafc {case "\u0044\u0065\u0076\u0069\u0063\u0065\u0047\u0072\u0061\u0079","\u0044e\u0076\u0069\u0063\u0065\u0052\u0047B","\u0044\u0065\u0076\u0069\u0063\u0065\u0043\u004d\u0059\u004b":return *_cafc ,nil ;case "\u0050a\u0074\u0074\u0065\u0072\u006e":return *_cafc ,nil ;
|
||
};};if _abee !=nil &&_abee .Len ()> 0{if _gaec ,_aedd :=_abee .Get (0).(*_fg .PdfObjectName );_aedd {switch *_gaec {case "\u0044\u0065\u0076\u0069\u0063\u0065\u0047\u0072\u0061\u0079","\u0044e\u0076\u0069\u0063\u0065\u0052\u0047B","\u0044\u0065\u0076\u0069\u0063\u0065\u0043\u004d\u0059\u004b":if _abee .Len ()==1{return *_gaec ,nil ;
|
||
};case "\u0043a\u006c\u0047\u0072\u0061\u0079","\u0043\u0061\u006c\u0052\u0047\u0042","\u004c\u0061\u0062":return *_gaec ,nil ;case "\u0049\u0043\u0043\u0042\u0061\u0073\u0065\u0064","\u0050a\u0074\u0074\u0065\u0072\u006e","\u0049n\u0064\u0065\u0078\u0065\u0064":return *_gaec ,nil ;
|
||
case "\u0053\u0065\u0070\u0061\u0072\u0061\u0074\u0069\u006f\u006e","\u0044e\u0076\u0069\u0063\u0065\u004e":return *_gaec ,nil ;};};};return "",nil ;};
|
||
|
||
// GetCustomInfo returns a custom info value for the specified name.
|
||
func (_eabb *PdfInfo )GetCustomInfo (name string )*_fg .PdfObjectString {var _fgcd *_fg .PdfObjectString ;if _eabb ._aaee ==nil {return _fgcd ;};if _baae ,_cafgd :=_eabb ._aaee .Get (*_fg .MakeName (name )).(*_fg .PdfObjectString );_cafgd {_fgcd =_baae ;
|
||
};return _fgcd ;};func _abbbg ()string {_baacg .Lock ();defer _baacg .Unlock ();return _fdcca };
|
||
|
||
// PdfColorCalRGB represents a color in the Colorimetric CIE RGB colorspace.
|
||
// A, B, C components
|
||
// Each component is defined in the range 0.0 - 1.0 where 1.0 is the primary intensity.
|
||
type PdfColorCalRGB [3]float64 ;
|
||
|
||
// DecodeArray returns the range of color component values in DeviceGray colorspace.
|
||
func (_affc *PdfColorspaceDeviceGray )DecodeArray ()[]float64 {return []float64 {0,1.0}};
|
||
|
||
// PdfActionNamed represents a named action.
|
||
type PdfActionNamed struct{*PdfAction ;N _fg .PdfObject ;};func _gcgcc (_dcbc string )(map[_dg .CharCode ]_dg .GlyphName ,error ){_cbaa :=_dc .Split (_dcbc ,"\u000a");_bbeb :=make (map[_dg .CharCode ]_dg .GlyphName );for _ ,_efbe :=range _cbaa {_dadfb :=_caab .FindStringSubmatch (_efbe );
|
||
if _dadfb ==nil {continue ;};_bgdcg ,_eefcd :=_dadfb [1],_dadfb [2];_faeda ,_eabgd :=_bad .Atoi (_bgdcg );if _eabgd !=nil {_aa .Log .Debug ("\u0045\u0052\u0052\u004fR\u003a\u0020\u0042\u0061\u0064\u0020\u0065\u006e\u0063\u006fd\u0069n\u0067\u0020\u006c\u0069\u006e\u0065\u002e \u0025\u0071",_efbe );
|
||
return nil ,_fg .ErrTypeError ;};_bbeb [_dg .CharCode (_faeda )]=_dg .GlyphName (_eefcd );};_aa .Log .Trace ("g\u0065\u0074\u0045\u006e\u0063\u006fd\u0069\u006e\u0067\u0073\u003a\u0020\u006b\u0065\u0079V\u0061\u006c\u0075e\u0073=\u0025\u0023\u0076",_bbeb );
|
||
return _bbeb ,nil ;};
|
||
|
||
// PdfPageResourcesColorspaces contains the colorspace in the PdfPageResources.
|
||
// Needs to have matching name and colorspace map entry. The Names define the order.
|
||
type PdfPageResourcesColorspaces struct{Names []string ;Colorspaces map[string ]PdfColorspace ;_daff *_fg .PdfIndirectObject ;};type pdfFontType0 struct{fontCommon ;_cgacd *_fg .PdfIndirectObject ;_bcacf _dg .TextEncoder ;Encoding _fg .PdfObject ;DescendantFont *PdfFont ;
|
||
_abeac *_fc .CMap ;};func (_effeg *pdfFontSimple )baseFields ()*fontCommon {return &_effeg .fontCommon };func (_bbge *PdfAppender )mergeResources (_gfg ,_effc _fg .PdfObject ,_ggd map[_fg .PdfObjectName ]_fg .PdfObjectName )_fg .PdfObject {if _effc ==nil &&_gfg ==nil {return nil ;
|
||
};if _effc ==nil {return _gfg ;};_fgfc ,_gad :=_fg .GetDict (_effc );if !_gad {return _gfg ;};if _gfg ==nil {_cbffa :=_fg .MakeDict ();_cbffa .Merge (_fgfc );return _effc ;};_ceed ,_gad :=_fg .GetDict (_gfg );if !_gad {_aa .Log .Error ("\u0045\u0072\u0072or\u0020\u0072\u0065\u0073\u006f\u0075\u0072\u0063\u0065 \u0069s\u0020n\u006ft\u0020\u0061\u0020\u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061\u0072\u0079");
|
||
_ceed =_fg .MakeDict ();};for _ ,_eged :=range _fgfc .Keys (){if _bebd ,_gdee :=_ggd [_eged ];_gdee {_ceed .Set (_bebd ,_fgfc .Get (_eged ));}else {_ceed .Set (_eged ,_fgfc .Get (_eged ));};};return _ceed ;};func _fbace (_ababa *_fg .PdfObjectStream )(*PdfFunctionType0 ,error ){_gaaa :=&PdfFunctionType0 {};
|
||
_gaaa ._ddgf =_ababa ;_ebag :=_ababa .PdfObjectDictionary ;_dgbbc ,_ddccbg :=_fg .TraceToDirectObject (_ebag .Get ("\u0044\u006f\u006d\u0061\u0069\u006e")).(*_fg .PdfObjectArray );if !_ddccbg {_aa .Log .Error ("D\u006fm\u0061\u0069\u006e\u0020\u006e\u006f\u0074\u0020s\u0070\u0065\u0063\u0069fi\u0065\u0064");
|
||
return nil ,_ce .New ("\u0072\u0065q\u0075\u0069\u0072\u0065d\u0020\u0061t\u0074\u0072\u0069\u0062\u0075\u0074\u0065\u0020m\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u006f\u0072\u0020\u0069\u006ev\u0061\u006c\u0069\u0064");};if _dgbbc .Len ()< 0||_dgbbc .Len ()%2!=0{_aa .Log .Error ("\u0044\u006f\u006d\u0061\u0069\u006e\u0020\u0069\u006ev\u0061\u006c\u0069\u0064");
|
||
return nil ,_ce .New ("i\u006ev\u0061\u006c\u0069\u0064\u0020\u0064\u006f\u006da\u0069\u006e\u0020\u0072an\u0067\u0065");};_gaaa .NumInputs =_dgbbc .Len ()/2;_bgbgf ,_fecec :=_dgbbc .ToFloat64Array ();if _fecec !=nil {return nil ,_fecec ;};_gaaa .Domain =_bgbgf ;
|
||
_dgbbc ,_ddccbg =_fg .TraceToDirectObject (_ebag .Get ("\u0052\u0061\u006eg\u0065")).(*_fg .PdfObjectArray );if !_ddccbg {_aa .Log .Error ("\u0052\u0061\u006e\u0067e \u006e\u006f\u0074\u0020\u0073\u0070\u0065\u0063\u0069\u0066\u0069\u0065\u0064");return nil ,_ce .New ("\u0072\u0065q\u0075\u0069\u0072\u0065d\u0020\u0061t\u0074\u0072\u0069\u0062\u0075\u0074\u0065\u0020m\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u006f\u0072\u0020\u0069\u006ev\u0061\u006c\u0069\u0064");
|
||
};if _dgbbc .Len ()< 0||_dgbbc .Len ()%2!=0{return nil ,_ce .New ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0072\u0061\u006e\u0067\u0065");};_gaaa .NumOutputs =_dgbbc .Len ()/2;_fgff ,_fecec :=_dgbbc .ToFloat64Array ();if _fecec !=nil {return nil ,_fecec ;
|
||
};_gaaa .Range =_fgff ;_dgbbc ,_ddccbg =_fg .TraceToDirectObject (_ebag .Get ("\u0053\u0069\u007a\u0065")).(*_fg .PdfObjectArray );if !_ddccbg {_aa .Log .Error ("\u0053i\u007ae\u0020\u006e\u006f\u0074\u0020s\u0070\u0065c\u0069\u0066\u0069\u0065\u0064");
|
||
return nil ,_ce .New ("\u0072\u0065q\u0075\u0069\u0072\u0065d\u0020\u0061t\u0074\u0072\u0069\u0062\u0075\u0074\u0065\u0020m\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u006f\u0072\u0020\u0069\u006ev\u0061\u006c\u0069\u0064");};_bgda ,_fecec :=_dgbbc .ToIntegerArray ();
|
||
if _fecec !=nil {return nil ,_fecec ;};if len (_bgda )!=_gaaa .NumInputs {_aa .Log .Error ("T\u0061\u0062\u006c\u0065\u0020\u0073\u0069\u007a\u0065\u0020\u006e\u006f\u0074\u0020\u006d\u0061\u0074\u0063h\u0069\u006e\u0067\u0020\u006e\u0075\u006d\u0062\u0065\u0072 o\u0066\u0020\u0069n\u0070u\u0074\u0073");
|
||
return nil ,_ce .New ("r\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b");};_gaaa .Size =_bgda ;_bgee ,_ddccbg :=_fg .TraceToDirectObject (_ebag .Get ("\u0042\u0069\u0074\u0073\u0050\u0065\u0072\u0053\u0061\u006d\u0070\u006c\u0065")).(*_fg .PdfObjectInteger );
|
||
if !_ddccbg {_aa .Log .Error ("B\u0069\u0074\u0073\u0050\u0065\u0072S\u0061\u006d\u0070\u006c\u0065\u0020\u006e\u006f\u0074 \u0073\u0070\u0065c\u0069f\u0069\u0065\u0064");return nil ,_ce .New ("\u0072\u0065q\u0075\u0069\u0072\u0065d\u0020\u0061t\u0074\u0072\u0069\u0062\u0075\u0074\u0065\u0020m\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u006f\u0072\u0020\u0069\u006ev\u0061\u006c\u0069\u0064");
|
||
};if *_bgee !=1&&*_bgee !=2&&*_bgee !=4&&*_bgee !=8&&*_bgee !=12&&*_bgee !=16&&*_bgee !=24&&*_bgee !=32{_aa .Log .Error ("\u0042\u0069\u0074s \u0070\u0065\u0072\u0020\u0073\u0061\u006d\u0070\u006ce\u0020o\u0075t\u0073i\u0064\u0065\u0020\u0072\u0061\u006e\u0067\u0065\u0020\u0028\u0025\u0064\u0029",*_bgee );
|
||
return nil ,_ce .New ("r\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b");};_gaaa .BitsPerSample =int (*_bgee );_gaaa .Order =1;_cada ,_ddccbg :=_fg .TraceToDirectObject (_ebag .Get ("\u004f\u0072\u0064e\u0072")).(*_fg .PdfObjectInteger );
|
||
if _ddccbg {if *_cada !=1&&*_cada !=3{_aa .Log .Error ("\u0049n\u0076a\u006c\u0069\u0064\u0020\u006fr\u0064\u0065r\u0020\u0028\u0025\u0064\u0029",*_cada );return nil ,_ce .New ("r\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b");};_gaaa .Order =int (*_cada );
|
||
};_dgbbc ,_ddccbg =_fg .TraceToDirectObject (_ebag .Get ("\u0045\u006e\u0063\u006f\u0064\u0065")).(*_fg .PdfObjectArray );if _ddccbg {_gebd ,_acbd :=_dgbbc .ToFloat64Array ();if _acbd !=nil {return nil ,_acbd ;};_gaaa .Encode =_gebd ;};_dgbbc ,_ddccbg =_fg .TraceToDirectObject (_ebag .Get ("\u0044\u0065\u0063\u006f\u0064\u0065")).(*_fg .PdfObjectArray );
|
||
if _ddccbg {_bcdb ,_febd :=_dgbbc .ToFloat64Array ();if _febd !=nil {return nil ,_febd ;};_gaaa .Decode =_bcdb ;};_ggcgg ,_fecec :=_fg .DecodeStream (_ababa );if _fecec !=nil {return nil ,_fecec ;};_gaaa ._cfed =_ggcgg ;return _gaaa ,nil ;};
|
||
|
||
// GetCharMetrics returns the char metrics for character code `code`.
|
||
func (_gcdg pdfFontType0 )GetCharMetrics (code _dg .CharCode )(_eed .CharMetrics ,bool ){if _gcdg .DescendantFont ==nil {_aa .Log .Debug ("\u0045\u0052R\u004f\u0052\u003a\u0020\u004e\u006f\u0020\u0064\u0065\u0073\u0063\u0065\u006e\u0064\u0061\u006e\u0074\u002e\u0020\u0066\u006f\u006et=\u0025\u0073",_gcdg );
|
||
return _eed .CharMetrics {},false ;};return _gcdg .DescendantFont .GetCharMetrics (code );};
|
||
|
||
// GetOutlines returns a high-level Outline object, based on the outline tree
|
||
// of the reader.
|
||
func (_cbaedb *PdfReader )GetOutlines ()(*Outline ,error ){if _cbaedb ==nil {return nil ,_ce .New ("\u0063\u0061n\u006e\u006f\u0074\u0020c\u0072\u0065a\u0074\u0065\u0020\u006f\u0075\u0074\u006c\u0069n\u0065\u0020\u0066\u0072\u006f\u006d\u0020\u006e\u0069\u006c\u0020\u0072e\u0061\u0064\u0065\u0072");
|
||
};_eacfa :=_cbaedb .GetOutlineTree ();if _eacfa ==nil {return nil ,_ce .New ("\u0074\u0068\u0065\u0020\u0073\u0070\u0065\u0063\u0069\u0066\u0069\u0065\u0064\u0020\u0072\u0065\u0061\u0064e\u0072\u0020\u0064\u006f\u0065\u0073\u0020n\u006f\u0074\u0020\u0068\u0061\u0076\u0065\u0020\u0061\u006e\u0020o\u0075\u0074\u006c\u0069\u006e\u0065\u0020\u0074\u0072\u0065\u0065");
|
||
};var _gfdcd func (_fgefc *PdfOutlineTreeNode ,_ecbgg *[]*OutlineItem );_gfdcd =func (_bbag *PdfOutlineTreeNode ,_cfdgd *[]*OutlineItem ){if _bbag ==nil {return ;};if _bbag ._gfcge ==nil {_aa .Log .Debug ("\u0045\u0052RO\u0052\u003a\u0020m\u0069\u0073\u0073\u0069ng \u006fut\u006c\u0069\u006e\u0065\u0020\u0065\u006etr\u0079\u0020\u0063\u006f\u006e\u0074\u0065x\u0074");
|
||
return ;};var _babf *OutlineItem ;if _cadgg ,_edfdd :=_bbag ._gfcge .(*PdfOutlineItem );_edfdd {_fgdfd :=_cadgg .Dest ;if (_fgdfd ==nil ||_fg .IsNullObject (_fgdfd ))&&_cadgg .A !=nil {if _bcgcg ,_eaafgc :=_fg .GetDict (_cadgg .A );_eaafgc {if _baedd ,_egbb :=_fg .GetArray (_bcgcg .Get ("\u0044"));
|
||
_egbb {_fgdfd =_baedd ;}else {_aabgc ,_egaef :=_fg .GetString (_bcgcg .Get ("\u0044"));if !_egaef {return ;};_ddged ,_egaef :=_cbaedb ._cgegd .Get ("\u004e\u0061\u006de\u0073").(*_fg .PdfObjectReference );if !_egaef {return ;};_bcdaa ,_cgcfa :=_cbaedb ._ccgg .LookupByReference (*_ddged );
|
||
if _cgcfa !=nil {_aa .Log .Debug ("\u0045\u0052\u0052O\u0052\u003a\u0020\u0046\u0061\u0069\u006c\u0065\u0064\u0020\u0074\u006f\u0020\u0072\u0065\u0061\u0064\u0020\u006e\u0061\u006d\u0065\u0073\u0020\u0072\u0065\u0066\u0065\u0072e\u006e\u0063\u0065\u0020\u0028\u0025\u0073\u0029",_cgcfa .Error ());
|
||
return ;};_badcb ,_egaef :=_bcdaa .(*_fg .PdfIndirectObject );if !_egaef {return ;};_gdadf :=map[_fg .PdfObject ]struct{}{};_cgcfa =_cbaedb .buildNameNodes (_badcb ,_gdadf );if _cgcfa !=nil {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0046\u0061\u0069\u006c\u0065\u0064\u0020\u0074\u006f\u0020\u0062\u0075\u0069\u006c\u0064\u0020\u006ea\u006d\u0065\u0020\u006e\u006fd\u0065\u0073 \u0028\u0025\u0073\u0029",_cgcfa .Error ());
|
||
return ;};for _bdecd :=range _gdadf {_eadce ,_dacaa :=_fg .GetDict (_bdecd );if !_dacaa {continue ;};_ggfcg ,_dacaa :=_fg .GetArray (_eadce .Get ("\u004e\u0061\u006de\u0073"));if !_dacaa {continue ;};for _cadec ,_aebdc :=range _ggfcg .Elements (){switch _aebdc .(type ){case *_fg .PdfObjectString :if _aebdc .String ()==_aabgc .String (){if _bebfb :=_ggfcg .Get (_cadec +1);
|
||
_bebfb !=nil {if _caca ,_cgcc :=_fg .GetDict (_bebfb );_cgcc {_fgdfd =_caca .Get ("\u0044");break ;};};};};};};};};};var _ccaba OutlineDest ;if _fgdfd !=nil &&!_fg .IsNullObject (_fgdfd ){if _egaff ,_dcaa :=_agcbc (_fgdfd ,_cbaedb );_dcaa ==nil {_ccaba =*_egaff ;
|
||
}else {_aa .Log .Debug ("\u0057\u0041\u0052\u004e\u003a\u0020\u0063o\u0075\u006c\u0064 \u006e\u006f\u0074\u0020p\u0061\u0072\u0073\u0065\u0020\u006f\u0075\u0074\u006c\u0069\u006e\u0065\u0020\u0064\u0065\u0073\u0074\u0020\u0028\u0025\u0076\u0029\u003a\u0020\u0025\u0076",_fgdfd ,_dcaa );
|
||
};};_babf =NewOutlineItem (_cadgg .Title .Decoded (),_ccaba );*_cfdgd =append (*_cfdgd ,_babf );if _cadgg .Next !=nil {_gfdcd (_cadgg .Next ,_cfdgd );};};if _bbag .First !=nil {if _babf !=nil {_cfdgd =&_babf .Entries ;};_gfdcd (_bbag .First ,_cfdgd );};
|
||
};_fabc :=NewOutline ();_gfdcd (_eacfa ,&_fabc .Entries );return _fabc ,nil ;};
|
||
|
||
// GetContainingPdfObject implements interface PdfModel.
|
||
func (_ca *PdfAction )GetContainingPdfObject ()_fg .PdfObject {return _ca ._bda };
|
||
|
||
// FieldFlattenOpts defines a set of options which can be used to configure
|
||
// the field flattening process.
|
||
type FieldFlattenOpts struct{
|
||
|
||
// FilterFunc allows filtering the form fields used in the flattening
|
||
// process. If the filter function returns true, the field is flattened,
|
||
// otherwise it is skipped.
|
||
// If a non-terminal field is discarded, all of its children (the fields
|
||
// present in the Kids array) are discarded as well.
|
||
// Non-terminal fields are kept in the AcroForm if one or more of their
|
||
// child fields have not been selected for flattening.
|
||
// If a filter function is not provided, all form fields are flattened.
|
||
FilterFunc FieldFilterFunc ;
|
||
|
||
// AnnotFilterFunc allows filtering the annotations in the flattening
|
||
// process. If the filter function returns true, the annotation is flattened,
|
||
// otherwise it is skipped.
|
||
AnnotFilterFunc AnnotFilterFunc ;};
|
||
|
||
// NewPdfShadingType3 creates an empty shading type 3 dictionary.
|
||
func NewPdfShadingType3 ()*PdfShadingType3 {_gaee :=&PdfShadingType3 {};_gaee .PdfShading =&PdfShading {};_gaee .PdfShading ._cbabf =_fg .MakeIndirectObject (_fg .MakeDict ());_gaee .PdfShading ._bcbef =_gaee ;return _gaee ;};
|
||
|
||
// ColorToRGB verifies that the input color is an RGB color. Method exists in
|
||
// order to satisfy the PdfColorspace interface.
|
||
func (_acdd *PdfColorspaceDeviceRGB )ColorToRGB (color PdfColor )(PdfColor ,error ){_cfdb ,_ggbd :=color .(*PdfColorDeviceRGB );if !_ggbd {_aa .Log .Debug ("\u0049\u006e\u0070\u0075\u0074\u0020\u0063\u006f\u006c\u006f\u0072 \u006e\u006f\u0074\u0020\u0064\u0065\u0076\u0069\u0063\u0065 \u0052\u0047\u0042");
|
||
return nil ,_ce .New ("\u0074\u0079p\u0065\u0020\u0063h\u0065\u0063\u006b\u0020\u0065\u0072\u0072\u006f\u0072");};return _cfdb ,nil ;};func _aafff ()*modelManager {_gfcce :=modelManager {};_gfcce ._abga =map[PdfModel ]_fg .PdfObject {};_gfcce ._fbbfaf =map[_fg .PdfObject ]PdfModel {};
|
||
return &_gfcce ;};func _cfdcd (_ebegef *_fg .PdfObjectStream )(*PdfFunctionType4 ,error ){_afggb :=&PdfFunctionType4 {};_afggb ._dega =_ebegef ;_fdfb :=_ebegef .PdfObjectDictionary ;_gacae ,_daea :=_fg .TraceToDirectObject (_fdfb .Get ("\u0044\u006f\u006d\u0061\u0069\u006e")).(*_fg .PdfObjectArray );
|
||
if !_daea {_aa .Log .Error ("D\u006fm\u0061\u0069\u006e\u0020\u006e\u006f\u0074\u0020s\u0070\u0065\u0063\u0069fi\u0065\u0064");return nil ,_ce .New ("\u0072\u0065q\u0075\u0069\u0072\u0065d\u0020\u0061t\u0074\u0072\u0069\u0062\u0075\u0074\u0065\u0020m\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u006f\u0072\u0020\u0069\u006ev\u0061\u006c\u0069\u0064");
|
||
};if _gacae .Len ()%2!=0{_aa .Log .Error ("\u0044\u006f\u006d\u0061\u0069\u006e\u0020\u0069\u006ev\u0061\u006c\u0069\u0064");return nil ,_ce .New ("i\u006ev\u0061\u006c\u0069\u0064\u0020\u0064\u006f\u006da\u0069\u006e\u0020\u0072an\u0067\u0065");};_aede ,_bfcf :=_gacae .ToFloat64Array ();
|
||
if _bfcf !=nil {return nil ,_bfcf ;};_afggb .Domain =_aede ;_gacae ,_daea =_fg .TraceToDirectObject (_fdfb .Get ("\u0052\u0061\u006eg\u0065")).(*_fg .PdfObjectArray );if _daea {if _gacae .Len ()< 0||_gacae .Len ()%2!=0{return nil ,_ce .New ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0072\u0061\u006e\u0067\u0065");
|
||
};_aacdf ,_caaca :=_gacae .ToFloat64Array ();if _caaca !=nil {return nil ,_caaca ;};_afggb .Range =_aacdf ;};_caae ,_bfcf :=_fg .DecodeStream (_ebegef );if _bfcf !=nil {return nil ,_bfcf ;};_afggb ._dedbd =_caae ;_dcdeg :=_bc .NewPSParser (_caae );_gagdg ,_bfcf :=_dcdeg .Parse ();
|
||
if _bfcf !=nil {return nil ,_bfcf ;};_afggb .Program =_gagdg ;return _afggb ,nil ;};
|
||
|
||
// Initialize initializes the PdfSignature.
|
||
func (_cfacc *PdfSignature )Initialize ()error {if _cfacc .Handler ==nil {return _ce .New ("\u0073\u0069\u0067n\u0061\u0074\u0075\u0072e\u0020\u0068\u0061\u006e\u0064\u006c\u0065r\u0020\u0063\u0061\u006e\u006e\u006f\u0074\u0020\u0062\u0065\u0020\u006e\u0069\u006c");
|
||
};return _cfacc .Handler .InitSignature (_cfacc );};
|
||
|
||
// UpdateObject marks `obj` as updated and to be included in the following revision.
|
||
func (_gaef *PdfAppender )UpdateObject (obj _fg .PdfObject ){_gaef .replaceObject (obj ,obj );if _ ,_aeab :=_gaef ._aec [obj ];!_aeab {_gaef ._gcdb =append (_gaef ._gcdb ,obj );_gaef ._aec [obj ]=struct{}{};};};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_adag *PdfAnnotationFreeText )ToPdfObject ()_fg .PdfObject {_adag .PdfAnnotation .ToPdfObject ();_gebe :=_adag ._agb ;_adf :=_gebe .PdfObject .(*_fg .PdfObjectDictionary );_adag .PdfAnnotationMarkup .appendToPdfDictionary (_adf );_adf .SetIfNotNil ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u0046\u0072\u0065\u0065\u0054\u0065\u0078\u0074"));
|
||
_adf .SetIfNotNil ("\u0044\u0041",_adag .DA );_adf .SetIfNotNil ("\u0051",_adag .Q );_adf .SetIfNotNil ("\u0052\u0043",_adag .RC );_adf .SetIfNotNil ("\u0044\u0053",_adag .DS );_adf .SetIfNotNil ("\u0043\u004c",_adag .CL );_adf .SetIfNotNil ("\u0049\u0054",_adag .IT );
|
||
_adf .SetIfNotNil ("\u0042\u0045",_adag .BE );_adf .SetIfNotNil ("\u0052\u0044",_adag .RD );_adf .SetIfNotNil ("\u0042\u0053",_adag .BS );_adf .SetIfNotNil ("\u004c\u0045",_adag .LE );return _gebe ;};
|
||
|
||
// ColorFromFloats returns a new PdfColor based on the input slice of color
|
||
// components. The slice should contain three elements representing the
|
||
// A, B and C components of the color. The values of the elements should be
|
||
// between 0 and 1.
|
||
func (_dfeb *PdfColorspaceCalRGB )ColorFromFloats (vals []float64 )(PdfColor ,error ){if len (vals )!=3{return nil ,_ce .New ("r\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b");};_bdcc :=vals [0];if _bdcc < 0.0||_bdcc > 1.0{_aa .Log .Debug ("\u0063\u006f\u006cor\u0020\u006f\u0075\u0074\u0020\u006f\u0066\u0020\u0043\u0053\u0020\u0072\u0061\u006e\u0067\u0065\u003a\u0020",_bdcc );
|
||
return nil ,ErrColorOutOfRange ;};_bddcf :=vals [1];if _bddcf < 0.0||_bddcf > 1.0{_aa .Log .Debug ("\u0063\u006f\u006cor\u0020\u006f\u0075\u0074\u0020\u006f\u0066\u0020\u0043\u0053\u0020\u0072\u0061\u006e\u0067\u0065\u003a\u0020",_bddcf );return nil ,ErrColorOutOfRange ;
|
||
};_geebf :=vals [2];if _geebf < 0.0||_geebf > 1.0{_aa .Log .Debug ("\u0063\u006f\u006cor\u0020\u006f\u0075\u0074\u0020\u006f\u0066\u0020\u0043\u0053\u0020\u0072\u0061\u006e\u0067\u0065\u003a\u0020",_geebf );return nil ,ErrColorOutOfRange ;};_cdbd :=NewPdfColorCalRGB (_bdcc ,_bddcf ,_geebf );
|
||
return _cdbd ,nil ;};
|
||
|
||
// GetNumComponents returns the number of color components (3 for RGB).
|
||
func (_ccb *PdfColorDeviceRGB )GetNumComponents ()int {return 3};
|
||
|
||
// NewBorderStyle returns an initialized PdfBorderStyle.
|
||
func NewBorderStyle ()*PdfBorderStyle {_aea :=&PdfBorderStyle {};return _aea };
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_efeg *PdfBorderStyle )ToPdfObject ()_fg .PdfObject {_cgdeb :=_fg .MakeDict ();if _efeg ._ebeb !=nil {if _cbgg ,_baed :=_efeg ._ebeb .(*_fg .PdfIndirectObject );_baed {_cbgg .PdfObject =_cgdeb ;};};_cgdeb .Set ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u0042\u006f\u0072\u0064\u0065\u0072"));
|
||
if _efeg .W !=nil {_cgdeb .Set ("\u0057",_fg .MakeFloat (*_efeg .W ));};if _efeg .S !=nil {_cgdeb .Set ("\u0053",_fg .MakeName (_efeg .S .GetPdfName ()));};if _efeg .D !=nil {_cgdeb .Set ("\u0044",_fg .MakeArrayFromIntegers (*_efeg .D ));};if _efeg ._ebeb !=nil {return _efeg ._ebeb ;
|
||
};return _cgdeb ;};
|
||
|
||
// CharMetrics represents width and height metrics of a glyph.
|
||
type CharMetrics =_eed .CharMetrics ;
|
||
|
||
// AlphaMapFunc represents a alpha mapping function: byte -> byte. Can be used for
|
||
// thresholding the alpha channel, i.e. setting all alpha values below threshold to transparent.
|
||
type AlphaMapFunc func (_bfec byte )byte ;
|
||
|
||
// FieldImageProvider provides fields images for specified fields.
|
||
type FieldImageProvider interface{FieldImageValues ()(map[string ]*Image ,error );};
|
||
|
||
// AddExtGState adds a graphics state to the XObject resources.
|
||
func (_cbda *PdfPage )AddExtGState (name _fg .PdfObjectName ,egs *_fg .PdfObjectDictionary )error {if _cbda .Resources ==nil {_cbda .Resources =NewPdfPageResources ();};if _cbda .Resources .ExtGState ==nil {_cbda .Resources .ExtGState =_fg .MakeDict ();
|
||
};_gdgd ,_eecdbe :=_fg .TraceToDirectObject (_cbda .Resources .ExtGState ).(*_fg .PdfObjectDictionary );if !_eecdbe {_aa .Log .Debug ("\u0045\u0078\u0070\u0065\u0063\u0074\u0065\u0064\u0020\u0045\u0078t\u0047\u0053\u0074\u0061\u0074\u0065\u0020\u0064i\u0063t\u0069\u006f\u006e\u0061\u0072\u0079\u0020\u0069\u0073\u0020\u006e\u006f\u0074\u0020\u0061\u0020\u0064\u0069c\u0074\u0069\u006f\u006e\u0061\u0072\u0079\u003a\u0020\u0025\u0076",_fg .TraceToDirectObject (_cbda .Resources .ExtGState ));
|
||
return _ce .New ("\u0074\u0079p\u0065\u0020\u0063h\u0065\u0063\u006b\u0020\u0065\u0072\u0072\u006f\u0072");};_gdgd .Set (name ,egs );return nil ;};
|
||
|
||
// NewPdfColorPatternType3 returns an empty color shading pattern type 3 (Radial).
|
||
func NewPdfColorPatternType3 ()*PdfColorPatternType3 {_dfcc :=&PdfColorPatternType3 {};return _dfcc };
|
||
|
||
// B returns the value of the blue component of the color.
|
||
func (_dcef *PdfColorDeviceRGB )B ()float64 {return _dcef [2]};
|
||
|
||
// ColorToRGB converts a CalGray color to an RGB color.
|
||
func (_eace *PdfColorspaceCalGray )ColorToRGB (color PdfColor )(PdfColor ,error ){_bdgec ,_bgdd :=color .(*PdfColorCalGray );if !_bgdd {_aa .Log .Debug ("\u0049n\u0070\u0075\u0074\u0020\u0063\u006f\u006c\u006f\u0072\u0020\u006eo\u0074\u0020\u0063\u0061\u006c\u0020\u0067\u0072\u0061\u0079");
|
||
return nil ,_ce .New ("\u0074\u0079p\u0065\u0020\u0063h\u0065\u0063\u006b\u0020\u0065\u0072\u0072\u006f\u0072");};ANorm :=_bdgec .Val ();X :=_eace .WhitePoint [0]*_ef .Pow (ANorm ,_eace .Gamma );Y :=_eace .WhitePoint [1]*_ef .Pow (ANorm ,_eace .Gamma );
|
||
Z :=_eace .WhitePoint [2]*_ef .Pow (ANorm ,_eace .Gamma );_ecec :=3.240479*X +-1.537150*Y +-0.498535*Z ;_gcgc :=-0.969256*X +1.875992*Y +0.041556*Z ;_fage :=0.055648*X +-0.204043*Y +1.057311*Z ;_ecec =_ef .Min (_ef .Max (_ecec ,0),1.0);_gcgc =_ef .Min (_ef .Max (_gcgc ,0),1.0);
|
||
_fage =_ef .Min (_ef .Max (_fage ,0),1.0);return NewPdfColorDeviceRGB (_ecec ,_gcgc ,_fage ),nil ;};
|
||
|
||
// NewPdfOutlineTree returns an initialized PdfOutline tree.
|
||
func NewPdfOutlineTree ()*PdfOutline {_daecd :=NewPdfOutline ();_daecd ._gfcge =&_daecd ;return _daecd ;};
|
||
|
||
// GetNumComponents returns the number of color components (1 for grayscale).
|
||
func (_aac *PdfColorDeviceGray )GetNumComponents ()int {return 1};func (_ffbd *PdfColorspaceDeviceRGB )String ()string {return "\u0044e\u0076\u0069\u0063\u0065\u0052\u0047B";};
|
||
|
||
// GetXObjectByName gets XObject by name.
|
||
func (_gbce *PdfPage )GetXObjectByName (name _fg .PdfObjectName )(_fg .PdfObject ,bool ){_cdbbe ,_abfa :=_gbce .Resources .XObject .(*_fg .PdfObjectDictionary );if !_abfa {return nil ,false ;};if _ggfaa :=_cdbbe .Get (name );_ggfaa !=nil {return _ggfaa ,true ;
|
||
};return nil ,false ;};const (FieldFlagClear FieldFlag =0;FieldFlagReadOnly FieldFlag =1;FieldFlagRequired FieldFlag =(1<<1);FieldFlagNoExport FieldFlag =(2<<1);FieldFlagNoToggleToOff FieldFlag =(1<<14);FieldFlagRadio FieldFlag =(1<<15);FieldFlagPushbutton FieldFlag =(1<<16);
|
||
FieldFlagRadiosInUnision FieldFlag =(1<<25);FieldFlagMultiline FieldFlag =(1<<12);FieldFlagPassword FieldFlag =(1<<13);FieldFlagFileSelect FieldFlag =(1<<20);FieldFlagDoNotScroll FieldFlag =(1<<23);FieldFlagComb FieldFlag =(1<<24);FieldFlagRichText FieldFlag =(1<<26);
|
||
FieldFlagDoNotSpellCheck FieldFlag =(1<<22);FieldFlagCombo FieldFlag =(1<<17);FieldFlagEdit FieldFlag =(1<<18);FieldFlagSort FieldFlag =(1<<19);FieldFlagMultiSelect FieldFlag =(1<<21);FieldFlagCommitOnSelChange FieldFlag =(1<<27););func (_gefgc *PdfAcroForm )filteredFields (_cacca FieldFilterFunc ,_bebb bool )[]*PdfField {if _gefgc ==nil {return nil ;
|
||
};return _gcbgc (_gefgc .Fields ,_cacca ,_bebb );};func (_geda *Image )samplesTrimPadding (_bebbe []uint32 )[]uint32 {_ccdb :=_geda .ColorComponents *int (_geda .Width )*int (_geda .Height );if len (_bebbe )==_ccdb {return _bebbe ;};_ggdff :=make ([]uint32 ,_ccdb );
|
||
_cadd :=int (_geda .Width )*_geda .ColorComponents ;var _fgbfa ,_cafdf ,_daagf ,_eebcf int ;_aeagcd :=_cc .BytesPerLine (int (_geda .Width ),int (_geda .BitsPerComponent ),_geda .ColorComponents );for _fgbfa =0;_fgbfa < int (_geda .Height );_fgbfa ++{_cafdf =_fgbfa *int (_geda .Width );
|
||
_daagf =_fgbfa *_aeagcd ;for _eebcf =0;_eebcf < _cadd ;_eebcf ++{_ggdff [_cafdf +_eebcf ]=_bebbe [_daagf +_eebcf ];};};return _ggdff ;};
|
||
|
||
// PdfAnnotationInk represents Ink annotations.
|
||
// (Section 12.5.6.13).
|
||
type PdfAnnotationInk struct{*PdfAnnotation ;*PdfAnnotationMarkup ;InkList _fg .PdfObject ;BS _fg .PdfObject ;};
|
||
|
||
// GetDocMDPPermission returns the DocMDP level of the restrictions
|
||
func (_egba *PdfSignature )GetDocMDPPermission ()(_gbb .DocMDPPermission ,bool ){for _ ,_fafbf :=range _egba .Reference .Elements (){if _dafdg ,_fbccg :=_fg .GetDict (_fafbf );_fbccg {if _effg ,_faebb :=_fg .GetNameVal (_dafdg .Get ("\u0054r\u0061n\u0073\u0066\u006f\u0072\u006d\u004d\u0065\u0074\u0068\u006f\u0064"));
|
||
_faebb &&_effg =="\u0044\u006f\u0063\u004d\u0044\u0050"{if _egddd ,_gffb :=_fg .GetDict (_dafdg .Get ("\u0054r\u0061n\u0073\u0066\u006f\u0072\u006d\u0050\u0061\u0072\u0061\u006d\u0073"));_gffb {if P ,_aaeae :=_fg .GetIntVal (_egddd .Get ("\u0050"));_aaeae {return _gbb .DocMDPPermission (P ),true ;
|
||
};};};};};return 0,false ;};
|
||
|
||
// Encoder returns the font's text encoder.
|
||
func (_ffeec pdfFontType0 )Encoder ()_dg .TextEncoder {return _ffeec ._bcacf };type fontCommon struct{_aefg string ;_ggcfc string ;_edad string ;_eggb _fg .PdfObject ;_agab *_fc .CMap ;_cdgef *PdfFontDescriptor ;_dgagb int64 ;};
|
||
|
||
// PdfFunctionType2 defines an exponential interpolation of one input value and n
|
||
// output values:
|
||
// f(x) = y_0, ..., y_(n-1)
|
||
// y_j = C0_j + x^N * (C1_j - C0_j); for 0 <= j < n
|
||
// When N=1 ; linear interpolation between C0 and C1.
|
||
type PdfFunctionType2 struct{Domain []float64 ;Range []float64 ;C0 []float64 ;C1 []float64 ;N float64 ;_aceef *_fg .PdfIndirectObject ;};
|
||
|
||
// GetRevisionNumber returns the version of the current Pdf document
|
||
func (_bbgff *PdfReader )GetRevisionNumber ()int {return _bbgff ._ccgg .GetRevisionNumber ()};
|
||
|
||
// PdfActionTrans represents a trans action.
|
||
type PdfActionTrans struct{*PdfAction ;Trans _fg .PdfObject ;};
|
||
|
||
// Add appends an outline item as a child of the current outline item.
|
||
func (_bgdad *OutlineItem )Add (item *OutlineItem ){_bgdad .Entries =append (_bgdad .Entries ,item )};func (_dcdd *PdfColorspaceICCBased )String ()string {return "\u0049\u0043\u0043\u0042\u0061\u0073\u0065\u0064";};
|
||
|
||
// GetContext returns the context of the outline tree node, which is either a
|
||
// *PdfOutline or a *PdfOutlineItem. The method returns nil for uninitialized
|
||
// tree nodes.
|
||
func (_dbef *PdfOutlineTreeNode )GetContext ()PdfModel {if _cdef ,_ggag :=_dbef ._gfcge .(*PdfOutline );_ggag {return _cdef ;};if _abbafb ,_deafg :=_dbef ._gfcge .(*PdfOutlineItem );_deafg {return _abbafb ;};_aa .Log .Debug ("\u0045\u0052RO\u0052\u0020\u0049n\u0076\u0061\u006c\u0069d o\u0075tl\u0069\u006e\u0065\u0020\u0074\u0072\u0065e \u006e\u006f\u0064\u0065\u0020\u0069\u0074e\u006d");
|
||
return nil ;};
|
||
|
||
// PdfInfo holds document information that will overwrite
|
||
// document information global variables defined above.
|
||
type PdfInfo struct{Title *_fg .PdfObjectString ;Author *_fg .PdfObjectString ;Subject *_fg .PdfObjectString ;Keywords *_fg .PdfObjectString ;Creator *_fg .PdfObjectString ;Producer *_fg .PdfObjectString ;CreationDate *PdfDate ;ModifiedDate *PdfDate ;Trapped *_fg .PdfObjectName ;
|
||
_aaee *_fg .PdfObjectDictionary ;};
|
||
|
||
// GetEncryptionMethod returns a descriptive information string about the encryption method used.
|
||
func (_ccdce *PdfReader )GetEncryptionMethod ()string {_cdgab :=_ccdce ._ccgg .GetCrypter ();return _cdgab .String ();};
|
||
|
||
// GetCatalogStructTreeRoot gets the catalog StructTreeRoot object.
|
||
func (_fbagg *PdfReader )GetCatalogStructTreeRoot ()(_fg .PdfObject ,bool ){if _fbagg ._cgegd ==nil {return nil ,false ;};_agffb :=_fbagg ._cgegd .Get ("\u0053\u0074\u0072\u0075\u0063\u0074\u0054\u0072\u0065e\u0052\u006f\u006f\u0074");return _agffb ,_agffb !=nil ;
|
||
};
|
||
|
||
// Resample resamples the image data converting from current BitsPerComponent to a target BitsPerComponent
|
||
// value. Sets the image's BitsPerComponent to the target value following resampling.
|
||
//
|
||
// For example, converting an 8-bit RGB image to 1-bit grayscale (common for scanned images):
|
||
// // Convert RGB image to grayscale.
|
||
// rgbColorSpace := pdf.NewPdfColorspaceDeviceRGB()
|
||
// grayImage, err := rgbColorSpace.ImageToGray(rgbImage)
|
||
// if err != nil {
|
||
// return err
|
||
// }
|
||
// // Resample as 1 bit.
|
||
// grayImage.Resample(1)
|
||
func (_ffgbb *Image )Resample (targetBitsPerComponent int64 ){if _ffgbb .BitsPerComponent ==targetBitsPerComponent {return ;};_fdbea :=_ffgbb .GetSamples ();if targetBitsPerComponent < _ffgbb .BitsPerComponent {_bgged :=_ffgbb .BitsPerComponent -targetBitsPerComponent ;
|
||
for _dddf :=range _fdbea {_fdbea [_dddf ]>>=uint (_bgged );};}else if targetBitsPerComponent > _ffgbb .BitsPerComponent {_gbgeb :=targetBitsPerComponent -_ffgbb .BitsPerComponent ;for _cdbfg :=range _fdbea {_fdbea [_cdbfg ]<<=uint (_gbgeb );};};_ffgbb .BitsPerComponent =targetBitsPerComponent ;
|
||
if _ffgbb .BitsPerComponent < 8{_ffgbb .resampleLowBits (_fdbea );return ;};_edbc :=_cc .BytesPerLine (int (_ffgbb .Width ),int (_ffgbb .BitsPerComponent ),_ffgbb .ColorComponents );_gefeb :=make ([]byte ,_edbc *int (_ffgbb .Height ));var (_gaabea ,_dcddc ,_agabc ,_dagfd int ;
|
||
_efcfb uint32 ;);for _agabc =0;_agabc < int (_ffgbb .Height );_agabc ++{_gaabea =_agabc *_edbc ;_dcddc =(_agabc +1)*_edbc -1;_eegde :=_ade .ResampleUint32 (_fdbea [_gaabea :_dcddc ],int (targetBitsPerComponent ),8);for _dagfd ,_efcfb =range _eegde {_gefeb [_dagfd +_gaabea ]=byte (_efcfb );
|
||
};};_ffgbb .Data =_gefeb ;};
|
||
|
||
// GetNumComponents returns the number of input color components, i.e. that are input to the tint transform.
|
||
func (_daec *PdfColorspaceDeviceN )GetNumComponents ()int {return _daec .ColorantNames .Len ()};
|
||
|
||
// ColorFromPdfObjects returns a new PdfColor based on the input slice of color
|
||
// components. The slice should contain three PdfObjectFloat elements representing
|
||
// the A, B and C components of the color.
|
||
func (_gggc *PdfColorspaceCalRGB )ColorFromPdfObjects (objects []_fg .PdfObject )(PdfColor ,error ){if len (objects )!=3{return nil ,_ce .New ("r\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b");};_bbdae ,_bfde :=_fg .GetNumbersAsFloat (objects );
|
||
if _bfde !=nil {return nil ,_bfde ;};return _gggc .ColorFromFloats (_bbdae );};func (_gfbf *PdfReader )newPdfActionTransFromDict (_fdg *_fg .PdfObjectDictionary )(*PdfActionTrans ,error ){return &PdfActionTrans {Trans :_fdg .Get ("\u0054\u0072\u0061n\u0073")},nil ;
|
||
};
|
||
|
||
// PdfAnnotationRedact represents Redact annotations.
|
||
// (Section 12.5.6.23).
|
||
type PdfAnnotationRedact struct{*PdfAnnotation ;*PdfAnnotationMarkup ;QuadPoints _fg .PdfObject ;IC _fg .PdfObject ;RO _fg .PdfObject ;OverlayText _fg .PdfObject ;Repeat _fg .PdfObject ;DA _fg .PdfObject ;Q _fg .PdfObject ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_cg *PdfAction )ToPdfObject ()_fg .PdfObject {_agc :=_cg ._bda ;_ec :=_agc .PdfObject .(*_fg .PdfObjectDictionary );_ec .Clear ();_ec .Set ("\u0054\u0079\u0070\u0065",_fg .MakeName ("\u0041\u0063\u0074\u0069\u006f\u006e"));_ec .SetIfNotNil ("\u0053",_cg .S );
|
||
_ec .SetIfNotNil ("\u004e\u0065\u0078\u0074",_cg .Next );return _agc ;};
|
||
|
||
// NewPdfAnnotationSquiggly returns a new text squiggly annotation.
|
||
func NewPdfAnnotationSquiggly ()*PdfAnnotationSquiggly {_efcg :=NewPdfAnnotation ();_afg :=&PdfAnnotationSquiggly {};_afg .PdfAnnotation =_efcg ;_afg .PdfAnnotationMarkup =&PdfAnnotationMarkup {};_efcg .SetContext (_afg );return _afg ;};
|
||
|
||
// NewPdfColorPattern returns an empty color pattern.
|
||
func NewPdfColorPattern ()*PdfColorPattern {_dgcd :=&PdfColorPattern {};return _dgcd };
|
||
|
||
// StringToCharcodeBytes maps the provided string runes to charcode bytes and
|
||
// it returns the resulting slice of bytes, along with the number of runes
|
||
// which could not be converted. If the number of misses is 0, all string runes
|
||
// were successfully converted.
|
||
func (_fgead *PdfFont )StringToCharcodeBytes (str string )([]byte ,int ){return _fgead .RunesToCharcodeBytes ([]rune (str ));};
|
||
|
||
// Evaluate runs the function. Input is [x1 x2 x3].
|
||
func (_ebfaac *PdfFunctionType4 )Evaluate (xVec []float64 )([]float64 ,error ){if _ebfaac ._babdc ==nil {_ebfaac ._babdc =_bc .NewPSExecutor (_ebfaac .Program );};var _aceg []_bc .PSObject ;for _ ,_bbff :=range xVec {_aceg =append (_aceg ,_bc .MakeReal (_bbff ));
|
||
};_cfcag ,_edbab :=_ebfaac ._babdc .Execute (_aceg );if _edbab !=nil {return nil ,_edbab ;};_ffadd ,_edbab :=_bc .PSObjectArrayToFloat64Array (_cfcag );if _edbab !=nil {return nil ,_edbab ;};return _ffadd ,nil ;};func (_bgbed *PdfAcroForm )fillImageWithAppearance (_gegfg FieldImageProvider ,_eaaaf FieldAppearanceGenerator )error {if _bgbed ==nil {return nil ;
|
||
};_gagf ,_bcdca :=_gegfg .FieldImageValues ();if _bcdca !=nil {return _bcdca ;};for _ ,_cfdcf :=range _bgbed .AllFields (){_deac :=_cfdcf .PartialName ();_gebcd ,_gcdc :=_gagf [_deac ];if !_gcdc {if _debf ,_efbec :=_cfdcf .FullName ();_efbec ==nil {_gebcd ,_gcdc =_gagf [_debf ];
|
||
};};if !_gcdc {_aa .Log .Debug ("\u0057\u0041\u0052\u004e\u003a\u0020f\u006f\u0072\u006d \u0066\u0069\u0065l\u0064\u0020\u0025\u0073\u0020\u006e\u006f\u0074\u0020\u0066o\u0075\u006e\u0064\u0020\u0069n \u0074\u0068\u0065\u0020\u0070\u0072\u006f\u0076\u0069\u0064\u0065\u0072\u002e\u0020\u0053\u006b\u0069\u0070\u0070\u0069\u006e\u0067\u002e",_deac );
|
||
continue ;};switch _dcfgaf :=_cfdcf .GetContext ().(type ){case *PdfFieldButton :if _dcfgaf .IsPush (){_dcfgaf .SetFillImage (_gebcd );};};if _eaaaf ==nil {continue ;};for _ ,_fafdc :=range _cfdcf .Annotations {_gdfe ,_beaff :=_eaaaf .GenerateAppearanceDict (_bgbed ,_cfdcf ,_fafdc );
|
||
if _beaff !=nil {return _beaff ;};_fafdc .AP =_gdfe ;_fafdc .ToPdfObject ();};};return nil ;};func (_bcadf *PdfWriter )writeOutlines ()error {if _bcadf ._baebg ==nil {return nil ;};_aa .Log .Trace ("\u004f\u0075t\u006c\u0069\u006ee\u0054\u0072\u0065\u0065\u003a\u0020\u0025\u002b\u0076",_bcadf ._baebg );
|
||
_gfgbb :=_bcadf ._baebg .ToPdfObject ();_aa .Log .Trace ("\u004fu\u0074\u006c\u0069\u006e\u0065\u0073\u003a\u0020\u0025\u002b\u0076 \u0028\u0025\u0054\u002c\u0020\u0070\u003a\u0025\u0070\u0029",_gfgbb ,_gfgbb ,_gfgbb );_bcadf ._cgacf .Set ("\u004f\u0075\u0074\u006c\u0069\u006e\u0065\u0073",_gfgbb );
|
||
_adcf :=_bcadf .addObjects (_gfgbb );if _adcf !=nil {return _adcf ;};return nil ;};func (_dfge *PdfShading )getShadingDict ()(*_fg .PdfObjectDictionary ,error ){_fbfdf :=_dfge ._cbabf ;if _egbe ,_dbgca :=_fbfdf .(*_fg .PdfIndirectObject );_dbgca {_edebc ,_ccddf :=_egbe .PdfObject .(*_fg .PdfObjectDictionary );
|
||
if !_ccddf {return nil ,_fg .ErrTypeError ;};return _edebc ,nil ;}else if _cacfdc ,_caecb :=_fbfdf .(*_fg .PdfObjectStream );_caecb {return _cacfdc .PdfObjectDictionary ,nil ;}else if _feffd ,_ffgbf :=_fbfdf .(*_fg .PdfObjectDictionary );_ffgbf {return _feffd ,nil ;
|
||
}else {_aa .Log .Debug ("U\u006e\u0061\u0062\u006c\u0065\u0020t\u006f\u0020\u0061\u0063\u0063\u0065s\u0073\u0020\u0073\u0068\u0061\u0064\u0069n\u0067\u0020\u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061r\u0079");return nil ,_fg .ErrTypeError ;};};
|
||
|
||
// GetParamsDict returns *core.PdfObjectDictionary with a set of basic image parameters.
|
||
func (_fabf *Image )GetParamsDict ()*_fg .PdfObjectDictionary {_aacf :=_fg .MakeDict ();_aacf .Set ("\u0057\u0069\u0064t\u0068",_fg .MakeInteger (_fabf .Width ));_aacf .Set ("\u0048\u0065\u0069\u0067\u0068\u0074",_fg .MakeInteger (_fabf .Height ));_aacf .Set ("\u0043o\u006co\u0072\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074\u0073",_fg .MakeInteger (int64 (_fabf .ColorComponents )));
|
||
_aacf .Set ("\u0042\u0069t\u0073\u0050\u0065r\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074",_fg .MakeInteger (_fabf .BitsPerComponent ));return _aacf ;};
|
||
|
||
// ToPdfObject sets the common field elements.
|
||
// Note: Call the more field context's ToPdfObject to set both the generic and
|
||
// non-generic information.
|
||
func (_eaddg *PdfField )ToPdfObject ()_fg .PdfObject {_edafg :=_eaddg ._daecc ;_gfba :=_edafg .PdfObject .(*_fg .PdfObjectDictionary );_bgcd :=_fg .MakeArray ();for _ ,_faadd :=range _eaddg .Kids {_bgcd .Append (_faadd .ToPdfObject ());};for _ ,_ggfa :=range _eaddg .Annotations {if _ggfa ._agb !=_eaddg ._daecc {_bgcd .Append (_ggfa .GetContext ().ToPdfObject ());
|
||
};};if _eaddg .Parent !=nil {_gfba .SetIfNotNil ("\u0050\u0061\u0072\u0065\u006e\u0074",_eaddg .Parent .GetContainingPdfObject ());};if _bgcd .Len ()> 0{_gfba .Set ("\u004b\u0069\u0064\u0073",_bgcd );};_gfba .SetIfNotNil ("\u0046\u0054",_eaddg .FT );_gfba .SetIfNotNil ("\u0054",_eaddg .T );
|
||
_gfba .SetIfNotNil ("\u0054\u0055",_eaddg .TU );_gfba .SetIfNotNil ("\u0054\u004d",_eaddg .TM );_gfba .SetIfNotNil ("\u0046\u0066",_eaddg .Ff );_gfba .SetIfNotNil ("\u0056",_eaddg .V );_gfba .SetIfNotNil ("\u0044\u0056",_eaddg .DV );_gfba .SetIfNotNil ("\u0041\u0041",_eaddg .AA );
|
||
if _eaddg .VariableText !=nil {_gfba .SetIfNotNil ("\u0044\u0041",_eaddg .VariableText .DA );_gfba .SetIfNotNil ("\u0051",_eaddg .VariableText .Q );_gfba .SetIfNotNil ("\u0044\u0053",_eaddg .VariableText .DS );_gfba .SetIfNotNil ("\u0052\u0056",_eaddg .VariableText .RV );
|
||
};return _edafg ;};func (_dcbf *PdfReader )newPdfAnnotationCircleFromDict (_ccd *_fg .PdfObjectDictionary )(*PdfAnnotationCircle ,error ){_cbc :=PdfAnnotationCircle {};_gfd ,_ffab :=_dcbf .newPdfAnnotationMarkupFromDict (_ccd );if _ffab !=nil {return nil ,_ffab ;
|
||
};_cbc .PdfAnnotationMarkup =_gfd ;_cbc .BS =_ccd .Get ("\u0042\u0053");_cbc .IC =_ccd .Get ("\u0049\u0043");_cbc .BE =_ccd .Get ("\u0042\u0045");_cbc .RD =_ccd .Get ("\u0052\u0044");return &_cbc ,nil ;};
|
||
|
||
// Fill populates `form` with values provided by `provider`.
|
||
func (_faaba *PdfAcroForm )Fill (provider FieldValueProvider )error {return _faaba .fill (provider ,nil )};
|
||
|
||
// GetXObjectFormByName returns the XObjectForm with the specified name from the
|
||
// page resources, if it exists.
|
||
func (_aegea *PdfPageResources )GetXObjectFormByName (keyName _fg .PdfObjectName )(*XObjectForm ,error ){_dbdbfe ,_gdgb :=_aegea .GetXObjectByName (keyName );if _dbdbfe ==nil {return nil ,nil ;};if _gdgb !=XObjectTypeForm {return nil ,_ce .New ("\u006e\u006f\u0074\u0020\u0061\u0020\u0066\u006f\u0072\u006d");
|
||
};_ebgcf ,_geaab :=NewXObjectFormFromStream (_dbdbfe );if _geaab !=nil {return nil ,_geaab ;};return _ebgcf ,nil ;};
|
||
|
||
// ToPdfObject returns the PDF representation of the outline tree node.
|
||
func (_aafffe *PdfOutlineTreeNode )ToPdfObject ()_fg .PdfObject {return _aafffe .GetContext ().ToPdfObject ();};
|
||
|
||
// Encrypt encrypts the output file with a specified user/owner password.
|
||
func (_ebecf *PdfWriter )Encrypt (userPass ,ownerPass []byte ,options *EncryptOptions )error {_deaef :=RC4_128bit ;if options !=nil {_deaef =options .Algorithm ;};_gbedb :=_gb .PermOwner ;if options !=nil {_gbedb =options .Permissions ;};var _cgfg _bgf .Filter ;
|
||
switch _deaef {case RC4_128bit :_cgfg =_bgf .NewFilterV2 (16);case AES_128bit :_cgfg =_bgf .NewFilterAESV2 ();case AES_256bit :_cgfg =_bgf .NewFilterAESV3 ();default:return _d .Errorf ("\u0075n\u0073\u0075\u0070\u0070o\u0072\u0074\u0065\u0064\u0020a\u006cg\u006fr\u0069\u0074\u0068\u006d\u003a\u0020\u0025v",options .Algorithm );
|
||
};_cfcgd ,_cgggc ,_daed :=_fg .PdfCryptNewEncrypt (_cgfg ,userPass ,ownerPass ,_gbedb );if _daed !=nil {return _daed ;};_ebecf ._bbdbd =_cfcgd ;if _cgggc .Major !=0{_ebecf .SetVersion (_cgggc .Major ,_cgggc .Minor );};_ebecf ._fagba =_cgggc .Encrypt ;_ebecf ._deeab ,_ebecf ._ccccb =_cgggc .ID0 ,_cgggc .ID1 ;
|
||
_cdbbd :=_fg .MakeIndirectObject (_cgggc .Encrypt );_ebecf ._abgdg =_cdbbd ;_ebecf .addObject (_cdbbd );return nil ;};
|
||
|
||
// GetPage returns the PdfPage model for the specified page number.
|
||
func (_ddddc *PdfReader )GetPage (pageNumber int )(*PdfPage ,error ){if _ddddc ._ccgg .GetCrypter ()!=nil &&!_ddddc ._ccgg .IsAuthenticated (){return nil ,_d .Errorf ("\u0066\u0069\u006c\u0065\u0020\u006e\u0065\u0065\u0064\u0073\u0020\u0074\u006f\u0020\u0062e\u0020d\u0065\u0063\u0072\u0079\u0070\u0074\u0065\u0064\u0020\u0066\u0069\u0072\u0073\u0074");
|
||
};if len (_ddddc ._bgce )< pageNumber {return nil ,_ce .New ("\u0069\u006e\u0076a\u006c\u0069\u0064\u0020\u0070\u0061\u0067\u0065\u0020\u006e\u0075\u006d\u0062\u0065\u0072\u0020\u0028\u0070\u0061\u0067\u0065\u0020\u0063\u006f\u0075\u006e\u0074\u0020\u0074o\u006f\u0020\u0073\u0068\u006f\u0072\u0074\u0029");
|
||
};_affbc :=pageNumber -1;if _affbc < 0{return nil ,_d .Errorf ("\u0070\u0061\u0067\u0065\u0020\u006e\u0075\u006d\u0062\u0065r\u0069\u006e\u0067\u0020\u006d\u0075\u0073t\u0020\u0073\u0074\u0061\u0072\u0074\u0020\u0061\u0074\u0020\u0031");};_bced :=_ddddc .PageList [_affbc ];
|
||
return _bced ,nil ;};
|
||
|
||
// EnableChain adds the specified certificate chain and validation data (OCSP
|
||
// and CRL information) for it to the global scope of the document DSS. The
|
||
// added data is used for validating any of the signatures present in the
|
||
// document. The LTV client attempts to build the certificate chain up to a
|
||
// trusted root by downloading any missing certificates.
|
||
func (_bffe *LTV )EnableChain (chain []*_ge .Certificate )error {return _bffe .enable (nil ,chain ,"")};
|
||
|
||
// PdfPage represents a page in a PDF document. (7.7.3.3 - Table 30).
|
||
type PdfPage struct{Parent _fg .PdfObject ;LastModified *PdfDate ;Resources *PdfPageResources ;CropBox *PdfRectangle ;MediaBox *PdfRectangle ;BleedBox *PdfRectangle ;TrimBox *PdfRectangle ;ArtBox *PdfRectangle ;BoxColorInfo _fg .PdfObject ;Contents _fg .PdfObject ;
|
||
Rotate *int64 ;Group _fg .PdfObject ;Thumb _fg .PdfObject ;B _fg .PdfObject ;Dur _fg .PdfObject ;Trans _fg .PdfObject ;AA _fg .PdfObject ;Metadata _fg .PdfObject ;PieceInfo _fg .PdfObject ;StructParents _fg .PdfObject ;ID _fg .PdfObject ;PZ _fg .PdfObject ;
|
||
SeparationInfo _fg .PdfObject ;Tabs _fg .PdfObject ;TemplateInstantiated _fg .PdfObject ;PresSteps _fg .PdfObject ;UserUnit _fg .PdfObject ;VP _fg .PdfObject ;Annots _fg .PdfObject ;_fbbb []*PdfAnnotation ;_eebge *_fg .PdfObjectDictionary ;_aebf *_fg .PdfIndirectObject ;
|
||
_cceb _fg .PdfObjectDictionary ;_dedef *PdfReader ;};
|
||
|
||
// GetDescent returns the Descent of the font `descriptor`.
|
||
func (_ggbfg *PdfFontDescriptor )GetDescent ()(float64 ,error ){return _fg .GetNumberAsFloat (_ggbfg .Descent );};func _fbdc ()_g .Time {_baacg .Lock ();defer _baacg .Unlock ();return _fbefe };func _gfegc (_gaffda _fg .PdfObject )[]*_fg .PdfObjectStream {if _gaffda ==nil {return nil ;
|
||
};_bageda ,_bgec :=_fg .GetArray (_gaffda );if !_bgec ||_bageda .Len ()==0{return nil ;};_ageb :=make ([]*_fg .PdfObjectStream ,0,_bageda .Len ());for _ ,_beeaae :=range _bageda .Elements (){if _ebedf ,_badg :=_fg .GetStream (_beeaae );_badg {_ageb =append (_ageb ,_ebedf );
|
||
};};return _ageb ;};
|
||
|
||
// Insert adds a top level outline item in the outline,
|
||
// at the specified index.
|
||
func (_fbbe *Outline )Insert (index uint ,item *OutlineItem ){_deedb :=uint (len (_fbbe .Entries ));if index > _deedb {index =_deedb ;};_fbbe .Entries =append (_fbbe .Entries [:index ],append ([]*OutlineItem {item },_fbbe .Entries [index :]...)...);};
|
||
|
||
// SetNameDictionary sets the Names entry in the PDF catalog.
|
||
// See section 7.7.4 "Name Dictionary" (p. 80 PDF32000_2008).
|
||
func (_gggbd *PdfWriter )SetNameDictionary (names _fg .PdfObject )error {if names ==nil {return nil ;};_aa .Log .Trace ("\u0053e\u0074\u0074\u0069\u006e\u0067\u0020\u0063\u0061\u0074\u0061\u006co\u0067\u0020\u004e\u0061\u006d\u0065\u0073\u002e\u002e\u002e");
|
||
_gggbd ._cgacf .Set ("\u004e\u0061\u006de\u0073",names );return _gggbd .addObjects (names );};
|
||
|
||
// PdfColorspaceDeviceNAttributes contains additional information about the components of colour space that
|
||
// conforming readers may use. Conforming readers need not use the alternateSpace and tintTransform parameters,
|
||
// and may instead use a custom blending algorithms, along with other information provided in the attributes
|
||
// dictionary if present.
|
||
type PdfColorspaceDeviceNAttributes struct{Subtype *_fg .PdfObjectName ;Colorants _fg .PdfObject ;Process _fg .PdfObject ;MixingHints _fg .PdfObject ;_eagf *_fg .PdfIndirectObject ;};
|
||
|
||
// NewPdfColorspaceLab returns a new Lab colorspace object.
|
||
func NewPdfColorspaceLab ()*PdfColorspaceLab {_egec :=&PdfColorspaceLab {};_egec .BlackPoint =[]float64 {0.0,0.0,0.0};_egec .Range =[]float64 {-100,100,-100,100};return _egec ;};func _afdf (_agddg *_fg .PdfObjectDictionary ,_egeeb *fontCommon )(*pdfFontType0 ,error ){_aaeea ,_eacdf :=_fg .GetArray (_agddg .Get ("\u0044e\u0073c\u0065\u006e\u0064\u0061\u006e\u0074\u0046\u006f\u006e\u0074\u0073"));
|
||
if !_eacdf {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0049n\u0076\u0061\u006cid\u0020\u0044\u0065\u0073\u0063\u0065n\u0064\u0061\u006e\u0074\u0046\u006f\u006e\u0074\u0073\u0020\u002d\u0020\u006e\u006f\u0074 \u0061\u006e\u0020\u0061\u0072\u0072\u0061\u0079 \u0025\u0073",_egeeb );
|
||
return nil ,_fg .ErrRangeError ;};if _aaeea .Len ()!=1{_aa .Log .Debug ("\u0045\u0052R\u004f\u0052\u003a\u0020\u0041\u0072\u0072\u0061\u0079\u0020\u006c\u0065\u006e\u0067\u0074\u0068\u0020\u0021\u003d\u0020\u0031\u0020(%\u0064\u0029",_aaeea .Len ());return nil ,_fg .ErrRangeError ;
|
||
};_ggda ,_effdc :=_bfab (_aaeea .Get (0),false );if _effdc !=nil {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0046a\u0069\u006c\u0065d \u006c\u006f\u0061\u0064\u0069\u006eg\u0020\u0064\u0065\u0073\u0063\u0065\u006e\u0064\u0061\u006e\u0074\u0020\u0066\u006f\u006et\u003a\u0020\u0065\u0072\u0072\u003d\u0025\u0076 \u0025\u0073",_effdc ,_egeeb );
|
||
return nil ,_effdc ;};_gfag :=_cabb (_egeeb );_gfag .DescendantFont =_ggda ;_abgcc ,_eacdf :=_fg .GetNameVal (_agddg .Get ("\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067"));if _eacdf {if _abgcc =="\u0049\u0064\u0065\u006e\u0074\u0069\u0074\u0079\u002d\u0048"||_abgcc =="\u0049\u0064\u0065\u006e\u0074\u0069\u0074\u0079\u002d\u0056"{_gfag ._bcacf =_dg .NewIdentityTextEncoder (_abgcc );
|
||
}else if _fc .IsPredefinedCMap (_abgcc ){_gfag ._abeac ,_effdc =_fc .LoadPredefinedCMap (_abgcc );if _effdc !=nil {_aa .Log .Debug ("\u0057\u0041\u0052\u004e\u003a\u0020\u0063o\u0075\u006c\u0064 \u006e\u006f\u0074\u0020l\u006f\u0061\u0064\u0020\u0070\u0072\u0065\u0064\u0065\u0066\u0069\u006e\u0065\u0064\u0020\u0043\u004d\u0061\u0070\u0020\u0025\u0073\u003a\u0020\u0025\u0076",_abgcc ,_effdc );
|
||
};}else {_aa .Log .Debug ("\u0055\u006e\u0068\u0061\u006e\u0064\u006c\u0065\u0064\u0020\u0063\u006da\u0070\u0020\u0025\u0071",_abgcc );};};if _aeaad :=_ggda .baseFields ()._agab ;_aeaad !=nil {if _ecfeb :=_aeaad .Name ();_ecfeb =="\u0041d\u006fb\u0065\u002d\u0043\u004e\u0053\u0031\u002d\u0055\u0043\u0053\u0032"||_ecfeb =="\u0041\u0064\u006f\u0062\u0065\u002d\u0047\u0042\u0031-\u0055\u0043\u0053\u0032"||_ecfeb =="\u0041\u0064\u006f\u0062\u0065\u002d\u004a\u0061\u0070\u0061\u006e\u0031-\u0055\u0043\u0053\u0032"||_ecfeb =="\u0041\u0064\u006f\u0062\u0065\u002d\u004b\u006f\u0072\u0065\u0061\u0031-\u0055\u0043\u0053\u0032"{_gfag ._bcacf =_dg .NewCMapEncoder (_abgcc ,_gfag ._abeac ,_aeaad );
|
||
};};return _gfag ,nil ;};
|
||
|
||
// ToPdfObject returns the button field dictionary within an indirect object.
|
||
func (_bdabc *PdfFieldButton )ToPdfObject ()_fg .PdfObject {_bdabc .PdfField .ToPdfObject ();_cecgb :=_bdabc ._daecc ;_aaggf :=_cecgb .PdfObject .(*_fg .PdfObjectDictionary );_aaggf .Set ("\u0046\u0054",_fg .MakeName ("\u0042\u0074\u006e"));if _bdabc .Opt !=nil {_aaggf .Set ("\u004f\u0070\u0074",_bdabc .Opt );
|
||
};return _cecgb ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_gc *PdfActionNamed )ToPdfObject ()_fg .PdfObject {_gc .PdfAction .ToPdfObject ();_adg :=_gc ._bda ;_cfa :=_adg .PdfObject .(*_fg .PdfObjectDictionary );_cfa .SetIfNotNil ("\u0053",_fg .MakeName (string (ActionTypeNamed )));_cfa .SetIfNotNil ("\u004e",_gc .N );
|
||
return _adg ;};func _abfbd (_ffbeg *fontCommon )*pdfFontSimple {return &pdfFontSimple {fontCommon :*_ffbeg }};
|
||
|
||
// PdfTilingPattern is a Tiling pattern that consists of repetitions of a pattern cell with defined intervals.
|
||
// It is a type 1 pattern. (PatternType = 1).
|
||
// A tiling pattern is represented by a stream object, where the stream content is
|
||
// a content stream that describes the pattern cell.
|
||
type PdfTilingPattern struct{*PdfPattern ;PaintType *_fg .PdfObjectInteger ;TilingType *_fg .PdfObjectInteger ;BBox *PdfRectangle ;XStep *_fg .PdfObjectFloat ;YStep *_fg .PdfObjectFloat ;Resources *PdfPageResources ;Matrix *_fg .PdfObjectArray ;};func (_gdbe *PdfAppender )addNewObject (_efga _fg .PdfObject ){if _ ,_dadd :=_gdbe ._aec [_efga ];
|
||
!_dadd {_gdbe ._gcdb =append (_gdbe ._gcdb ,_efga );_gdbe ._aec [_efga ]=struct{}{};};};
|
||
|
||
// SetContext set the sub annotation (context).
|
||
func (_agabg *PdfShading )SetContext (ctx PdfModel ){_agabg ._bcbef =ctx };func (_eaec *LTV )generateVRIKey (_bbcfd *PdfSignature )(string ,error ){_ggbc ,_baccf :=_egbc (_bbcfd .Contents .Bytes ());if _baccf !=nil {return "",_baccf ;};return _dc .ToUpper (_ed .EncodeToString (_ggbc )),nil ;
|
||
};
|
||
|
||
// ToPdfObject returns the PDF representation of the page resources.
|
||
func (_gfgb *PdfPageResources )ToPdfObject ()_fg .PdfObject {_gdgdd :=_gfgb ._cgce ;_gdgdd .SetIfNotNil ("\u0045x\u0074\u0047\u0053\u0074\u0061\u0074e",_gfgb .ExtGState );if _gfgb ._edbg !=nil {_gfgb .ColorSpace =_gfgb ._edbg .ToPdfObject ();};_gdgdd .SetIfNotNil ("\u0043\u006f\u006c\u006f\u0072\u0053\u0070\u0061\u0063\u0065",_gfgb .ColorSpace );
|
||
_gdgdd .SetIfNotNil ("\u0050a\u0074\u0074\u0065\u0072\u006e",_gfgb .Pattern );_gdgdd .SetIfNotNil ("\u0053h\u0061\u0064\u0069\u006e\u0067",_gfgb .Shading );_gdgdd .SetIfNotNil ("\u0058O\u0062\u006a\u0065\u0063\u0074",_gfgb .XObject );_gdgdd .SetIfNotNil ("\u0046\u006f\u006e\u0074",_gfgb .Font );
|
||
_gdgdd .SetIfNotNil ("\u0050r\u006f\u0063\u0053\u0065\u0074",_gfgb .ProcSet );_gdgdd .SetIfNotNil ("\u0050\u0072\u006f\u0070\u0065\u0072\u0074\u0069\u0065\u0073",_gfgb .Properties );return _gdgdd ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_dbb *PdfAnnotationFileAttachment )ToPdfObject ()_fg .PdfObject {_dbb .PdfAnnotation .ToPdfObject ();_faba :=_dbb ._agb ;_ffge :=_faba .PdfObject .(*_fg .PdfObjectDictionary );_dbb .PdfAnnotationMarkup .appendToPdfDictionary (_ffge );_ffge .SetIfNotNil ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u0046\u0069\u006c\u0065\u0041\u0074\u0074\u0061\u0063h\u006d\u0065\u006e\u0074"));
|
||
_ffge .SetIfNotNil ("\u0046\u0053",_dbb .FS );_ffge .SetIfNotNil ("\u004e\u0061\u006d\u0065",_dbb .Name );return _faba ;};
|
||
|
||
// PdfColorPattern represents a pattern color.
|
||
type PdfColorPattern struct{Color PdfColor ;PatternName _fg .PdfObjectName ;};
|
||
|
||
// ToPdfObject returns the PDF representation of the colorspace.
|
||
func (_abbf *PdfColorspaceDeviceGray )ToPdfObject ()_fg .PdfObject {return _fg .MakeName ("\u0044\u0065\u0076\u0069\u0063\u0065\u0047\u0072\u0061\u0079");};func (_eaadc *PdfSignature )extractChainFromPKCS7 ()([]*_ge .Certificate ,error ){_ddccf ,_bgbb :=_ffe .Parse (_eaadc .Contents .Bytes ());
|
||
if _bgbb !=nil {return nil ,_bgbb ;};return _ddccf .Certificates ,nil ;};
|
||
|
||
// PdfTransformParamsDocMDP represents a transform parameters dictionary for the DocMDP method and is used to detect
|
||
// modifications relative to a signature field that is signed by the author of a document.
|
||
// (Section 12.8.2.2, Table 254 - Entries in the DocMDP transform parameters dictionary p. 471 in PDF32000_2008).
|
||
type PdfTransformParamsDocMDP struct{Type *_fg .PdfObjectName ;P *_fg .PdfObjectInteger ;V *_fg .PdfObjectName ;};
|
||
|
||
// PdfPageResources is a Page resources model.
|
||
// Implements PdfModel.
|
||
type PdfPageResources struct{ExtGState _fg .PdfObject ;ColorSpace _fg .PdfObject ;Pattern _fg .PdfObject ;Shading _fg .PdfObject ;XObject _fg .PdfObject ;Font _fg .PdfObject ;ProcSet _fg .PdfObject ;Properties _fg .PdfObject ;_cgce *_fg .PdfObjectDictionary ;
|
||
_edbg *PdfPageResourcesColorspaces ;};
|
||
|
||
// PdfColorspaceSpecialIndexed is an indexed color space is a lookup table, where the input element
|
||
// is an index to the lookup table and the output is a color defined in the lookup table in the Base
|
||
// colorspace.
|
||
// [/Indexed base hival lookup]
|
||
type PdfColorspaceSpecialIndexed struct{Base PdfColorspace ;HiVal int ;Lookup _fg .PdfObject ;_acce []byte ;_gfeg *_fg .PdfIndirectObject ;};
|
||
|
||
// PdfActionGoToE represents a GoToE action.
|
||
type PdfActionGoToE struct{*PdfAction ;F *PdfFilespec ;D _fg .PdfObject ;NewWindow _fg .PdfObject ;T _fg .PdfObject ;};
|
||
|
||
// B returns the value of the B component of the color.
|
||
func (_addf *PdfColorLab )B ()float64 {return _addf [2]};
|
||
|
||
// GetAsShadingPattern returns a shading pattern. Check with IsShading() prior to using this.
|
||
func (_bfdfg *PdfPattern )GetAsShadingPattern ()*PdfShadingPattern {return _bfdfg ._ccdc .(*PdfShadingPattern );};func _cagc (_agedf _fg .PdfObject )(*PdfColorspaceDeviceN ,error ){_gaba :=NewPdfColorspaceDeviceN ();if _ggde ,_bbfa :=_agedf .(*_fg .PdfIndirectObject );
|
||
_bbfa {_gaba ._cggda =_ggde ;};_agedf =_fg .TraceToDirectObject (_agedf );_gdba ,_cdaf :=_agedf .(*_fg .PdfObjectArray );if !_cdaf {return nil ,_d .Errorf ("\u0064\u0065\u0076\u0069\u0063\u0065\u004e\u0020\u0043\u0053\u003a \u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u006f\u0062j\u0065\u0063\u0074");
|
||
};if _gdba .Len ()!=4&&_gdba .Len ()!=5{return nil ,_d .Errorf ("\u0064\u0065\u0076ic\u0065\u004e\u0020\u0043\u0053\u003a\u0020\u0049\u006ec\u006fr\u0072e\u0063t\u0020\u0061\u0072\u0072\u0061\u0079\u0020\u006c\u0065\u006e\u0067\u0074\u0068");};_agedf =_gdba .Get (0);
|
||
_ggdg ,_cdaf :=_agedf .(*_fg .PdfObjectName );if !_cdaf {return nil ,_d .Errorf ("\u0064\u0065\u0076i\u0063\u0065\u004e\u0020C\u0053\u003a\u0020\u0069\u006e\u0076\u0061l\u0069\u0064\u0020\u0066\u0061\u006d\u0069\u006c\u0079\u0020\u006e\u0061\u006d\u0065");
|
||
};if *_ggdg !="\u0044e\u0076\u0069\u0063\u0065\u004e"{return nil ,_d .Errorf ("\u0064\u0065v\u0069\u0063\u0065\u004e\u0020\u0043\u0053\u003a\u0020\u0077\u0072\u006f\u006e\u0067\u0020\u0066\u0061\u006d\u0069\u006c\u0079\u0020na\u006d\u0065");};_agedf =_gdba .Get (1);
|
||
_agedf =_fg .TraceToDirectObject (_agedf );_fdbf ,_cdaf :=_agedf .(*_fg .PdfObjectArray );if !_cdaf {return nil ,_d .Errorf ("\u0064\u0065\u0076i\u0063\u0065\u004e\u0020C\u0053\u003a\u0020\u0049\u006e\u0076\u0061l\u0069\u0064\u0020\u006e\u0061\u006d\u0065\u0073\u0020\u0061\u0072\u0072\u0061\u0079");
|
||
};_gaba .ColorantNames =_fdbf ;_agedf =_gdba .Get (2);_ddbg ,_gbbf :=NewPdfColorspaceFromPdfObject (_agedf );if _gbbf !=nil {return nil ,_gbbf ;};_gaba .AlternateSpace =_ddbg ;_gfefd ,_gbbf :=_defgb (_gdba .Get (3));if _gbbf !=nil {return nil ,_gbbf ;};
|
||
_gaba .TintTransform =_gfefd ;if _gdba .Len ()==5{_defad ,_eeacc :=_daaa (_gdba .Get (4));if _eeacc !=nil {return nil ,_eeacc ;};_gaba .Attributes =_defad ;};return _gaba ,nil ;};
|
||
|
||
// SetDocInfo set document info.
|
||
// This will overwrite any globally declared document info.
|
||
func (_adeag *PdfWriter )SetDocInfo (info *PdfInfo ){_adeag .setDocInfo (info .ToPdfObject ())};
|
||
|
||
// PdfAnnotationSquare represents Square annotations.
|
||
// (Section 12.5.6.8).
|
||
type PdfAnnotationSquare struct{*PdfAnnotation ;*PdfAnnotationMarkup ;BS _fg .PdfObject ;IC _fg .PdfObject ;BE _fg .PdfObject ;RD _fg .PdfObject ;};
|
||
|
||
// DefaultFont returns the default font, which is currently the built in Helvetica.
|
||
func DefaultFont ()*PdfFont {_ccdg ,_agdd :=_eed .NewStdFontByName (HelveticaName );if !_agdd {panic ("\u0048\u0065lv\u0065\u0074\u0069c\u0061\u0020\u0073\u0068oul\u0064 a\u006c\u0077\u0061\u0079\u0073\u0020\u0062e \u0061\u0076\u0061\u0069\u006c\u0061\u0062l\u0065");
|
||
};_gdcca :=_dfebg (_ccdg );return &PdfFont {_gcaeff :&_gdcca };};
|
||
|
||
// ToPdfObject returns the PdfFontDescriptor as a PDF dictionary inside an indirect object.
|
||
func (_bbbec *PdfFontDescriptor )ToPdfObject ()_fg .PdfObject {_gdcdb :=_fg .MakeDict ();if _bbbec ._cgcdc ==nil {_bbbec ._cgcdc =&_fg .PdfIndirectObject {};};_bbbec ._cgcdc .PdfObject =_gdcdb ;_gdcdb .Set ("\u0054\u0079\u0070\u0065",_fg .MakeName ("\u0046\u006f\u006e\u0074\u0044\u0065\u0073\u0063\u0072i\u0070\u0074\u006f\u0072"));
|
||
if _bbbec .FontName !=nil {_gdcdb .Set ("\u0046\u006f\u006e\u0074\u004e\u0061\u006d\u0065",_bbbec .FontName );};if _bbbec .FontFamily !=nil {_gdcdb .Set ("\u0046\u006f\u006e\u0074\u0046\u0061\u006d\u0069\u006c\u0079",_bbbec .FontFamily );};if _bbbec .FontStretch !=nil {_gdcdb .Set ("F\u006f\u006e\u0074\u0053\u0074\u0072\u0065\u0074\u0063\u0068",_bbbec .FontStretch );
|
||
};if _bbbec .FontWeight !=nil {_gdcdb .Set ("\u0046\u006f\u006e\u0074\u0057\u0065\u0069\u0067\u0068\u0074",_bbbec .FontWeight );};if _bbbec .Flags !=nil {_gdcdb .Set ("\u0046\u006c\u0061g\u0073",_bbbec .Flags );};if _bbbec .FontBBox !=nil {_gdcdb .Set ("\u0046\u006f\u006e\u0074\u0042\u0042\u006f\u0078",_bbbec .FontBBox );
|
||
};if _bbbec .ItalicAngle !=nil {_gdcdb .Set ("I\u0074\u0061\u006c\u0069\u0063\u0041\u006e\u0067\u006c\u0065",_bbbec .ItalicAngle );};if _bbbec .Ascent !=nil {_gdcdb .Set ("\u0041\u0073\u0063\u0065\u006e\u0074",_bbbec .Ascent );};if _bbbec .Descent !=nil {_gdcdb .Set ("\u0044e\u0073\u0063\u0065\u006e\u0074",_bbbec .Descent );
|
||
};if _bbbec .Leading !=nil {_gdcdb .Set ("\u004ce\u0061\u0064\u0069\u006e\u0067",_bbbec .Leading );};if _bbbec .CapHeight !=nil {_gdcdb .Set ("\u0043a\u0070\u0048\u0065\u0069\u0067\u0068t",_bbbec .CapHeight );};if _bbbec .XHeight !=nil {_gdcdb .Set ("\u0058H\u0065\u0069\u0067\u0068\u0074",_bbbec .XHeight );
|
||
};if _bbbec .StemV !=nil {_gdcdb .Set ("\u0053\u0074\u0065m\u0056",_bbbec .StemV );};if _bbbec .StemH !=nil {_gdcdb .Set ("\u0053\u0074\u0065m\u0048",_bbbec .StemH );};if _bbbec .AvgWidth !=nil {_gdcdb .Set ("\u0041\u0076\u0067\u0057\u0069\u0064\u0074\u0068",_bbbec .AvgWidth );
|
||
};if _bbbec .MaxWidth !=nil {_gdcdb .Set ("\u004d\u0061\u0078\u0057\u0069\u0064\u0074\u0068",_bbbec .MaxWidth );};if _bbbec .MissingWidth !=nil {_gdcdb .Set ("\u004d\u0069\u0073s\u0069\u006e\u0067\u0057\u0069\u0064\u0074\u0068",_bbbec .MissingWidth );};
|
||
if _bbbec .FontFile !=nil {_gdcdb .Set ("\u0046\u006f\u006e\u0074\u0046\u0069\u006c\u0065",_bbbec .FontFile );};if _bbbec .FontFile2 !=nil {_gdcdb .Set ("\u0046o\u006e\u0074\u0046\u0069\u006c\u00652",_bbbec .FontFile2 );};if _bbbec .FontFile3 !=nil {_gdcdb .Set ("\u0046o\u006e\u0074\u0046\u0069\u006c\u00653",_bbbec .FontFile3 );
|
||
};if _bbbec .CharSet !=nil {_gdcdb .Set ("\u0043h\u0061\u0072\u0053\u0065\u0074",_bbbec .CharSet );};if _bbbec .Style !=nil {_gdcdb .Set ("\u0046\u006f\u006e\u0074\u004e\u0061\u006d\u0065",_bbbec .FontName );};if _bbbec .Lang !=nil {_gdcdb .Set ("\u004c\u0061\u006e\u0067",_bbbec .Lang );
|
||
};if _bbbec .FD !=nil {_gdcdb .Set ("\u0046\u0044",_bbbec .FD );};if _bbbec .CIDSet !=nil {_gdcdb .Set ("\u0043\u0049\u0044\u0053\u0065\u0074",_bbbec .CIDSet );};return _bbbec ._cgcdc ;};
|
||
|
||
// GetContainingPdfObject returns the container of the DSS (indirect object).
|
||
func (_cgecf *DSS )GetContainingPdfObject ()_fg .PdfObject {return _cgecf ._gbaf };
|
||
|
||
// String implements interface PdfObject.
|
||
func (_bgg *PdfAction )String ()string {_de ,_ab :=_bgg .ToPdfObject ().(*_fg .PdfIndirectObject );if _ab {return _d .Sprintf ("\u0025\u0054\u003a\u0020\u0025\u0073",_bgg ._bd ,_de .PdfObject .String ());};return "";};
|
||
|
||
// ColorFromFloats returns a new PdfColor based on the input slice of color
|
||
// components. The slice should contain a single element.
|
||
func (_acef *PdfColorspaceSpecialIndexed )ColorFromFloats (vals []float64 )(PdfColor ,error ){if len (vals )!=1{return nil ,_ce .New ("r\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b");};N :=_acef .Base .GetNumComponents ();_ffde :=int (vals [0])*N ;
|
||
if _ffde < 0||(_ffde +N -1)>=len (_acef ._acce ){_aa .Log .Debug ("\u0063\u006f\u006cor\u0020\u006f\u0075\u0074\u0020\u006f\u0066\u0020\u0043\u0053\u0020\u0072\u0061\u006e\u0067\u0065\u003a\u0020",_ffde );return nil ,ErrColorOutOfRange ;};_bbee :=_acef ._acce [_ffde :_ffde +N ];
|
||
var _debc []float64 ;for _ ,_eaga :=range _bbee {_debc =append (_debc ,float64 (_eaga )/255.0);};_ggbab ,_facga :=_acef .Base .ColorFromFloats (_debc );if _facga !=nil {return nil ,_facga ;};return _ggbab ,nil ;};
|
||
|
||
// GetContainingPdfObject returns the containing object for the PdfField, i.e. an indirect object
|
||
// containing the field dictionary.
|
||
func (_dffb *PdfField )GetContainingPdfObject ()_fg .PdfObject {return _dffb ._daecc };func (_agef *PdfReader )newPdfAnnotationTrapNetFromDict (_aegd *_fg .PdfObjectDictionary )(*PdfAnnotationTrapNet ,error ){_ebbg :=PdfAnnotationTrapNet {};return &_ebbg ,nil ;
|
||
};type modelManager struct{_abga map[PdfModel ]_fg .PdfObject ;_fbbfaf map[_fg .PdfObject ]PdfModel ;};
|
||
|
||
// NewPdfColorspaceSpecialPattern returns a new pattern color.
|
||
func NewPdfColorspaceSpecialPattern ()*PdfColorspaceSpecialPattern {return &PdfColorspaceSpecialPattern {};};
|
||
|
||
// NewPdfSignatureReferenceDocMDP returns PdfSignatureReference for the transformParams.
|
||
func NewPdfSignatureReferenceDocMDP (transformParams *PdfTransformParamsDocMDP )*PdfSignatureReference {return &PdfSignatureReference {Type :_fg .MakeName ("\u0053\u0069\u0067\u0052\u0065\u0066"),TransformMethod :_fg .MakeName ("\u0044\u006f\u0063\u004d\u0044\u0050"),TransformParams :transformParams .ToPdfObject ()};
|
||
};
|
||
|
||
// NewPdfColorDeviceRGB returns a new PdfColorDeviceRGB based on the r,g,b component values.
|
||
func NewPdfColorDeviceRGB (r ,g ,b float64 )*PdfColorDeviceRGB {_bgef :=PdfColorDeviceRGB {r ,g ,b };return &_bgef ;};
|
||
|
||
// FieldFlag represents form field flags. Some of the flags can apply to all types of fields whereas other
|
||
// flags are specific.
|
||
type FieldFlag uint32 ;func (_bce *PdfReader )newPdfAnnotationStrikeOut (_cbg *_fg .PdfObjectDictionary )(*PdfAnnotationStrikeOut ,error ){_cacd :=PdfAnnotationStrikeOut {};_fef ,_faea :=_bce .newPdfAnnotationMarkupFromDict (_cbg );if _faea !=nil {return nil ,_faea ;
|
||
};_cacd .PdfAnnotationMarkup =_fef ;_cacd .QuadPoints =_cbg .Get ("\u0051\u0075\u0061\u0064\u0050\u006f\u0069\u006e\u0074\u0073");return &_cacd ,nil ;};
|
||
|
||
// PdfAnnotationScreen represents Screen annotations.
|
||
// (Section 12.5.6.18).
|
||
type PdfAnnotationScreen struct{*PdfAnnotation ;T _fg .PdfObject ;MK _fg .PdfObject ;A _fg .PdfObject ;AA _fg .PdfObject ;};
|
||
|
||
// NewPdfAnnotationCaret returns a new caret annotation.
|
||
func NewPdfAnnotationCaret ()*PdfAnnotationCaret {_acdg :=NewPdfAnnotation ();_beac :=&PdfAnnotationCaret {};_beac .PdfAnnotation =_acdg ;_beac .PdfAnnotationMarkup =&PdfAnnotationMarkup {};_acdg .SetContext (_beac );return _beac ;};func (_fgee *pdfFontType0 )subsetRegistered ()error {_ddff ,_bbgf :=_fgee .DescendantFont ._gcaeff .(*pdfCIDFontType2 );
|
||
if !_bbgf {_aa .Log .Debug ("\u0046\u006fnt\u0020\u006e\u006ft\u0020\u0073\u0075\u0070por\u0074ed\u0020\u0066\u006f\u0072\u0020\u0073\u0075bs\u0065\u0074\u0074\u0069\u006e\u0067\u0020%\u0054",_fgee .DescendantFont );return nil ;};if _ddff ==nil {return nil ;
|
||
};if _ddff ._cdgef ==nil {_aa .Log .Debug ("\u004d\u0069\u0073si\u006e\u0067\u0020\u0066\u006f\u006e\u0074\u0020\u0064\u0065\u0073\u0063\u0072\u0069\u0070\u0074\u006f\u0072");return nil ;};if _fgee ._bcacf ==nil {_aa .Log .Debug ("\u004e\u006f\u0020e\u006e\u0063\u006f\u0064e\u0072\u0020\u002d\u0020\u0073\u0075\u0062s\u0065\u0074\u0074\u0069\u006e\u0067\u0020\u0069\u0067\u006e\u006f\u0072\u0065\u0064");
|
||
return nil ;};_becd ,_bbgf :=_fg .GetStream (_ddff ._cdgef .FontFile2 );if !_bbgf {_aa .Log .Debug ("\u0045\u006d\u0062\u0065\u0064\u0064\u0065\u0064\u0020\u0066\u006f\u006e\u0074\u0020\u006f\u0062\u006a\u0065c\u0074\u0020\u006e\u006f\u0074\u0020\u0066o\u0075\u006e\u0064\u0020\u002d\u002d\u0020\u0041\u0042\u004f\u0052T\u0020\u0073\u0075\u0062\u0073\u0065\u0074\u0074\u0069\u006e\u0067");
|
||
return _ce .New ("\u0066\u006f\u006e\u0074fi\u006c\u0065\u0032\u0020\u006e\u006f\u0074\u0020\u0066\u006f\u0075\u006e\u0064");};_gcafc ,_ccecc :=_fg .DecodeStream (_becd );if _ccecc !=nil {_aa .Log .Debug ("\u0044\u0065c\u006f\u0064\u0065 \u0065\u0072\u0072\u006f\u0072\u003a\u0020\u0025\u0076",_ccecc );
|
||
return _ccecc ;};_bace ,_ccecc :=_eee .Parse (_cb .NewReader (_gcafc ));if _ccecc !=nil {_aa .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0070\u0061\u0072\u0073\u0069n\u0067\u0020\u0025\u0064\u0020\u0062\u0079\u0074\u0065\u0020f\u006f\u006e\u0074",len (_becd .Stream ));
|
||
return _ccecc ;};var _edadc []rune ;var _ffebe *_eee .Font ;switch _dadde :=_fgee ._bcacf .(type ){case *_dg .TrueTypeFontEncoder :_edadc =_dadde .RegisteredRunes ();_ffebe ,_ccecc =_bace .SubsetKeepRunes (_edadc );if _ccecc !=nil {_aa .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_ccecc );
|
||
return _ccecc ;};_dadde .SubsetRegistered ();case *_dg .IdentityEncoder :_edadc =_dadde .RegisteredRunes ();_fgaf :=make ([]_eee .GlyphIndex ,len (_edadc ));for _gced ,_fdcfgb :=range _edadc {_fgaf [_gced ]=_eee .GlyphIndex (_fdcfgb );};_ffebe ,_ccecc =_bace .SubsetKeepIndices (_fgaf );
|
||
if _ccecc !=nil {_aa .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_ccecc );return _ccecc ;};case _dg .SimpleEncoder :_bffb :=_dadde .Charcodes ();for _ ,_gaccb :=range _bffb {_acbc ,_dbgdg :=_dadde .CharcodeToRune (_gaccb );if !_dbgdg {_aa .Log .Debug ("\u0045\u0052\u0052O\u0052\u003a\u0020\u0075\u006e\u0061\u0062\u006c\u0065\u0020\u0063\u006f\u006e\u0076\u0065\u0072\u0074\u0020\u0063\u0068\u0061\u0072\u0063\u006f\u0064\u0065\u0020\u0074\u006f \u0072\u0075\u006e\u0065\u003a\u0020\u0025\u0064",_gaccb );
|
||
continue ;};_edadc =append (_edadc ,_acbc );};default:return _d .Errorf ("\u0075\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u0020\u0065\u006e\u0063\u006f\u0064\u0065\u0072\u0020\u0066\u006f\u0072\u0020s\u0075\u0062\u0073\u0065\u0074t\u0069\u006eg\u003a\u0020\u0025\u0054",_fgee ._bcacf );
|
||
};var _ggdcd _cb .Buffer ;_ccecc =_ffebe .Write (&_ggdcd );if _ccecc !=nil {_aa .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_ccecc );return _ccecc ;};if _fgee ._agab !=nil {_ceeg :=make (map[_fc .CharCode ]rune ,len (_edadc ));for _ ,_bbbef :=range _edadc {_afef ,_cfeg :=_fgee ._bcacf .RuneToCharcode (_bbbef );
|
||
if !_cfeg {continue ;};_ceeg [_fc .CharCode (_afef )]=_bbbef ;};_fgee ._agab =_fc .NewToUnicodeCMap (_ceeg );};_becd ,_ccecc =_fg .MakeStream (_ggdcd .Bytes (),_fg .NewFlateEncoder ());if _ccecc !=nil {_aa .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_ccecc );
|
||
return _ccecc ;};_becd .Set ("\u004ce\u006e\u0067\u0074\u0068\u0031",_fg .MakeInteger (int64 (_ggdcd .Len ())));if _abaad ,_gcde :=_fg .GetStream (_ddff ._cdgef .FontFile2 );_gcde {*_abaad =*_becd ;}else {_ddff ._cdgef .FontFile2 =_becd ;};_ebfgg :=_agae ();
|
||
if len (_fgee ._aefg )> 0{_fgee ._aefg =_gcccf (_fgee ._aefg ,_ebfgg );};if len (_ddff ._aefg )> 0{_ddff ._aefg =_gcccf (_ddff ._aefg ,_ebfgg );};if len (_fgee ._edad )> 0{_fgee ._edad =_gcccf (_fgee ._edad ,_ebfgg );};if _ddff ._cdgef !=nil {_dcddb ,_aegba :=_fg .GetName (_ddff ._cdgef .FontName );
|
||
if _aegba &&len (_dcddb .String ())> 0{_cdbb :=_gcccf (_dcddb .String (),_ebfgg );_ddff ._cdgef .FontName =_fg .MakeName (_cdbb );};};return nil ;};
|
||
|
||
// ToPdfObject returns the PDF representation of the function.
|
||
func (_ccdac *PdfFunctionType2 )ToPdfObject ()_fg .PdfObject {_bcdcg :=_fg .MakeDict ();_bcdcg .Set ("\u0046\u0075\u006ec\u0074\u0069\u006f\u006e\u0054\u0079\u0070\u0065",_fg .MakeInteger (2));_feafe :=&_fg .PdfObjectArray {};for _ ,_adedg :=range _ccdac .Domain {_feafe .Append (_fg .MakeFloat (_adedg ));
|
||
};_bcdcg .Set ("\u0044\u006f\u006d\u0061\u0069\u006e",_feafe );if _ccdac .Range !=nil {_ecece :=&_fg .PdfObjectArray {};for _ ,_fedba :=range _ccdac .Range {_ecece .Append (_fg .MakeFloat (_fedba ));};_bcdcg .Set ("\u0052\u0061\u006eg\u0065",_ecece );};
|
||
if _ccdac .C0 !=nil {_cedee :=&_fg .PdfObjectArray {};for _ ,_aeafa :=range _ccdac .C0 {_cedee .Append (_fg .MakeFloat (_aeafa ));};_bcdcg .Set ("\u0043\u0030",_cedee );};if _ccdac .C1 !=nil {_fgadd :=&_fg .PdfObjectArray {};for _ ,_gcad :=range _ccdac .C1 {_fgadd .Append (_fg .MakeFloat (_gcad ));
|
||
};_bcdcg .Set ("\u0043\u0031",_fgadd );};_bcdcg .Set ("\u004e",_fg .MakeFloat (_ccdac .N ));if _ccdac ._aceef !=nil {_ccdac ._aceef .PdfObject =_bcdcg ;return _ccdac ._aceef ;};return _bcdcg ;};
|
||
|
||
// ToPdfObject returns the PDF representation of the function.
|
||
func (_gccfb *PdfFunctionType4 )ToPdfObject ()_fg .PdfObject {_bebeb :=_gccfb ._dega ;if _bebeb ==nil {_gccfb ._dega =&_fg .PdfObjectStream {};_bebeb =_gccfb ._dega ;};_ebedg :=_fg .MakeDict ();_ebedg .Set ("\u0046\u0075\u006ec\u0074\u0069\u006f\u006e\u0054\u0079\u0070\u0065",_fg .MakeInteger (4));
|
||
_fgfbd :=&_fg .PdfObjectArray {};for _ ,_cfedd :=range _gccfb .Domain {_fgfbd .Append (_fg .MakeFloat (_cfedd ));};_ebedg .Set ("\u0044\u006f\u006d\u0061\u0069\u006e",_fgfbd );_gaegf :=&_fg .PdfObjectArray {};for _ ,_cgaeg :=range _gccfb .Range {_gaegf .Append (_fg .MakeFloat (_cgaeg ));
|
||
};_ebedg .Set ("\u0052\u0061\u006eg\u0065",_gaegf );if _gccfb ._dedbd ==nil &&_gccfb .Program !=nil {_gccfb ._dedbd =[]byte (_gccfb .Program .String ());};_ebedg .Set ("\u004c\u0065\u006e\u0067\u0074\u0068",_fg .MakeInteger (int64 (len (_gccfb ._dedbd ))));
|
||
_bebeb .Stream =_gccfb ._dedbd ;_bebeb .PdfObjectDictionary =_ebedg ;return _bebeb ;};
|
||
|
||
// HasFontByName checks if has font resource by name.
|
||
func (_faaa *PdfPage )HasFontByName (name _fg .PdfObjectName )bool {_fdgb ,_egcad :=_faaa .Resources .Font .(*_fg .PdfObjectDictionary );if !_egcad {return false ;};if _ffca :=_fdgb .Get (name );_ffca !=nil {return true ;};return false ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_dcegc *PdfAnnotationStamp )ToPdfObject ()_fg .PdfObject {_dcegc .PdfAnnotation .ToPdfObject ();_abff :=_dcegc ._agb ;_aade :=_abff .PdfObject .(*_fg .PdfObjectDictionary );_dcegc .PdfAnnotationMarkup .appendToPdfDictionary (_aade );_aade .SetIfNotNil ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u0053\u0074\u0061m\u0070"));
|
||
_aade .SetIfNotNil ("\u004e\u0061\u006d\u0065",_dcegc .Name );return _abff ;};func (_dfgg *PdfWriter )adjustXRefAffectedVersion (_eacgf bool ){if _eacgf &&_dfgg ._fbbec .Major ==1&&_dfgg ._fbbec .Minor < 5{_dfgg ._fbbec .Minor =5;};};func _agddd (_ggefc string )map[string ]string {_gfcc :=_cdaa .Split (_ggefc ,-1);
|
||
_febf :=map[string ]string {};for _ ,_beceg :=range _gfcc {_cgdea :=_fbegb .FindStringSubmatch (_beceg );if _cgdea ==nil {continue ;};_effag ,_gdafb :=_cgdea [1],_cgdea [2];_febf [_effag ]=_gdafb ;};return _febf ;};
|
||
|
||
// NewPdfTransformParamsDocMDP create a PdfTransformParamsDocMDP with the specific permissions.
|
||
func NewPdfTransformParamsDocMDP (permission _gbb .DocMDPPermission )*PdfTransformParamsDocMDP {return &PdfTransformParamsDocMDP {Type :_fg .MakeName ("\u0054r\u0061n\u0073\u0066\u006f\u0072\u006d\u0050\u0061\u0072\u0061\u006d\u0073"),P :_fg .MakeInteger (int64 (permission )),V :_fg .MakeName ("\u0031\u002e\u0032")};
|
||
};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_gffd *PdfAnnotationRedact )ToPdfObject ()_fg .PdfObject {_gffd .PdfAnnotation .ToPdfObject ();_dcfe :=_gffd ._agb ;_dad :=_dcfe .PdfObject .(*_fg .PdfObjectDictionary );_gffd .PdfAnnotationMarkup .appendToPdfDictionary (_dad );_dad .SetIfNotNil ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u0052\u0065\u0064\u0061\u0063\u0074"));
|
||
_dad .SetIfNotNil ("\u0051\u0075\u0061\u0064\u0050\u006f\u0069\u006e\u0074\u0073",_gffd .QuadPoints );_dad .SetIfNotNil ("\u0049\u0043",_gffd .IC );_dad .SetIfNotNil ("\u0052\u004f",_gffd .RO );_dad .SetIfNotNil ("O\u0076\u0065\u0072\u006c\u0061\u0079\u0054\u0065\u0078\u0074",_gffd .OverlayText );
|
||
_dad .SetIfNotNil ("\u0052\u0065\u0070\u0065\u0061\u0074",_gffd .Repeat );_dad .SetIfNotNil ("\u0044\u0041",_gffd .DA );_dad .SetIfNotNil ("\u0051",_gffd .Q );return _dcfe ;};
|
||
|
||
// NewPdfReaderWithOpts creates a new PdfReader for an input io.ReadSeeker interface
|
||
// with a ReaderOpts.
|
||
// If ReaderOpts is nil it will be set to default value from NewReaderOpts.
|
||
func NewPdfReaderWithOpts (rs _ff .ReadSeeker ,opts *ReaderOpts )(*PdfReader ,error ){const _cdacf ="\u006d\u006f\u0064\u0065\u006c\u003a\u004e\u0065\u0077\u0050\u0064f\u0052\u0065\u0061\u0064\u0065\u0072\u0057\u0069\u0074\u0068O\u0070\u0074\u0073";return _bgdaf (rs ,opts ,true ,_cdacf );
|
||
};
|
||
|
||
// NewPdfAppenderWithOpts creates a new Pdf appender from a Pdf reader with options.
|
||
func NewPdfAppenderWithOpts (reader *PdfReader ,opts *ReaderOpts ,encryptOptions *EncryptOptions )(*PdfAppender ,error ){_eagd :=&PdfAppender {_ebd :reader ._daega ,Reader :reader ,_bbef :reader ._ccgg ,_fcca :reader ._aefbbf };_fgagb ,_fcf :=_eagd ._ebd .Seek (0,_ff .SeekEnd );
|
||
if _fcf !=nil {return nil ,_fcf ;};_eagd ._ggcf =_fgagb ;if _ ,_fcf =_eagd ._ebd .Seek (0,_ff .SeekStart );_fcf !=nil {return nil ,_fcf ;};_eagd ._cbb ,_fcf =NewPdfReaderWithOpts (_eagd ._ebd ,opts );if _fcf !=nil {return nil ,_fcf ;};for _ ,_egdb :=range _eagd .Reader .GetObjectNums (){if _eagd ._egcab < _egdb {_eagd ._egcab =_egdb ;
|
||
};};_eagd ._gaeb =_eagd ._bbef .GetXrefTable ();_eagd ._dff =_eagd ._bbef .GetXrefOffset ();_eagd ._agbg =append (_eagd ._agbg ,_eagd ._cbb .PageList ...);_eagd ._aec =make (map[_fg .PdfObject ]struct{});_eagd ._dcbad =make (map[_fg .PdfObject ]int64 );
|
||
_eagd ._fgb =make (map[_fg .PdfObject ]struct{});_eagd ._cacc =_eagd ._cbb .AcroForm ;_eagd ._dgbf =_eagd ._cbb .DSS ;if opts !=nil {_eagd ._gccg =opts .Password ;};if encryptOptions !=nil {_eagd ._ggb =encryptOptions ;};return _eagd ,nil ;};
|
||
|
||
// NewPdfColorspaceCalGray returns a new CalGray colorspace object.
|
||
func NewPdfColorspaceCalGray ()*PdfColorspaceCalGray {_agag :=&PdfColorspaceCalGray {};_agag .BlackPoint =[]float64 {0.0,0.0,0.0};_agag .Gamma =1;return _agag ;};
|
||
|
||
// PdfAnnotationCaret represents Caret annotations.
|
||
// (Section 12.5.6.11).
|
||
type PdfAnnotationCaret struct{*PdfAnnotation ;*PdfAnnotationMarkup ;RD _fg .PdfObject ;Sy _fg .PdfObject ;};
|
||
|
||
// IsRadio returns true if the button field represents a radio button, false otherwise.
|
||
func (_dcdae *PdfFieldButton )IsRadio ()bool {return _dcdae .GetType ()==ButtonTypeRadio };const (BorderEffectNoEffect BorderEffect =iota ;BorderEffectCloudy BorderEffect =iota ;);
|
||
|
||
// SetImage updates XObject Image with new image data.
|
||
func (_agefb *XObjectImage )SetImage (img *Image ,cs PdfColorspace )error {_agefb .Filter .UpdateParams (img .GetParamsDict ());_cdgdg ,_fgbdg :=_agefb .Filter .EncodeBytes (img .Data );if _fgbdg !=nil {return _fgbdg ;};_agefb .Stream =_cdgdg ;_gcfcf :=img .Width ;
|
||
_agefb .Width =&_gcfcf ;_gfdcdc :=img .Height ;_agefb .Height =&_gfdcdc ;_eadfa :=img .BitsPerComponent ;_agefb .BitsPerComponent =&_eadfa ;if cs ==nil {if img .ColorComponents ==1{_agefb .ColorSpace =NewPdfColorspaceDeviceGray ();}else if img .ColorComponents ==3{_agefb .ColorSpace =NewPdfColorspaceDeviceRGB ();
|
||
}else if img .ColorComponents ==4{_agefb .ColorSpace =NewPdfColorspaceDeviceCMYK ();}else {return _ce .New ("c\u006fl\u006f\u0072\u0073\u0070\u0061\u0063\u0065\u0020u\u006e\u0064\u0065\u0066in\u0065\u0064");};}else {_agefb .ColorSpace =cs ;};return nil ;
|
||
};
|
||
|
||
// VRI represents a Validation-Related Information dictionary.
|
||
// The VRI dictionary contains validation data in the form of
|
||
// certificates, OCSP and CRL information, for a single signature.
|
||
// See ETSI TS 102 778-4 V1.1.1 for more information.
|
||
type VRI struct{Cert []*_fg .PdfObjectStream ;OCSP []*_fg .PdfObjectStream ;CRL []*_fg .PdfObjectStream ;TU *_fg .PdfObjectString ;TS *_fg .PdfObjectString ;};func (_aeca *PdfReader )flattenFieldsWithOpts (_fcag bool ,_feeeg FieldAppearanceGenerator ,_bbca *FieldFlattenOpts )error {if _bbca ==nil {_bbca =&FieldFlattenOpts {};
|
||
};var _acde bool ;_acbg :=map[*PdfAnnotation ]bool {};{var _acee []*PdfField ;_ggad :=_aeca .AcroForm ;if _ggad !=nil {if _bbca .FilterFunc !=nil {_acee =_ggad .filteredFields (_bbca .FilterFunc ,true );_acde =_ggad .Fields !=nil &&len (*_ggad .Fields )> 0;
|
||
}else {_acee =_ggad .AllFields ();};};for _ ,_dedfc :=range _acee {for _ ,_addfe :=range _dedfc .Annotations {_acbg [_addfe .PdfAnnotation ]=_dedfc .V !=nil ;if _feeeg !=nil {_bfgdf ,_cggdeg :=_feeeg .GenerateAppearanceDict (_ggad ,_dedfc ,_addfe );if _cggdeg !=nil {return _cggdeg ;
|
||
};_addfe .AP =_bfgdf ;};};};};if _fcag {for _ ,_adbd :=range _aeca .PageList {_aeag ,_adbe :=_adbd .GetAnnotations ();if _adbe !=nil {return _adbe ;};for _ ,_gabdg :=range _aeag {_acbg [_gabdg ]=true ;};};};for _ ,_geag :=range _aeca .PageList {var _cgaeb []*PdfAnnotation ;
|
||
if _feeeg !=nil {if _bgae :=_feeeg .WrapContentStream (_geag );_bgae !=nil {return _bgae ;};};_aaab ,_aeaa :=_geag .GetAnnotations ();if _aeaa !=nil {return _aeaa ;};for _ ,_dadc :=range _aaab {_afbd ,_cfada :=_acbg [_dadc ];if !_cfada &&_bbca .AnnotFilterFunc !=nil {if _ ,_cbcae :=_dadc .GetContext ().(*PdfAnnotationWidget );
|
||
!_cbcae {_cfada =_bbca .AnnotFilterFunc (_dadc );};};if !_cfada {_cgaeb =append (_cgaeb ,_dadc );continue ;};switch _dadc .GetContext ().(type ){case *PdfAnnotationPopup :continue ;case *PdfAnnotationLink :continue ;case *PdfAnnotationProjection :continue ;
|
||
};_cddc ,_fdga ,_adaa :=_gceb (_dadc );if _adaa !=nil {if !_afbd {_aa .Log .Trace ("\u0046\u0069\u0065\u006c\u0064\u0020\u0077\u0069\u0074h\u006f\u0075\u0074\u0020\u0056\u0020\u002d\u003e\u0020\u0061\u006e\u006e\u006f\u0074\u0061\u0074\u0069\u006f\u006e\u0020\u0077\u0069\u0074h\u006f\u0075t\u0020\u0061p\u0070\u0065\u0061\u0072\u0061\u006e\u0063\u0065\u0020\u0073\u0074\u0072\u0065am\u0020\u002d\u0020\u0073\u006b\u0069\u0070\u0070\u0069n\u0067\u0020\u006f\u0076\u0065\u0072");
|
||
continue ;};_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u0020\u0041\u006e\u006e\u006f\u0074\u0061\u0074\u0069\u006f\u006e\u0020\u0077\u0069\u0074h\u006f\u0075\u0074\u0020\u0061\u0070\u0070\u0065\u0061\u0072\u0061\u006e\u0063\u0065\u0020\u0073\u0074\u0072\u0065\u0061\u006d,\u0020\u0065\u0072\u0072\u0020\u003a\u0020\u0025\u0076\u0020\u002d\u0020\u0073\u006bi\u0070\u0070\u0069n\u0067\u0020\u006f\u0076\u0065\u0072",_adaa );
|
||
continue ;};if _cddc ==nil {continue ;};_dfeeg :=_geag .Resources .GenerateXObjectName ();_geag .Resources .SetXObjectFormByName (_dfeeg ,_cddc );_fdfd ,_adaa :=_fcagf (_cddc );if _adaa !=nil {_aa .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065\u0072\u0074\u0069\u006e\u0067\u0020\u0061\u0070p\u0065\u0061\u0072\u0061\u006e\u0063\u0065\u0020\u004d\u0061\u0074\u0072\u0069\u0078\u002c\u0020s\u006b\u0069\u0070\u0070\u0069\u006e\u0067\u0020\u0078\u0066\u006f\u0072\u006d\u0020\u0062\u0062\u006f\u0078\u0020\u0061\u0064\u006a\u0075\u0073t\u006d\u0065\u006e\u0074\u003a \u0025\u0076",_adaa );
|
||
}else {_aega :=_gbe .IdentityMatrix ();_aega =_aega .Translate (-_fdfd .Llx ,-_fdfd .Lly );_cfbfa :=0.0;if _fdfd .Width ()> 0{_cfbfa =_fdga .Width ()/_fdfd .Width ();};_ceda :=0.0;if _fdfd .Height ()> 0{_ceda =_fdga .Height ()/_fdfd .Height ();};_aega =_aega .Scale (_cfbfa ,_ceda );
|
||
_fdga .Transform (_aega );};_dfebe :=_ef .Min (_fdga .Llx ,_fdga .Urx );_dgeb :=_ef .Min (_fdga .Lly ,_fdga .Ury );var _fdfce []string ;_fdfce =append (_fdfce ,"\u0071");_fdfce =append (_fdfce ,_d .Sprintf ("\u0025\u002e\u0036\u0066\u0020\u0025\u002e\u0036\u0066\u0020\u0025\u002e\u0036\u0066\u0020%\u002e6\u0066\u0020\u0025\u002e\u0036\u0066\u0020\u0025\u002e\u0036\u0066\u0020\u0063\u006d",1.0,0.0,0.0,1.0,_dfebe ,_dgeb ));
|
||
_fdfce =append (_fdfce ,_d .Sprintf ("\u002f\u0025\u0073\u0020\u0044\u006f",_dfeeg .String ()));_fdfce =append (_fdfce ,"\u0051");_aagf :=_dc .Join (_fdfce ,"\u000a");_adaa =_geag .AppendContentStream (_aagf );if _adaa !=nil {return _adaa ;};if _cddc .Resources !=nil {_fgcfc ,_ffee :=_fg .GetDict (_cddc .Resources .Font );
|
||
if _ffee {for _ ,_fccad :=range _fgcfc .Keys (){if !_geag .Resources .HasFontByName (_fccad ){_geag .Resources .SetFontByName (_fccad ,_fgcfc .Get (_fccad ));};};};};};if len (_cgaeb )> 0{_geag ._fbbb =_cgaeb ;}else {_geag ._fbbb =[]*PdfAnnotation {};};
|
||
};if !_acde {_aeca .AcroForm =nil ;};return nil ;};
|
||
|
||
// NewPdfWriter initializes a new PdfWriter.
|
||
func NewPdfWriter ()PdfWriter {_dcgeb :=PdfWriter {};_dcgeb ._gcbec =map[_fg .PdfObject ]struct{}{};_dcgeb ._bbfd =[]_fg .PdfObject {};_dcgeb ._gcafd =map[_fg .PdfObject ][]*_fg .PdfObjectDictionary {};_dcgeb ._acccfc =map[_fg .PdfObject ]struct{}{};_dcgeb ._fbbec .Major =1;
|
||
_dcgeb ._fbbec .Minor =3;_eddg :=_fg .MakeDict ();_cefb :=[]struct{_abdafe _fg .PdfObjectName ;_cgefa string ;}{{"\u0050\u0072\u006f\u0064\u0075\u0063\u0065\u0072",_dadagc ()},{"\u0043r\u0065\u0061\u0074\u006f\u0072",_eagac ()},{"\u0041\u0075\u0074\u0068\u006f\u0072",_afggf ()},{"\u0053u\u0062\u006a\u0065\u0063\u0074",_adggf ()},{"\u0054\u0069\u0074l\u0065",_bdfge ()},{"\u004b\u0065\u0079\u0077\u006f\u0072\u0064\u0073",_abbbg ()}};
|
||
for _ ,_fadb :=range _cefb {if _fadb ._cgefa !=""{_eddg .Set (_fadb ._abdafe ,_fg .MakeString (_fadb ._cgefa ));};};if _gcffg :=_eafef ();!_gcffg .IsZero (){if _abcac ,_cfddd :=NewPdfDateFromTime (_gcffg );_cfddd ==nil {_eddg .Set ("\u0043\u0072\u0065a\u0074\u0069\u006f\u006e\u0044\u0061\u0074\u0065",_abcac .ToPdfObject ());
|
||
};};if _deaa :=_fbdc ();!_deaa .IsZero (){if _begcb ,_acgagb :=NewPdfDateFromTime (_deaa );_acgagb ==nil {_eddg .Set ("\u004do\u0064\u0044\u0061\u0074\u0065",_begcb .ToPdfObject ());};};_bdbee :=_fg .PdfIndirectObject {};_bdbee .PdfObject =_eddg ;_dcgeb ._deabg =&_bdbee ;
|
||
_dcgeb .addObject (&_bdbee );_gabf :=_fg .PdfIndirectObject {};_cafcec :=_fg .MakeDict ();_cafcec .Set ("\u0054\u0079\u0070\u0065",_fg .MakeName ("\u0043a\u0074\u0061\u006c\u006f\u0067"));_gabf .PdfObject =_cafcec ;_dcgeb ._cegde =&_gabf ;_dcgeb .addObject (_dcgeb ._cegde );
|
||
_fedgg ,_bdebe :=_gfacd ("\u0077");if _bdebe !=nil {_aa .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_bdebe );};_dcgeb ._dbefbd =_fedgg ;_fgadeg :=_fg .PdfIndirectObject {};_fdfeg :=_fg .MakeDict ();_fdfeg .Set ("\u0054\u0079\u0070\u0065",_fg .MakeName ("\u0050\u0061\u0067e\u0073"));
|
||
_cdedd :=_fg .PdfObjectArray {};_fdfeg .Set ("\u004b\u0069\u0064\u0073",&_cdedd );_fdfeg .Set ("\u0043\u006f\u0075n\u0074",_fg .MakeInteger (0));_fgadeg .PdfObject =_fdfeg ;_dcgeb ._feccd =&_fgadeg ;_dcgeb ._cbdbf =map[_fg .PdfObject ]struct{}{};_dcgeb .addObject (_dcgeb ._feccd );
|
||
_cafcec .Set ("\u0050\u0061\u0067e\u0073",&_fgadeg );_dcgeb ._cgacf =_cafcec ;_aa .Log .Trace ("\u0043\u0061\u0074\u0061\u006c\u006f\u0067\u0020\u0025\u0073",_gabf );return _dcgeb ;};func (_bbeg *pdfCIDFontType0 )baseFields ()*fontCommon {return &_bbeg .fontCommon };
|
||
|
||
|
||
// NewPdfAnnotationSquare returns a new square annotation.
|
||
func NewPdfAnnotationSquare ()*PdfAnnotationSquare {_ggf :=NewPdfAnnotation ();_bbgd :=&PdfAnnotationSquare {};_bbgd .PdfAnnotation =_ggf ;_bbgd .PdfAnnotationMarkup =&PdfAnnotationMarkup {};_ggf .SetContext (_bbgd );return _bbgd ;};
|
||
|
||
// GetContainingPdfObject implements model.PdfModel interface.
|
||
func (_eedg *PdfOutputIntent )GetContainingPdfObject ()_fg .PdfObject {return _eedg ._geaa };
|
||
|
||
// NewPdfAppender creates a new Pdf appender from a Pdf reader.
|
||
func NewPdfAppender (reader *PdfReader )(*PdfAppender ,error ){_fdge :=&PdfAppender {_ebd :reader ._daega ,Reader :reader ,_bbef :reader ._ccgg ,_fcca :reader ._aefbbf };_abcb ,_cead :=_fdge ._ebd .Seek (0,_ff .SeekEnd );if _cead !=nil {return nil ,_cead ;
|
||
};_fdge ._ggcf =_abcb ;if _ ,_cead =_fdge ._ebd .Seek (0,_ff .SeekStart );_cead !=nil {return nil ,_cead ;};_fdge ._cbb ,_cead =NewPdfReader (_fdge ._ebd );if _cead !=nil {return nil ,_cead ;};for _ ,_dfee :=range _fdge .Reader .GetObjectNums (){if _fdge ._egcab < _dfee {_fdge ._egcab =_dfee ;
|
||
};};_fdge ._gaeb =_fdge ._bbef .GetXrefTable ();_fdge ._dff =_fdge ._bbef .GetXrefOffset ();_fdge ._agbg =append (_fdge ._agbg ,_fdge ._cbb .PageList ...);_fdge ._aec =make (map[_fg .PdfObject ]struct{});_fdge ._dcbad =make (map[_fg .PdfObject ]int64 );
|
||
_fdge ._fgb =make (map[_fg .PdfObject ]struct{});_fdge ._cacc =_fdge ._cbb .AcroForm ;_fdge ._dgbf =_fdge ._cbb .DSS ;return _fdge ,nil ;};
|
||
|
||
// DecodeArray returns the range of color component values in DeviceRGB colorspace.
|
||
func (_bcbaf *PdfColorspaceDeviceRGB )DecodeArray ()[]float64 {return []float64 {0.0,1.0,0.0,1.0,0.0,1.0};};
|
||
|
||
// GetNumComponents returns the number of color components of the underlying
|
||
// colorspace device.
|
||
func (_edcf *PdfColorspaceSpecialPattern )GetNumComponents ()int {return _edcf .UnderlyingCS .GetNumComponents ();};
|
||
|
||
// GetContainingPdfObject returns the container of the shading object (indirect object).
|
||
func (_eaffc *PdfShading )GetContainingPdfObject ()_fg .PdfObject {return _eaffc ._cbabf };func _fffd (_accf map[_eed .GID ]int ,_edfegc uint16 )*_fg .PdfObjectArray {_eadfdb :=&_fg .PdfObjectArray {};_aeafc :=_eed .GID (_edfegc );for _bbfeb :=_eed .GID (0);
|
||
_bbfeb < _aeafc ;{_abca ,_afdfg :=_accf [_bbfeb ];if !_afdfg {_bbfeb ++;continue ;};_dbbg :=_bbfeb ;for _ffbec :=_dbbg +1;_ffbec < _aeafc ;_ffbec ++{if _eeafe ,_afec :=_accf [_ffbec ];!_afec ||_abca !=_eeafe {break ;};_dbbg =_ffbec ;};_eadfdb .Append (_fg .MakeInteger (int64 (_bbfeb )));
|
||
_eadfdb .Append (_fg .MakeInteger (int64 (_dbbg )));_eadfdb .Append (_fg .MakeInteger (int64 (_abca )));_bbfeb =_dbbg +1;};return _eadfdb ;};
|
||
|
||
// PdfShadingType5 is a Lattice-form Gouraud-shaded triangle mesh.
|
||
type PdfShadingType5 struct{*PdfShading ;BitsPerCoordinate *_fg .PdfObjectInteger ;BitsPerComponent *_fg .PdfObjectInteger ;VerticesPerRow *_fg .PdfObjectInteger ;Decode *_fg .PdfObjectArray ;Function []PdfFunction ;};
|
||
|
||
// PdfColorPatternType2 represents a color shading pattern type 2 (Axial).
|
||
type PdfColorPatternType2 struct{Color PdfColor ;PatternName _fg .PdfObjectName ;};
|
||
|
||
// HasXObjectByName checks if has XObject resource by name.
|
||
func (_bfddf *PdfPage )HasXObjectByName (name _fg .PdfObjectName )bool {_ccadc ,_fefaf :=_bfddf .Resources .XObject .(*_fg .PdfObjectDictionary );if !_fefaf {return false ;};if _bbgaf :=_ccadc .Get (name );_bbgaf !=nil {return true ;};return false ;};
|
||
|
||
// ToPdfObject returns a stream object.
|
||
func (_dgbeb *XObjectForm )ToPdfObject ()_fg .PdfObject {_cdgbdb :=_dgbeb ._bdage ;_acefd :=_cdgbdb .PdfObjectDictionary ;if _dgbeb .Filter !=nil {_acefd =_dgbeb .Filter .MakeStreamDict ();_cdgbdb .PdfObjectDictionary =_acefd ;};_acefd .Set ("\u0054\u0079\u0070\u0065",_fg .MakeName ("\u0058O\u0062\u006a\u0065\u0063\u0074"));
|
||
_acefd .Set ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u0046\u006f\u0072\u006d"));_acefd .SetIfNotNil ("\u0046\u006f\u0072\u006d\u0054\u0079\u0070\u0065",_dgbeb .FormType );_acefd .SetIfNotNil ("\u0042\u0042\u006f\u0078",_dgbeb .BBox );_acefd .SetIfNotNil ("\u004d\u0061\u0074\u0072\u0069\u0078",_dgbeb .Matrix );
|
||
if _dgbeb .Resources !=nil {_acefd .SetIfNotNil ("\u0052e\u0073\u006f\u0075\u0072\u0063\u0065s",_dgbeb .Resources .ToPdfObject ());};_acefd .SetIfNotNil ("\u0047\u0072\u006fu\u0070",_dgbeb .Group );_acefd .SetIfNotNil ("\u0052\u0065\u0066",_dgbeb .Ref );
|
||
_acefd .SetIfNotNil ("\u004d\u0065\u0074\u0061\u0044\u0061\u0074\u0061",_dgbeb .MetaData );_acefd .SetIfNotNil ("\u0050i\u0065\u0063\u0065\u0049\u006e\u0066o",_dgbeb .PieceInfo );_acefd .SetIfNotNil ("\u004c\u0061\u0073t\u004d\u006f\u0064\u0069\u0066\u0069\u0065\u0064",_dgbeb .LastModified );
|
||
_acefd .SetIfNotNil ("\u0053\u0074\u0072u\u0063\u0074\u0050\u0061\u0072\u0065\u006e\u0074",_dgbeb .StructParent );_acefd .SetIfNotNil ("\u0053\u0074\u0072\u0075\u0063\u0074\u0050\u0061\u0072\u0065\u006e\u0074\u0073",_dgbeb .StructParents );_acefd .SetIfNotNil ("\u004f\u0050\u0049",_dgbeb .OPI );
|
||
_acefd .SetIfNotNil ("\u004f\u0043",_dgbeb .OC );_acefd .SetIfNotNil ("\u004e\u0061\u006d\u0065",_dgbeb .Name );_acefd .Set ("\u004c\u0065\u006e\u0067\u0074\u0068",_fg .MakeInteger (int64 (len (_dgbeb .Stream ))));_cdgbdb .Stream =_dgbeb .Stream ;return _cdgbdb ;
|
||
};
|
||
|
||
// SetEncoder sets the encoding for the underlying font.
|
||
// TODO(peterwilliams97): Change function signature to SetEncoder(encoder *textencoding.simpleEncoder).
|
||
// TODO(gunnsth): Makes sense if SetEncoder is removed from the interface fonts.Font as proposed in PR #260.
|
||
func (_fdfgf *pdfFontSimple )SetEncoder (encoder _dg .TextEncoder ){_fdfgf ._bdgda =encoder };
|
||
|
||
// FieldValueProvider provides field values from a data source such as FDF, JSON or any other.
|
||
type FieldValueProvider interface{FieldValues ()(map[string ]_fg .PdfObject ,error );};func _cffc (_cabg *_fg .PdfObjectDictionary )(*PdfFieldText ,error ){_bfaeg :=&PdfFieldText {};_bfaeg .DA ,_ =_fg .GetString (_cabg .Get ("\u0044\u0041"));_bfaeg .Q ,_ =_fg .GetInt (_cabg .Get ("\u0051"));
|
||
_bfaeg .DS ,_ =_fg .GetString (_cabg .Get ("\u0044\u0053"));_bfaeg .RV =_cabg .Get ("\u0052\u0056");_bfaeg .MaxLen ,_ =_fg .GetInt (_cabg .Get ("\u004d\u0061\u0078\u004c\u0065\u006e"));return _bfaeg ,nil ;};func (_faad *PdfReader )newPdfAnnotationRedactFromDict (_fddc *_fg .PdfObjectDictionary )(*PdfAnnotationRedact ,error ){_efef :=PdfAnnotationRedact {};
|
||
_defe ,_gbeab :=_faad .newPdfAnnotationMarkupFromDict (_fddc );if _gbeab !=nil {return nil ,_gbeab ;};_efef .PdfAnnotationMarkup =_defe ;_efef .QuadPoints =_fddc .Get ("\u0051\u0075\u0061\u0064\u0050\u006f\u0069\u006e\u0074\u0073");_efef .IC =_fddc .Get ("\u0049\u0043");
|
||
_efef .RO =_fddc .Get ("\u0052\u004f");_efef .OverlayText =_fddc .Get ("O\u0076\u0065\u0072\u006c\u0061\u0079\u0054\u0065\u0078\u0074");_efef .Repeat =_fddc .Get ("\u0052\u0065\u0070\u0065\u0061\u0074");_efef .DA =_fddc .Get ("\u0044\u0041");_efef .Q =_fddc .Get ("\u0051");
|
||
return &_efef ,nil ;};
|
||
|
||
// Evaluate runs the function on the passed in slice and returns the results.
|
||
func (_dgbfd *PdfFunctionType2 )Evaluate (x []float64 )([]float64 ,error ){if len (x )!=1{_aa .Log .Error ("\u004f\u006e\u006c\u0079 o\u006e\u0065\u0020\u0069\u006e\u0070\u0075\u0074\u0020\u0061\u006c\u006c\u006f\u0077e\u0064");return nil ,_ce .New ("r\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b");
|
||
};_gdcfa :=[]float64 {0.0};if _dgbfd .C0 !=nil {_gdcfa =_dgbfd .C0 ;};_aadfe :=[]float64 {1.0};if _dgbfd .C1 !=nil {_aadfe =_dgbfd .C1 ;};var _fgefe []float64 ;for _cbeg :=0;_cbeg < len (_gdcfa );_cbeg ++{_cgfdg :=_gdcfa [_cbeg ]+_ef .Pow (x [0],_dgbfd .N )*(_aadfe [_cbeg ]-_gdcfa [_cbeg ]);
|
||
_fgefe =append (_fgefe ,_cgfdg );};return _fgefe ,nil ;};
|
||
|
||
// NewPdfAnnotationPolyLine returns a new polyline annotation.
|
||
func NewPdfAnnotationPolyLine ()*PdfAnnotationPolyLine {_cdf :=NewPdfAnnotation ();_fac :=&PdfAnnotationPolyLine {};_fac .PdfAnnotation =_cdf ;_fac .PdfAnnotationMarkup =&PdfAnnotationMarkup {};_cdf .SetContext (_fac );return _fac ;};
|
||
|
||
// SetPdfTitle sets the Title attribute of the output PDF.
|
||
func SetPdfTitle (title string ){_baacg .Lock ();defer _baacg .Unlock ();_ebfgc =title };func _adfa (_ggba _fg .PdfObject )(*PdfColorspaceLab ,error ){_dbc :=NewPdfColorspaceLab ();if _edfda ,_cfdaa :=_ggba .(*_fg .PdfIndirectObject );_cfdaa {_dbc ._fabgc =_edfda ;
|
||
};_ggba =_fg .TraceToDirectObject (_ggba );_ebdg ,_gbee :=_ggba .(*_fg .PdfObjectArray );if !_gbee {return nil ,_d .Errorf ("\u0074\u0079\u0070\u0065\u0020\u0065\u0072\u0072\u006f\u0072");};if _ebdg .Len ()!=2{return nil ,_d .Errorf ("\u0069n\u0076\u0061\u006c\u0069d\u0020\u0043\u0061\u006c\u0052G\u0042 \u0063o\u006c\u006f\u0072\u0073\u0070\u0061\u0063e");
|
||
};_ggba =_fg .TraceToDirectObject (_ebdg .Get (0));_edcgb ,_gbee :=_ggba .(*_fg .PdfObjectName );if !_gbee {return nil ,_d .Errorf ("\u006c\u0061\u0062\u0020\u006e\u0061\u006d\u0065\u0020\u006e\u006ft\u0020\u0061\u0020\u004e\u0061\u006d\u0065\u0020\u006f\u0062j\u0065\u0063\u0074");
|
||
};if *_edcgb !="\u004c\u0061\u0062"{return nil ,_d .Errorf ("n\u006ft\u0020\u0061\u0020\u004c\u0061\u0062\u0020\u0063o\u006c\u006f\u0072\u0073pa\u0063\u0065");};_ggba =_fg .TraceToDirectObject (_ebdg .Get (1));_defa ,_gbee :=_ggba .(*_fg .PdfObjectDictionary );
|
||
if !_gbee {return nil ,_d .Errorf ("c\u006f\u006c\u006f\u0072\u0073\u0070\u0061\u0063\u0065\u0020\u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061r\u0079\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020or\u0020\u0069\u006ev\u0061l\u0069\u0064");};_ggba =_defa .Get ("\u0057\u0068\u0069\u0074\u0065\u0050\u006f\u0069\u006e\u0074");
|
||
_ggba =_fg .TraceToDirectObject (_ggba );_accd ,_gbee :=_ggba .(*_fg .PdfObjectArray );if !_gbee {return nil ,_d .Errorf ("\u004c\u0061\u0062\u0020In\u0076\u0061\u006c\u0069\u0064\u0020\u0057\u0068\u0069\u0074\u0065\u0050\u006f\u0069n\u0074");};if _accd .Len ()!=3{return nil ,_d .Errorf ("\u004c\u0061b\u003a\u0020\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0057\u0068\u0069\u0074\u0065\u0050\u006f\u0069\u006e\u0074\u0020\u0061rr\u0061\u0079");
|
||
};_adgd ,_gcgfd :=_accd .GetAsFloat64Slice ();if _gcgfd !=nil {return nil ,_gcgfd ;};_dbc .WhitePoint =_adgd ;_ggba =_defa .Get ("\u0042\u006c\u0061\u0063\u006b\u0050\u006f\u0069\u006e\u0074");if _ggba !=nil {_ggba =_fg .TraceToDirectObject (_ggba );_bbed ,_gbccb :=_ggba .(*_fg .PdfObjectArray );
|
||
if !_gbccb {return nil ,_d .Errorf ("\u004c\u0061\u0062: \u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0042\u006c\u0061\u0063\u006b\u0050\u006f\u0069\u006e\u0074");};if _bbed .Len ()!=3{return nil ,_d .Errorf ("\u004c\u0061b\u003a\u0020\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0042\u006c\u0061\u0063\u006b\u0050\u006f\u0069\u006e\u0074\u0020\u0061rr\u0061\u0079");
|
||
};_cdff ,_gffg :=_bbed .GetAsFloat64Slice ();if _gffg !=nil {return nil ,_gffg ;};_dbc .BlackPoint =_cdff ;};_ggba =_defa .Get ("\u0052\u0061\u006eg\u0065");if _ggba !=nil {_ggba =_fg .TraceToDirectObject (_ggba );_dagd ,_fgbb :=_ggba .(*_fg .PdfObjectArray );
|
||
if !_fgbb {_aa .Log .Error ("\u0052\u0061n\u0067\u0065\u0020t\u0079\u0070\u0065\u0020\u0065\u0072\u0072\u006f\u0072");return nil ,_d .Errorf ("\u004ca\u0062:\u0020\u0054\u0079\u0070\u0065\u0020\u0065\u0072\u0072\u006f\u0072");};if _dagd .Len ()!=4{_aa .Log .Error ("\u0052\u0061\u006e\u0067\u0065\u0020\u0072\u0061\u006e\u0067\u0065\u0020e\u0072\u0072\u006f\u0072");
|
||
return nil ,_d .Errorf ("\u004c\u0061b\u003a\u0020\u0052a\u006e\u0067\u0065\u0020\u0065\u0072\u0072\u006f\u0072");};_fgcg ,_afeed :=_dagd .GetAsFloat64Slice ();if _afeed !=nil {return nil ,_afeed ;};_dbc .Range =_fgcg ;};return _dbc ,nil ;};
|
||
|
||
// IsEncrypted returns true if the PDF file is encrypted.
|
||
func (_acfa *PdfReader )IsEncrypted ()(bool ,error ){return _acfa ._ccgg .IsEncrypted ()};
|
||
|
||
// PdfModel is a higher level PDF construct which can be collapsed into a PdfObject.
|
||
// Each PdfModel has an underlying PdfObject and vice versa (one-to-one).
|
||
// Under normal circumstances there should only be one copy of each.
|
||
// Copies can be made, but care must be taken to do it properly.
|
||
type PdfModel interface{ToPdfObject ()_fg .PdfObject ;GetContainingPdfObject ()_fg .PdfObject ;};
|
||
|
||
// SetPdfCreationDate sets the CreationDate attribute of the output PDF.
|
||
func SetPdfCreationDate (creationDate _g .Time ){_baacg .Lock ();defer _baacg .Unlock ();_dfdeae =creationDate ;};
|
||
|
||
// ButtonType represents the subtype of a button field, can be one of:
|
||
// - Checkbox (ButtonTypeCheckbox)
|
||
// - PushButton (ButtonTypePushButton)
|
||
// - RadioButton (ButtonTypeRadioButton)
|
||
type ButtonType int ;func _cabb (_acbgd *fontCommon )*pdfFontType0 {return &pdfFontType0 {fontCommon :*_acbgd }};func _affd (_efcd *PdfField )[]*PdfField {_fgfb :=[]*PdfField {_efcd };for _ ,_bdfg :=range _efcd .Kids {_fgfb =append (_fgfb ,_affd (_bdfg )...);
|
||
};return _fgfb ;};
|
||
|
||
// PdfAnnotationWatermark represents Watermark annotations.
|
||
// (Section 12.5.6.22).
|
||
type PdfAnnotationWatermark struct{*PdfAnnotation ;FixedPrint _fg .PdfObject ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_agbae *PdfAnnotationSound )ToPdfObject ()_fg .PdfObject {_agbae .PdfAnnotation .ToPdfObject ();_daf :=_agbae ._agb ;_cfaf :=_daf .PdfObject .(*_fg .PdfObjectDictionary );_agbae .PdfAnnotationMarkup .appendToPdfDictionary (_cfaf );_cfaf .SetIfNotNil ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u0053\u006f\u0075n\u0064"));
|
||
_cfaf .SetIfNotNil ("\u0053\u006f\u0075n\u0064",_agbae .Sound );_cfaf .SetIfNotNil ("\u004e\u0061\u006d\u0065",_agbae .Name );return _daf ;};
|
||
|
||
// AddPage adds a page to the PDF file. The new page should be an indirect object.
|
||
func (_fcedf *PdfWriter )AddPage (page *PdfPage )error {const _ebad ="\u006d\u006f\u0064el\u003a\u0050\u0064\u0066\u0057\u0072\u0069\u0074\u0065\u0072\u002e\u0041\u0064\u0064\u0050\u0061\u0067\u0065";_dgfg (page );_egddf :=page .ToPdfObject ();_aa .Log .Trace ("\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d");
|
||
_aa .Log .Trace ("\u0041p\u0070\u0065\u006e\u0064i\u006e\u0067\u0020\u0074\u006f \u0070a\u0067e\u0020\u006c\u0069\u0073\u0074\u0020\u0025T",_egddf );_agaff ,_geea :=_fg .GetIndirect (_egddf );if !_geea {return _ce .New ("\u0070\u0061\u0067\u0065\u0020\u0073h\u006f\u0075\u006c\u0064\u0020\u0062\u0065\u0020\u0061\u006e\u0020\u0069\u006ed\u0069\u0072\u0065\u0063\u0074\u0020\u006fb\u006a\u0065\u0063\u0074");
|
||
};_aa .Log .Trace ("\u0025\u0073",_agaff );_aa .Log .Trace ("\u0025\u0073",_agaff .PdfObject );_adcd ,_geea :=_fg .GetDict (_agaff .PdfObject );if !_geea {return _ce .New ("\u0070\u0061\u0067e \u006f\u0062\u006a\u0065\u0063\u0074\u0020\u0073\u0068o\u0075l\u0064 \u0062e\u0020\u0061\u0020\u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061\u0072\u0079");
|
||
};_eeefg ,_geea :=_fg .GetName (_adcd .Get ("\u0054\u0079\u0070\u0065"));if !_geea {return _d .Errorf ("\u0070\u0061\u0067\u0065\u0020\u0073\u0068\u006f\u0075\u006c\u0064\u0020\u0068\u0061\u0076\u0065\u0020\u0061\u0020\u0054y\u0070\u0065\u0020\u006b\u0065\u0079\u0020\u0077\u0069t\u0068\u0020\u0061\u0020\u0076\u0061\u006c\u0075\u0065\u0020\u006f\u0066\u0020t\u0079\u0070\u0065\u0020\u006e\u0061m\u0065\u0020\u0028%\u0054\u0029",_adcd .Get ("\u0054\u0079\u0070\u0065"));
|
||
};if _eeefg .String ()!="\u0050\u0061\u0067\u0065"{return _ce .New ("\u0066\u0069e\u006c\u0064\u0020\u0054\u0079\u0070\u0065\u0020\u0021\u003d\u0020\u0050\u0061\u0067\u0065\u0020\u0028\u0052\u0065\u0071\u0075\u0069re\u0064\u0029");};_effdb :=[]_fg .PdfObjectName {"\u0052e\u0073\u006f\u0075\u0072\u0063\u0065s","\u004d\u0065\u0064\u0069\u0061\u0042\u006f\u0078","\u0043r\u006f\u0070\u0042\u006f\u0078","\u0052\u006f\u0074\u0061\u0074\u0065"};
|
||
_aadc ,_gfagf :=_fg .GetIndirect (_adcd .Get ("\u0050\u0061\u0072\u0065\u006e\u0074"));_aa .Log .Trace ("P\u0061g\u0065\u0020\u0050\u0061\u0072\u0065\u006e\u0074:\u0020\u0025\u0054\u0020(%\u0076\u0029",_adcd .Get ("\u0050\u0061\u0072\u0065\u006e\u0074"),_gfagf );
|
||
for _gfagf {_aa .Log .Trace ("\u0050a\u0067e\u0020\u0050\u0061\u0072\u0065\u006e\u0074\u003a\u0020\u0025\u0054",_aadc );_cccee ,_eaed :=_fg .GetDict (_aadc .PdfObject );if !_eaed {return _ce .New ("i\u006e\u0076\u0061\u006cid\u0020P\u0061\u0072\u0065\u006e\u0074 \u006f\u0062\u006a\u0065\u0063\u0074");
|
||
};for _ ,_cgada :=range _effdb {_aa .Log .Trace ("\u0046\u0069\u0065\u006c\u0064\u0020\u0025\u0073",_cgada );if _adcd .Get (_cgada )!=nil {_aa .Log .Trace ("\u002d \u0070a\u0067\u0065\u0020\u0068\u0061s\u0020\u0061l\u0072\u0065\u0061\u0064\u0079");continue ;
|
||
};if _gcegd :=_cccee .Get (_cgada );_gcegd !=nil {_aa .Log .Trace ("\u0049\u006e\u0068\u0065ri\u0074\u0069\u006e\u0067\u0020\u0066\u0069\u0065\u006c\u0064\u0020\u0025\u0073",_cgada );_adcd .Set (_cgada ,_gcegd );};};_aadc ,_gfagf =_fg .GetIndirect (_cccee .Get ("\u0050\u0061\u0072\u0065\u006e\u0074"));
|
||
_aa .Log .Trace ("\u004ee\u0078t\u0020\u0070\u0061\u0072\u0065\u006e\u0074\u003a\u0020\u0025\u0054",_cccee .Get ("\u0050\u0061\u0072\u0065\u006e\u0074"));};_aa .Log .Trace ("\u0054\u0072\u0061\u0076\u0065\u0072\u0073\u0061\u006c \u0064\u006f\u006e\u0065");
|
||
_adcd .Set ("\u0050\u0061\u0072\u0065\u006e\u0074",_fcedf ._feccd );_agaff .PdfObject =_adcd ;_faeaf ,_geea :=_fg .GetDict (_fcedf ._feccd .PdfObject );if !_geea {return _ce .New ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0050\u0061g\u0065\u0073\u0020\u006f\u0062\u006a\u0020(\u006e\u006f\u0074\u0020\u0061\u0020\u0064\u0069\u0063\u0074\u0029");
|
||
};_ddddf ,_geea :=_fg .GetArray (_faeaf .Get ("\u004b\u0069\u0064\u0073"));if !_geea {return _ce .New ("\u0069\u006ev\u0061\u006c\u0069\u0064 \u0050\u0061g\u0065\u0073\u0020\u004b\u0069\u0064\u0073\u0020o\u0062\u006a\u0020\u0028\u006e\u006f\u0074\u0020\u0061\u006e\u0020\u0061r\u0072\u0061\u0079\u0029");
|
||
};_ddddf .Append (_agaff );_fcedf ._cbdbf [_adcd ]=struct{}{};_babgf ,_geea :=_fg .GetInt (_faeaf .Get ("\u0043\u006f\u0075n\u0074"));if !_geea {return _ce .New ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064 \u0050\u0061\u0067e\u0073\u0020\u0043\u006fu\u006e\u0074\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u0020\u0028\u006e\u006f\u0074\u0020\u0061\u006e\u0020\u0069\u006e\u0074\u0065\u0067\u0065\u0072\u0029");
|
||
};*_babgf =*_babgf +1;if page ._dedef ==nil {_gaecc :=_bec .Track (_fcedf ._dbefbd ,_ebad );if _gaecc !=nil {return _gaecc ;};}else {_eebe :=_bec .Track (page ._dedef ._cecbe ,_ebad );if _eebe !=nil {return _eebe ;};};_fcedf .addObject (_agaff );_gedeg :=_fcedf .addObjects (_adcd );
|
||
if _gedeg !=nil {return _gedeg ;};return nil ;};
|
||
|
||
// CharcodesToUnicode converts the character codes `charcodes` to a slice of runes.
|
||
// How it works:
|
||
// 1. Use the ToUnicode CMap if there is one.
|
||
// 2. Use the underlying font's encoding.
|
||
func (_cded *PdfFont )CharcodesToUnicode (charcodes []_dg .CharCode )[]rune {_bddgef ,_ ,_ :=_cded .CharcodesToUnicodeWithStats (charcodes );return _bddgef ;};
|
||
|
||
// PdfAcroForm represents the AcroForm dictionary used for representation of form data in PDF.
|
||
type PdfAcroForm struct{Fields *[]*PdfField ;NeedAppearances *_fg .PdfObjectBool ;SigFlags *_fg .PdfObjectInteger ;CO *_fg .PdfObjectArray ;DR *PdfPageResources ;DA *_fg .PdfObjectString ;Q *_fg .PdfObjectInteger ;XFA _fg .PdfObject ;
|
||
|
||
// ADBEEchoSign extra objects from Adobe Acrobat, causing signature invalid if not exists.
|
||
ADBEEchoSign _fg .PdfObject ;_daca *_fg .PdfIndirectObject ;_fgdbf bool ;};func (_ecegb *PdfWriter )writeObjectsInStreams (_dbgde map[_fg .PdfObject ]bool )error {for _ ,_gcbcc :=range _ecegb ._bbfd {if _cbafac :=_dbgde [_gcbcc ];_cbafac {continue ;};_gegaa :=int64 (0);
|
||
switch _eaef :=_gcbcc .(type ){case *_fg .PdfIndirectObject :_gegaa =_eaef .ObjectNumber ;case *_fg .PdfObjectStream :_gegaa =_eaef .ObjectNumber ;case *_fg .PdfObjectStreams :_gegaa =_eaef .ObjectNumber ;default:_aa .Log .Debug ("\u0045R\u0052\u004fR\u003a\u0020\u0055n\u0073\u0075\u0070\u0070\u006f\u0072\u0074e\u0064\u0020\u0074\u0079\u0070\u0065 \u0069\u006e\u0020\u0077\u0072\u0069\u0074\u0065\u0072\u0020\u006fb\u006a\u0065\u0063\u0074\u0073\u003a\u0020\u0025\u0054",_gcbcc );
|
||
return ErrTypeCheck ;};if _ecegb ._bbdbd !=nil &&_gcbcc !=_ecegb ._abgdg {_gdfdc :=_ecegb ._bbdbd .Encrypt (_gcbcc ,_gegaa ,0);if _gdfdc !=nil {_aa .Log .Debug ("\u0045\u0052R\u004f\u0052\u003a\u0020\u0046\u0061\u0069\u006c\u0065\u0064\u0020\u0065\u006e\u0063\u0072\u0079\u0070\u0074\u0069\u006e\u0067\u0020(%\u0073\u0029",_gdfdc );
|
||
return _gdfdc ;};};_ecegb .writeObject (int (_gegaa ),_gcbcc );};return nil ;};
|
||
|
||
// B returns the value of the B component of the color.
|
||
func (_aeee *PdfColorCalRGB )B ()float64 {return _aeee [1]};
|
||
|
||
// GetRuneMetrics returns the char metrics for a rune.
|
||
// TODO(peterwilliams97) There is nothing callers can do if no CharMetrics are found so we might as
|
||
// well give them 0 width. There is no need for the bool return.
|
||
func (_gdeb *PdfFont )GetRuneMetrics (r rune )(CharMetrics ,bool ){_cggf :=_gdeb .actualFont ();if _cggf ==nil {_aa .Log .Debug ("ER\u0052\u004fR\u003a\u0020\u0047\u0065\u0074\u0047\u006c\u0079\u0070h\u0043\u0068\u0061\u0072\u004d\u0065\u0074\u0072\u0069\u0063\u0073\u0020\u004e\u006f\u0074\u0020\u0069\u006d\u0070\u006c\u0065\u006d\u0065\u006e\u0074\u0065\u0064\u0020f\u006fr\u0020\u0066\u006f\u006e\u0074\u0020\u0074\u0079p\u0065=\u0025\u0023T",_gdeb ._gcaeff );
|
||
return _eed .CharMetrics {},false ;};if _cgcfb ,_ccec :=_cggf .GetRuneMetrics (r );_ccec {return _cgcfb ,true ;};if _ccbb ,_ceddg :=_gdeb .GetFontDescriptor ();_ceddg ==nil &&_ccbb !=nil {return _eed .CharMetrics {Wx :_ccbb ._gbbgb },true ;};_aa .Log .Debug ("\u0047\u0065\u0074\u0047\u006c\u0079\u0070h\u0043\u0068\u0061r\u004d\u0065\u0074\u0072i\u0063\u0073\u003a\u0020\u004e\u006f\u0020\u006d\u0065\u0074\u0072\u0069\u0063\u0073\u0020\u0066\u006f\u0072\u0020\u0066\u006f\u006e\u0074\u003d\u0025\u0073",_gdeb );
|
||
return _eed .CharMetrics {},false ;};
|
||
|
||
// GetContentStreams returns the content stream as an array of strings.
|
||
func (_ceeac *PdfPage )GetContentStreams ()([]string ,error ){_fefeg :=_ceeac .GetContentStreamObjs ();var _efdb []string ;for _ ,_gfgga :=range _fefeg {_aedca ,_aaca :=_accab (_gfgga );if _aaca !=nil {return nil ,_aaca ;};_efdb =append (_efdb ,_aedca );
|
||
};return _efdb ,nil ;};
|
||
|
||
// ToPdfObject returns the choice field dictionary within an indirect object (container).
|
||
func (_bbceb *PdfFieldChoice )ToPdfObject ()_fg .PdfObject {_bbceb .PdfField .ToPdfObject ();_fecc :=_bbceb ._daecc ;_dggad :=_fecc .PdfObject .(*_fg .PdfObjectDictionary );_dggad .Set ("\u0046\u0054",_fg .MakeName ("\u0043\u0068"));if _bbceb .Opt !=nil {_dggad .Set ("\u004f\u0070\u0074",_bbceb .Opt );
|
||
};if _bbceb .TI !=nil {_dggad .Set ("\u0054\u0049",_bbceb .TI );};if _bbceb .I !=nil {_dggad .Set ("\u0049",_bbceb .I );};return _fecc ;};func _agccg (_dfeee *_fg .PdfObjectDictionary ,_aaeac *fontCommon ,_aadb _dg .TextEncoder )(*pdfFontSimple ,error ){_gdbed :=_abfbd (_aaeac );
|
||
_gdbed ._fcad =_aadb ;if _aadb ==nil {_gdffg :=_dfeee .Get ("\u0046i\u0072\u0073\u0074\u0043\u0068\u0061r");if _gdffg ==nil {_gdffg =_fg .MakeInteger (0);};_gdbed .FirstChar =_gdffg ;_fgbe ,_ebbf :=_fg .GetIntVal (_gdffg );if !_ebbf {_aa .Log .Debug ("\u0045\u0052\u0052OR\u003a\u0020\u0049\u006e\u0076\u0061\u006c\u0069\u0064 \u0046i\u0072s\u0074C\u0068\u0061\u0072\u0020\u0074\u0079\u0070\u0065\u0020\u0028\u0025\u0054\u0029",_gdffg );
|
||
return nil ,_fg .ErrTypeError ;};_gegba :=_dg .CharCode (_fgbe );_gdffg =_dfeee .Get ("\u004c\u0061\u0073\u0074\u0043\u0068\u0061\u0072");if _gdffg ==nil {_gdffg =_fg .MakeInteger (255);};_gdbed .LastChar =_gdffg ;_fgbe ,_ebbf =_fg .GetIntVal (_gdffg );
|
||
if !_ebbf {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a \u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u004c\u0061\u0073\u0074\u0043h\u0061\u0072\u0020\u0074\u0079\u0070\u0065 \u0028\u0025\u0054\u0029",_gdffg );return nil ,_fg .ErrTypeError ;
|
||
};_ggdcb :=_dg .CharCode (_fgbe );_gdbed ._fcgbd =make (map[_dg .CharCode ]float64 );_gdffg =_dfeee .Get ("\u0057\u0069\u0064\u0074\u0068\u0073");if _gdffg !=nil {_gdbed .Widths =_gdffg ;_aeabb ,_dacdb :=_fg .GetArray (_gdffg );if !_dacdb {_aa .Log .Debug ("\u0045\u0052R\u004f\u0052\u003a\u0020W\u0069\u0064t\u0068\u0073\u0020\u0061\u0074\u0074\u0072\u0069b\u0075\u0074\u0065\u0020\u0021\u003d\u0020\u0061\u0072\u0072\u0061\u0079 \u0028\u0025\u0054\u0029",_gdffg );
|
||
return nil ,_fg .ErrTypeError ;};_bgacc ,_cdfb :=_aeabb .ToFloat64Array ();if _cdfb !=nil {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a \u0063\u006f\u006e\u0076\u0065\u0072\u0074\u0069\u006e\u0067\u0020\u0077\u0069d\u0074\u0068\u0073\u0020\u0074\u006f\u0020a\u0072\u0072\u0061\u0079");
|
||
return nil ,_cdfb ;};if len (_bgacc )!=int (_ggdcb -_gegba +1){_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0049\u006e\u0076\u0061\u006c\u0069d\u0020\u0077\u0069\u0064\u0074\u0068s\u0020\u006c\u0065\u006e\u0067\u0074\u0068\u0020\u0021\u003d\u0020\u0025\u0064 \u0028\u0025\u0064\u0029",_ggdcb -_gegba +1,len (_bgacc ));
|
||
return nil ,_fg .ErrRangeError ;};for _dfad ,_caagb :=range _bgacc {_gdbed ._fcgbd [_gegba +_dg .CharCode (_dfad )]=_caagb ;};};};_gdbed .Encoding =_fg .TraceToDirectObject (_dfeee .Get ("\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067"));return _gdbed ,nil ;
|
||
};
|
||
|
||
// ColorFromPdfObjects gets the color from a series of pdf objects (3 for rgb).
|
||
func (_acabd *PdfColorspaceDeviceRGB )ColorFromPdfObjects (objects []_fg .PdfObject )(PdfColor ,error ){if len (objects )!=3{return nil ,_ce .New ("r\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b");};_edcg ,_bgd :=_fg .GetNumbersAsFloat (objects );
|
||
if _bgd !=nil {return nil ,_bgd ;};return _acabd .ColorFromFloats (_edcg );};func _fbeg (_fcec *fontCommon )*pdfFontType3 {return &pdfFontType3 {fontCommon :*_fcec }};
|
||
|
||
// AddOCSPs adds OCSPs to DSS.
|
||
func (_dbdf *DSS )AddOCSPs (ocsps [][]byte )([]*_fg .PdfObjectStream ,error ){return _dbdf .add (&_dbdf .OCSPs ,_dbdf ._cgbbd ,ocsps );};
|
||
|
||
// PdfAppender appends new PDF content to an existing PDF document via incremental updates.
|
||
type PdfAppender struct{_ebd _ff .ReadSeeker ;_bbef *_fg .PdfParser ;_cbb *PdfReader ;Reader *PdfReader ;_agbg []*PdfPage ;_cacc *PdfAcroForm ;_dgbf *DSS ;_fege *Permissions ;_gaeb _fg .XrefTable ;_dff int64 ;_egcab int ;_gcdb []_fg .PdfObject ;_aec map[_fg .PdfObject ]struct{};
|
||
_dcbad map[_fg .PdfObject ]int64 ;_fgb map[_fg .PdfObject ]struct{};_fcca map[_fg .PdfObject ]struct{};_ggcf int64 ;_fgggf bool ;_gccg string ;_ggb *EncryptOptions ;_fadf *PdfInfo ;};
|
||
|
||
// HasXObjectByName checks if an XObject with a specified keyName is defined.
|
||
func (_acgee *PdfPageResources )HasXObjectByName (keyName _fg .PdfObjectName )bool {_adedb ,_ :=_acgee .GetXObjectByName (keyName );return _adedb !=nil ;};
|
||
|
||
// Insert adds an outline item as a child of the current outline item,
|
||
// at the specified index.
|
||
func (_ffea *OutlineItem )Insert (index uint ,item *OutlineItem ){_bbac :=uint (len (_ffea .Entries ));if index > _bbac {index =_bbac ;};_ffea .Entries =append (_ffea .Entries [:index ],append ([]*OutlineItem {item },_ffea .Entries [index :]...)...);};
|
||
|
||
|
||
// PdfActionLaunch represents a launch action.
|
||
type PdfActionLaunch struct{*PdfAction ;F *PdfFilespec ;Win _fg .PdfObject ;Mac _fg .PdfObject ;Unix _fg .PdfObject ;NewWindow _fg .PdfObject ;};
|
||
|
||
// ToPdfObject converts the PdfPage to a dictionary within an indirect object container.
|
||
func (_cdec *PdfPage )ToPdfObject ()_fg .PdfObject {_bfda :=_cdec ._aebf ;_cdec .GetPageDict ();return _bfda ;};
|
||
|
||
// String returns a string describing the font descriptor.
|
||
func (_ffged *PdfFontDescriptor )String ()string {var _defg []string ;if _ffged .FontName !=nil {_defg =append (_defg ,_ffged .FontName .String ());};if _ffged .FontFamily !=nil {_defg =append (_defg ,_ffged .FontFamily .String ());};if _ffged .fontFile !=nil {_defg =append (_defg ,_ffged .fontFile .String ());
|
||
};if _ffged ._bbbd !=nil {_defg =append (_defg ,_ffged ._bbbd .String ());};_defg =append (_defg ,_d .Sprintf ("\u0046\u006f\u006et\u0046\u0069\u006c\u0065\u0033\u003d\u0025\u0074",_ffged .FontFile3 !=nil ));return _d .Sprintf ("\u0046\u004f\u004e\u0054_D\u0045\u0053\u0043\u0052\u0049\u0050\u0054\u004f\u0052\u007b\u0025\u0073\u007d",_dc .Join (_defg ,"\u002c\u0020"));
|
||
};
|
||
|
||
// ToPdfObject returns the PDF representation of the colorspace.
|
||
func (_dacdbf *PdfPageResourcesColorspaces )ToPdfObject ()_fg .PdfObject {_dcga :=_fg .MakeDict ();for _ ,_bdddc :=range _dacdbf .Names {_dcga .Set (_fg .PdfObjectName (_bdddc ),_dacdbf .Colorspaces [_bdddc ].ToPdfObject ());};if _dacdbf ._daff !=nil {_dacdbf ._daff .PdfObject =_dcga ;
|
||
return _dacdbf ._daff ;};return _dcga ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_dfbg *PdfAnnotationCaret )ToPdfObject ()_fg .PdfObject {_dfbg .PdfAnnotation .ToPdfObject ();_gffe :=_dfbg ._agb ;_dacc :=_gffe .PdfObject .(*_fg .PdfObjectDictionary );_dfbg .PdfAnnotationMarkup .appendToPdfDictionary (_dacc );_dacc .SetIfNotNil ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u0043\u0061\u0072e\u0074"));
|
||
_dacc .SetIfNotNil ("\u0052\u0044",_dfbg .RD );_dacc .SetIfNotNil ("\u0053\u0079",_dfbg .Sy );return _gffe ;};
|
||
|
||
// AddOutlineTree adds outlines to a PDF file.
|
||
func (_afdc *PdfWriter )AddOutlineTree (outlineTree *PdfOutlineTreeNode ){_afdc ._baebg =outlineTree };
|
||
|
||
// PdfFieldText represents a text field where user can enter text.
|
||
type PdfFieldText struct{*PdfField ;DA *_fg .PdfObjectString ;Q *_fg .PdfObjectInteger ;DS *_fg .PdfObjectString ;RV _fg .PdfObject ;MaxLen *_fg .PdfObjectInteger ;};func (_agfe *PdfReader )newPdfActionThreadFromDict (_dea *_fg .PdfObjectDictionary )(*PdfActionThread ,error ){_eb ,_fcb :=_ddd (_dea .Get ("\u0046"));
|
||
if _fcb !=nil {return nil ,_fcb ;};return &PdfActionThread {D :_dea .Get ("\u0044"),B :_dea .Get ("\u0042"),F :_eb },nil ;};
|
||
|
||
// GetNumComponents returns the number of color components of the colorspace device.
|
||
// Returns 4 for a CMYK32 device.
|
||
func (_bcgdd *PdfColorspaceDeviceCMYK )GetNumComponents ()int {return 4};var (CourierName =_eed .CourierName ;CourierBoldName =_eed .CourierBoldName ;CourierObliqueName =_eed .CourierObliqueName ;CourierBoldObliqueName =_eed .CourierBoldObliqueName ;HelveticaName =_eed .HelveticaName ;
|
||
HelveticaBoldName =_eed .HelveticaBoldName ;HelveticaObliqueName =_eed .HelveticaObliqueName ;HelveticaBoldObliqueName =_eed .HelveticaBoldObliqueName ;SymbolName =_eed .SymbolName ;ZapfDingbatsName =_eed .ZapfDingbatsName ;TimesRomanName =_eed .TimesRomanName ;
|
||
TimesBoldName =_eed .TimesBoldName ;TimesItalicName =_eed .TimesItalicName ;TimesBoldItalicName =_eed .TimesBoldItalicName ;);func _afdd (_gecf *_fg .PdfIndirectObject ,_acceg *_fg .PdfObjectDictionary )(*DSS ,error ){if _gecf ==nil {_gecf =_fg .MakeIndirectObject (nil );
|
||
};_gecf .PdfObject =_fg .MakeDict ();_badba :=map[string ]*VRI {};if _eafe ,_bdgg :=_fg .GetDict (_acceg .Get ("\u0056\u0052\u0049"));_bdgg {for _ ,_egdea :=range _eafe .Keys (){if _bddaa ,_bdfac :=_fg .GetDict (_eafe .Get (_egdea ));_bdfac {_badba [_dc .ToUpper (_egdea .String ())]=_gaaeb (_bddaa );
|
||
};};};return &DSS {Certs :_gfegc (_acceg .Get ("\u0043\u0065\u0072t\u0073")),OCSPs :_gfegc (_acceg .Get ("\u004f\u0043\u0053P\u0073")),CRLs :_gfegc (_acceg .Get ("\u0043\u0052\u004c\u0073")),VRI :_badba ,_gbaf :_gecf },nil ;};
|
||
|
||
// IsValid checks if the given pdf output intent type is valid.
|
||
func (_ffdde PdfOutputIntentType )IsValid ()bool {return _ffdde >=PdfOutputIntentTypeA1 &&_ffdde <=PdfOutputIntentTypeX ;};func (_bedb *PdfReader )buildNameNodes (_cdadc *_fg .PdfIndirectObject ,_bbbfa map[_fg .PdfObject ]struct{})error {if _cdadc ==nil {return nil ;
|
||
};if _ ,_facdc :=_bbbfa [_cdadc ];_facdc {_aa .Log .Debug ("\u0043\u0079\u0063l\u0069\u0063\u0020\u0072e\u0063\u0075\u0072\u0073\u0069\u006f\u006e,\u0020\u0073\u006b\u0069\u0070\u0070\u0069\u006e\u0067\u0020\u0028\u0025\u0076\u0029",_cdadc .ObjectNumber );
|
||
return nil ;};_bbbfa [_cdadc ]=struct{}{};_fcdgb ,_cfegb :=_cdadc .PdfObject .(*_fg .PdfObjectDictionary );if !_cfegb {return _ce .New ("n\u006f\u0064\u0065\u0020no\u0074 \u0061\u0020\u0064\u0069\u0063t\u0069\u006f\u006e\u0061\u0072\u0079");};if _ebbde ,_dcdad :=_fg .GetDict (_fcdgb .Get ("\u0044\u0065\u0073t\u0073"));
|
||
_dcdad {_cbbda ,_fgeee :=_fg .GetArray (_ebbde .Get ("\u004b\u0069\u0064\u0073"));if !_fgeee {return _ce .New ("\u0049n\u0076\u0061\u006c\u0069d\u0020\u004b\u0069\u0064\u0073 \u0061r\u0072a\u0079\u0020\u006f\u0062\u006a\u0065\u0063t");};_aa .Log .Trace ("\u004b\u0069\u0064\u0073\u003a\u0020\u0025\u0073",_cbbda );
|
||
for _gbagg ,_cbfbcc :=range _cbbda .Elements (){_bfca ,_bcebg :=_fg .GetIndirect (_cbfbcc );if !_bcebg {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0063\u0068\u0069\u006c\u0064\u0020n\u006f\u0074\u0020\u0069\u006e\u0064i\u0072\u0065\u0063\u0074\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u0020\u002d \u0028\u0025\u0073\u0029",_bfca );
|
||
return _ce .New ("\u0063h\u0069\u006c\u0064\u0020n\u006f\u0074\u0020\u0069\u006ed\u0069r\u0065c\u0074\u0020\u006f\u0062\u006a\u0065\u0063t");};_cbbda .Set (_gbagg ,_bfca );_gcbeg :=_bedb .buildNameNodes (_bfca ,_bbbfa );if _gcbeg !=nil {return _gcbeg ;
|
||
};};};if _fdgef ,_bdbcf :=_fg .GetDict (_fcdgb );_bdbcf {if !_fg .IsNullObject (_fdgef .Get ("\u004b\u0069\u0064\u0073")){if _gfdgg ,_gebbe :=_fg .GetArray (_fdgef .Get ("\u004b\u0069\u0064\u0073"));_gebbe {for _bgcab ,_bcfbd :=range _gfdgg .Elements (){if _agfb ,_dgccf :=_fg .GetIndirect (_bcfbd );
|
||
_dgccf {_gfdgg .Set (_bgcab ,_agfb );_bddda :=_bedb .buildNameNodes (_agfb ,_bbbfa );if _bddda !=nil {return _bddda ;};};};};};};return nil ;};
|
||
|
||
// PdfFontDescriptor specifies metrics and other attributes of a font and can refer to a FontFile
|
||
// for embedded fonts.
|
||
// 9.8 Font Descriptors (page 281)
|
||
type PdfFontDescriptor struct{FontName _fg .PdfObject ;FontFamily _fg .PdfObject ;FontStretch _fg .PdfObject ;FontWeight _fg .PdfObject ;Flags _fg .PdfObject ;FontBBox _fg .PdfObject ;ItalicAngle _fg .PdfObject ;Ascent _fg .PdfObject ;Descent _fg .PdfObject ;
|
||
Leading _fg .PdfObject ;CapHeight _fg .PdfObject ;XHeight _fg .PdfObject ;StemV _fg .PdfObject ;StemH _fg .PdfObject ;AvgWidth _fg .PdfObject ;MaxWidth _fg .PdfObject ;MissingWidth _fg .PdfObject ;FontFile _fg .PdfObject ;FontFile2 _fg .PdfObject ;FontFile3 _fg .PdfObject ;
|
||
CharSet _fg .PdfObject ;_gbeff int ;_gbbgb float64 ;*fontFile ;_bbbd *_eed .TtfType ;
|
||
|
||
// Additional entries for CIDFonts
|
||
Style _fg .PdfObject ;Lang _fg .PdfObject ;FD _fg .PdfObject ;CIDSet _fg .PdfObject ;_cgcdc *_fg .PdfIndirectObject ;};
|
||
|
||
// ReaderToWriterOpts options used to generate a PdfWriter.
|
||
type ReaderToWriterOpts struct{SkipAcroForm bool ;SkipInfo bool ;SkipNameDictionary bool ;SkipNamedDests bool ;SkipOCProperties bool ;SkipOutlines bool ;SkipPageLabels bool ;SkipRotation bool ;SkipMetadata bool ;PageProcessCallback PageProcessCallback ;
|
||
|
||
|
||
// Deprecated: will be removed in v4. Use PageProcessCallback instead.
|
||
PageCallback PageCallback ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_cefdd *PdfSignatureReference )ToPdfObject ()_fg .PdfObject {_faec :=_fg .MakeDict ();_faec .SetIfNotNil ("\u0054\u0079\u0070\u0065",_cefdd .Type );_faec .SetIfNotNil ("\u0054r\u0061n\u0073\u0066\u006f\u0072\u006d\u004d\u0065\u0074\u0068\u006f\u0064",_cefdd .TransformMethod );
|
||
_faec .SetIfNotNil ("\u0054r\u0061n\u0073\u0066\u006f\u0072\u006d\u0050\u0061\u0072\u0061\u006d\u0073",_cefdd .TransformParams );_faec .SetIfNotNil ("\u0044\u0061\u0074\u0061",_cefdd .Data );_faec .SetIfNotNil ("\u0044\u0069\u0067e\u0073\u0074\u004d\u0065\u0074\u0068\u006f\u0064",_cefdd .DigestMethod );
|
||
return _faec ;};func (_gbed *PdfColorspaceSpecialSeparation )String ()string {return "\u0053\u0065\u0070\u0061\u0072\u0061\u0074\u0069\u006f\u006e";};
|
||
|
||
// R returns the value of the red component of the color.
|
||
func (_fdfga *PdfColorDeviceRGB )R ()float64 {return _fdfga [0]};
|
||
|
||
// NewPdfColorDeviceCMYK returns a new CMYK32 color.
|
||
func NewPdfColorDeviceCMYK (c ,m ,y ,k float64 )*PdfColorDeviceCMYK {_abage :=PdfColorDeviceCMYK {c ,m ,y ,k };return &_abage ;};
|
||
|
||
// GetAlphabet returns a map of the runes in `text` and their frequencies.
|
||
func GetAlphabet (text string )map[rune ]int {_bcda :=map[rune ]int {};for _ ,_fecac :=range text {_bcda [_fecac ]++;};return _bcda ;};
|
||
|
||
// NewPdfReader returns a new PdfReader for an input io.ReadSeeker interface. Can be used to read PDF from
|
||
// memory or file. Immediately loads and traverses the PDF structure including pages and page contents (if
|
||
// not encrypted). Loads entire document structure into memory.
|
||
// Alternatively a lazy-loading reader can be created with NewPdfReaderLazy which loads only references,
|
||
// and references are loaded from disk into memory on an as-needed basis.
|
||
func NewPdfReader (rs _ff .ReadSeeker )(*PdfReader ,error ){const _gggb ="\u006do\u0064e\u006c\u003a\u004e\u0065\u0077P\u0064\u0066R\u0065\u0061\u0064\u0065\u0072";return _bgdaf (rs ,&ReaderOpts {},false ,_gggb );};
|
||
|
||
// GetAnnotations returns the list of page annotations for `page`. If not loaded attempts to load the
|
||
// annotations, otherwise returns the loaded list.
|
||
func (_febaa *PdfPage )GetAnnotations ()([]*PdfAnnotation ,error ){if _febaa ._fbbb !=nil {return _febaa ._fbbb ,nil ;};if _febaa .Annots ==nil {_febaa ._fbbb =[]*PdfAnnotation {};return nil ,nil ;};if _febaa ._dedef ==nil {_febaa ._fbbb =[]*PdfAnnotation {};
|
||
return nil ,nil ;};_bdad ,_bdgbb :=_febaa ._dedef .loadAnnotations (_febaa .Annots );if _bdgbb !=nil {return nil ,_bdgbb ;};if _bdad ==nil {_febaa ._fbbb =[]*PdfAnnotation {};};_febaa ._fbbb =_bdad ;return _febaa ._fbbb ,nil ;};
|
||
|
||
// NewPdfAnnotationTrapNet returns a new trapnet annotation.
|
||
func NewPdfAnnotationTrapNet ()*PdfAnnotationTrapNet {_afaa :=NewPdfAnnotation ();_bca :=&PdfAnnotationTrapNet {};_bca .PdfAnnotation =_afaa ;_afaa .SetContext (_bca );return _bca ;};
|
||
|
||
// GetPatternByName gets the pattern specified by keyName. Returns nil if not existing.
|
||
// The bool flag indicated whether it was found or not.
|
||
func (_gcffb *PdfPageResources )GetPatternByName (keyName _fg .PdfObjectName )(*PdfPattern ,bool ){if _gcffb .Pattern ==nil {return nil ,false ;};_dbgcg ,_faeg :=_fg .TraceToDirectObject (_gcffb .Pattern ).(*_fg .PdfObjectDictionary );if !_faeg {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0050\u0061\u0074t\u0065\u0072\u006e\u0020\u0065\u006e\u0074r\u0079\u0020\u002d\u0020\u006e\u006f\u0074\u0020\u0061\u0020\u0064i\u0063\u0074\u0020\u0028\u0067\u006f\u0074\u0020\u0025\u0054\u0029",_gcffb .Pattern );
|
||
return nil ,false ;};if _abfab :=_dbgcg .Get (keyName );_abfab !=nil {_ggace ,_gaccg :=_ffeff (_abfab );if _gaccg !=nil {_aa .Log .Debug ("\u0045\u0052R\u004f\u0052\u003a\u0020f\u0061\u0069l\u0065\u0064\u0020\u0074\u006f\u0020\u006c\u006fa\u0064\u0020\u0070\u0064\u0066\u0020\u0070\u0061\u0074\u0074\u0065\u0072n\u003a\u0020\u0025\u0076",_gaccg );
|
||
return nil ,false ;};return _ggace ,true ;};return nil ,false ;};
|
||
|
||
// FontDescriptor returns font's PdfFontDescriptor. This may be a builtin descriptor for standard 14
|
||
// fonts but must be an explicit descriptor for other fonts.
|
||
func (_gfefg *PdfFont )FontDescriptor ()*PdfFontDescriptor {if _gfefg .baseFields ()._cdgef !=nil {return _gfefg .baseFields ()._cdgef ;};if _bdegf :=_gfefg ._gcaeff .getFontDescriptor ();_bdegf !=nil {return _bdegf ;};_aa .Log .Error ("\u0041\u006cl \u0066\u006f\u006et\u0073\u0020\u0068\u0061ve \u0061 D\u0065\u0073\u0063\u0072\u0069\u0070\u0074or\u002e\u0020\u0066\u006f\u006e\u0074\u003d%\u0073",_gfefg );
|
||
return nil ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_dga *PdfActionGoTo3DView )ToPdfObject ()_fg .PdfObject {_dga .PdfAction .ToPdfObject ();_aeb :=_dga ._bda ;_deg :=_aeb .PdfObject .(*_fg .PdfObjectDictionary );_deg .SetIfNotNil ("\u0053",_fg .MakeName (string (ActionTypeGoTo3DView )));_deg .SetIfNotNil ("\u0054\u0041",_dga .TA );
|
||
_deg .SetIfNotNil ("\u0056",_dga .V );return _aeb ;};
|
||
|
||
// ToPdfObject returns a *PdfIndirectObject containing a *PdfObjectArray representation of the DeviceN colorspace.
|
||
/*
|
||
Format: [/DeviceN names alternateSpace tintTransform]
|
||
or: [/DeviceN names alternateSpace tintTransform attributes]
|
||
*/
|
||
func (_bdace *PdfColorspaceDeviceN )ToPdfObject ()_fg .PdfObject {_gcbd :=_fg .MakeArray (_fg .MakeName ("\u0044e\u0076\u0069\u0063\u0065\u004e"));_gcbd .Append (_bdace .ColorantNames );_gcbd .Append (_bdace .AlternateSpace .ToPdfObject ());_gcbd .Append (_bdace .TintTransform .ToPdfObject ());
|
||
if _bdace .Attributes !=nil {_gcbd .Append (_bdace .Attributes .ToPdfObject ());};if _bdace ._cggda !=nil {_bdace ._cggda .PdfObject =_gcbd ;return _bdace ._cggda ;};return _gcbd ;};
|
||
|
||
// SetCatalogMetadata sets the catalog metadata (XMP) stream object.
|
||
func (_dggd *PdfWriter )SetCatalogMetadata (meta _fg .PdfObject )error {if meta ==nil {_dggd ._cgacf .Remove ("\u004d\u0065\u0074\u0061\u0064\u0061\u0074\u0061");return nil ;};_febad ,_agaefc :=_fg .GetStream (meta );if !_agaefc {return _ce .New ("\u0063\u0061\u0074\u0061\u006c\u006f\u0067\u0020\u006d\u0065\u0074\u0061\u0064a\u0074\u0061\u0020\u006d\u0075\u0073t\u0020\u0062\u0065\u0020\u0061\u0020\u0076\u0061\u006c\u0069\u0064\u0020\u0073t\u0072\u0065\u0061\u006d");
|
||
};_dggd .addObject (_febad );_dggd ._cgacf .Set ("\u004d\u0065\u0074\u0061\u0064\u0061\u0074\u0061",_febad );return nil ;};
|
||
|
||
// NewDSS returns a new DSS dictionary.
|
||
func NewDSS ()*DSS {return &DSS {_gbaf :_fg .MakeIndirectObject (_fg .MakeDict ()),VRI :map[string ]*VRI {}};};
|
||
|
||
// GetAction returns the PDF action for the annotation link.
|
||
func (_fagc *PdfAnnotationLink )GetAction ()(*PdfAction ,error ){if _fagc ._efc !=nil {return _fagc ._efc ,nil ;};if _fagc .A ==nil {return nil ,nil ;};if _fagc ._abag ==nil {return nil ,nil ;};_fedf ,_agbf :=_fagc ._abag .loadAction (_fagc .A );if _agbf !=nil {return nil ,_agbf ;
|
||
};_fagc ._efc =_fedf ;return _fagc ._efc ,nil ;};func (_bafag *pdfCIDFontType2 )getFontDescriptor ()*PdfFontDescriptor {return _bafag ._cdgef };
|
||
|
||
// SetDSS sets the DSS dictionary (ETSI TS 102 778-4 V1.1.1) of the current
|
||
// document revision.
|
||
func (_becc *PdfAppender )SetDSS (dss *DSS ){if dss !=nil {_becc .updateObjectsDeep (dss .ToPdfObject (),nil );};_becc ._dgbf =dss ;};
|
||
|
||
// PdfFieldSignature signature field represents digital signatures and optional data for authenticating
|
||
// the name of the signer and verifying document contents.
|
||
type PdfFieldSignature struct{*PdfField ;*PdfAnnotationWidget ;V *PdfSignature ;Lock *_fg .PdfIndirectObject ;SV *_fg .PdfIndirectObject ;};
|
||
|
||
// GetNumComponents returns the number of color components (1 for Indexed).
|
||
func (_fedb *PdfColorspaceSpecialIndexed )GetNumComponents ()int {return 1};
|
||
|
||
// PdfInfoTrapped specifies pdf trapped information.
|
||
type PdfInfoTrapped string ;
|
||
|
||
// DecodeArray returns the component range values for the Separation colorspace.
|
||
func (_fdcfg *PdfColorspaceSpecialSeparation )DecodeArray ()[]float64 {return []float64 {0,1.0}};
|
||
|
||
// ToPdfObject converts the pdfCIDFontType2 to a PDF representation.
|
||
func (_dgdcc *pdfCIDFontType2 )ToPdfObject ()_fg .PdfObject {if _dgdcc ._dbedf ==nil {_dgdcc ._dbedf =&_fg .PdfIndirectObject {};};_efag :=_dgdcc .baseFields ().asPdfObjectDictionary ("\u0043\u0049\u0044F\u006f\u006e\u0074\u0054\u0079\u0070\u0065\u0032");
|
||
_dgdcc ._dbedf .PdfObject =_efag ;if _dgdcc .CIDSystemInfo !=nil {_efag .Set ("\u0043\u0049\u0044\u0053\u0079\u0073\u0074\u0065\u006d\u0049\u006e\u0066\u006f",_dgdcc .CIDSystemInfo );};if _dgdcc .DW !=nil {_efag .Set ("\u0044\u0057",_dgdcc .DW );};if _dgdcc .DW2 !=nil {_efag .Set ("\u0044\u0057\u0032",_dgdcc .DW2 );
|
||
};if _dgdcc .W !=nil {_efag .Set ("\u0057",_dgdcc .W );};if _dgdcc .W2 !=nil {_efag .Set ("\u0057\u0032",_dgdcc .W2 );};if _dgdcc .CIDToGIDMap !=nil {_efag .Set ("C\u0049\u0044\u0054\u006f\u0047\u0049\u0044\u004d\u0061\u0070",_dgdcc .CIDToGIDMap );};return _dgdcc ._dbedf ;
|
||
};type pdfFontSimple struct{fontCommon ;_ddbcd *_fg .PdfIndirectObject ;_fcgbd map[_dg .CharCode ]float64 ;_bdgda _dg .TextEncoder ;_fcad _dg .TextEncoder ;_fdfca *PdfFontDescriptor ;
|
||
|
||
// Encoding is subject to limitations that are described in 9.6.6, "Character Encoding".
|
||
// BaseFont is derived differently.
|
||
FirstChar _fg .PdfObject ;LastChar _fg .PdfObject ;Widths _fg .PdfObject ;Encoding _fg .PdfObject ;_dacg *_eed .RuneCharSafeMap ;};
|
||
|
||
// PdfFunction interface represents the common methods of a function in PDF.
|
||
type PdfFunction interface{Evaluate ([]float64 )([]float64 ,error );ToPdfObject ()_fg .PdfObject ;};
|
||
|
||
// GetNameDictionary returns the Names entry in the PDF catalog.
|
||
// See section 7.7.4 "Name Dictionary" (p. 80 PDF32000_2008).
|
||
func (_ddacc *PdfReader )GetNameDictionary ()(_fg .PdfObject ,error ){_eecde :=_fg .ResolveReference (_ddacc ._cgegd .Get ("\u004e\u0061\u006de\u0073"));if _eecde ==nil {return nil ,nil ;};if !_ddacc ._beegg {_gcdfe :=_ddacc .traverseObjectData (_eecde );
|
||
if _gcdfe !=nil {return nil ,_gcdfe ;};};return _eecde ,nil ;};
|
||
|
||
// PdfAnnotationPrinterMark represents PrinterMark annotations.
|
||
// (Section 12.5.6.20).
|
||
type PdfAnnotationPrinterMark struct{*PdfAnnotation ;MN _fg .PdfObject ;};func _gcbgc (_adba *[]*PdfField ,_daada FieldFilterFunc ,_cdadg bool )[]*PdfField {if _adba ==nil {return nil ;};_gadg :=*_adba ;if len (*_adba )==0{return nil ;};_eggeg :=_gadg [:0];
|
||
if _daada ==nil {_daada =func (*PdfField )bool {return true };};var _ecff []*PdfField ;for _ ,_dccba :=range _gadg {_afgfc :=_daada (_dccba );if _afgfc {_ecff =append (_ecff ,_dccba );if len (_dccba .Kids )> 0{_ecff =append (_ecff ,_gcbgc (&_dccba .Kids ,_daada ,_cdadg )...);
|
||
};};if !_cdadg ||!_afgfc ||len (_dccba .Kids )> 0{_eggeg =append (_eggeg ,_dccba );};};*_adba =_eggeg ;return _ecff ;};
|
||
|
||
// Enable LTV enables the specified signature. The signing certificate
|
||
// chain is extracted from the signature dictionary. Optionally, additional
|
||
// certificates can be specified through the `extraCerts` parameter.
|
||
// The LTV client attempts to build the certificate chain up to a trusted root
|
||
// by downloading any missing certificates.
|
||
func (_dege *LTV )Enable (sig *PdfSignature ,extraCerts []*_ge .Certificate )error {if _dfff :=_dege .validateSig (sig );_dfff !=nil {return _dfff ;};_gdbede ,_fagce :=_dege .generateVRIKey (sig );if _fagce !=nil {return _fagce ;};if _ ,_ebgcb :=_dege ._ebbe .VRI [_gdbede ];
|
||
_ebgcb &&_dege .SkipExisting {return nil ;};_afaca ,_fagce :=sig .GetCerts ();if _fagce !=nil {return _fagce ;};return _dege .enable (_afaca ,extraCerts ,_gdbede );};
|
||
|
||
// SignatureValidationResult defines the response from the signature validation handler.
|
||
type SignatureValidationResult struct{
|
||
|
||
// List of errors when validating the signature.
|
||
Errors []string ;IsSigned bool ;IsVerified bool ;IsTrusted bool ;Fields []*PdfField ;Name string ;Date PdfDate ;Reason string ;Location string ;ContactInfo string ;DiffResults *_gbb .DiffResults ;IsCrlFound bool ;IsOcspFound bool ;
|
||
|
||
// GeneralizedTime is the time at which the time-stamp token has been created by the TSA (RFC 3161).
|
||
GeneralizedTime _g .Time ;};func (_fagd *PdfColorspaceLab )String ()string {return "\u004c\u0061\u0062"};
|
||
|
||
// BaseFont returns the font's "BaseFont" field.
|
||
func (_eegg *PdfFont )BaseFont ()string {return _eegg .baseFields ()._aefg };
|
||
|
||
// SetShadingByName sets a shading resource specified by keyName.
|
||
func (_facef *PdfPageResources )SetShadingByName (keyName _fg .PdfObjectName ,shadingObj _fg .PdfObject )error {if _facef .Shading ==nil {_facef .Shading =_fg .MakeDict ();};_adbge ,_ggedfb :=_fg .GetDict (_facef .Shading );if !_ggedfb {return _fg .ErrTypeError ;
|
||
};_adbge .Set (keyName ,shadingObj );return nil ;};func (_bbcfc *PdfReader )loadStructure ()error {if _bbcfc ._ccgg .GetCrypter ()!=nil &&!_bbcfc ._ccgg .IsAuthenticated (){return _d .Errorf ("\u0066\u0069\u006ce\u0020\u006e\u0065\u0065d\u0020\u0074\u006f\u0020\u0062\u0065\u0020d\u0065\u0063\u0072\u0079\u0070\u0074\u0065\u0064\u0020\u0066\u0069\u0072\u0073\u0074");
|
||
};_adeda :=_bbcfc ._ccgg .GetTrailer ();if _adeda ==nil {return _d .Errorf ("\u006di\u0073s\u0069\u006e\u0067\u0020\u0074\u0072\u0061\u0069\u006c\u0065\u0072");};_cfcfc ,_cbdab :=_adeda .Get ("\u0052\u006f\u006f\u0074").(*_fg .PdfObjectReference );if !_cbdab {return _d .Errorf ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0052\u006f\u006ft\u0020\u0028\u0074\u0072\u0061\u0069\u006c\u0065\u0072\u003a \u0025\u0073\u0029",_adeda );
|
||
};_ggeaa ,_gdad :=_bbcfc ._ccgg .LookupByReference (*_cfcfc );if _gdad !=nil {_aa .Log .Debug ("\u0045\u0052R\u004f\u0052\u003a\u0020\u0046\u0061\u0069\u006c\u0065\u0064\u0020\u0074\u006f\u0020\u0072\u0065\u0061\u0064\u0020\u0072\u006f\u006f\u0074\u0020\u0065\u006c\u0065\u006d\u0065\u006e\u0074\u0020\u0063\u0061\u0074\u0061\u006c\u006f\u0067\u003a\u0020\u0025\u0073",_gdad );
|
||
return _gdad ;};_ffefe ,_cbdab :=_ggeaa .(*_fg .PdfIndirectObject );if !_cbdab {_aa .Log .Debug ("\u0045\u0052R\u004f\u0052\u003a\u0020\u004d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0063\u0061\u0074\u0061\u006c\u006f\u0067\u003a\u0020\u0028\u0072\u006f\u006f\u0074\u0020\u0025\u0071\u0029\u0020\u0028\u0074\u0072\u0061\u0069\u006c\u0065\u0072\u0020\u0025\u0073\u0029",_ggeaa ,*_adeda );
|
||
return _ce .New ("\u006di\u0073s\u0069\u006e\u0067\u0020\u0063\u0061\u0074\u0061\u006c\u006f\u0067");};_fgade ,_cbdab :=(*_ffefe ).PdfObject .(*_fg .PdfObjectDictionary );if !_cbdab {_aa .Log .Debug ("E\u0052\u0052\u004f\u0052\u003a\u0020I\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0063\u0061t\u0061\u006c\u006fg\u0020(\u0025\u0073\u0029",_ffefe .PdfObject );
|
||
return _ce .New ("\u0069n\u0076a\u006c\u0069\u0064\u0020\u0063\u0061\u0074\u0061\u006c\u006f\u0067");};_aa .Log .Trace ("C\u0061\u0074\u0061\u006c\u006f\u0067\u003a\u0020\u0025\u0073",_fgade );_fggda ,_cbdab :=_fgade .Get ("\u0050\u0061\u0067e\u0073").(*_fg .PdfObjectReference );
|
||
if !_cbdab {return _ce .New ("\u0070\u0061\u0067\u0065\u0073\u0020\u0069\u006e\u0020\u0063\u0061\u0074\u0061\u006c\u006f\u0067\u0020\u0073\u0068\u006f\u0075\u006c\u0064\u0020b\u0065\u0020\u0061\u0020\u0072e\u0066\u0065r\u0065\u006e\u0063\u0065");};_fgcdc ,_gdad :=_bbcfc ._ccgg .LookupByReference (*_fggda );
|
||
if _gdad !=nil {_aa .Log .Debug ("E\u0052\u0052\u004f\u0052\u003a\u0020F\u0061\u0069\u006c\u0065\u0064\u0020\u0074\u006f\u0020r\u0065\u0061\u0064 \u0070a\u0067\u0065\u0073");return _gdad ;};_gbgff ,_cbdab :=_fgcdc .(*_fg .PdfIndirectObject );if !_cbdab {_aa .Log .Debug ("E\u0052\u0052\u004f\u0052\u003a\u0020P\u0061\u0067\u0065\u0073\u0020\u006f\u0062\u006a\u0065c\u0074\u0020\u0069n\u0076a\u006c\u0069\u0064");
|
||
_aa .Log .Debug ("\u006f\u0070\u003a\u0020\u0025\u0070",_gbgff );return _ce .New ("p\u0061g\u0065\u0073\u0020\u006f\u0062\u006a\u0065\u0063t\u0020\u0069\u006e\u0076al\u0069\u0064");};_fdccf ,_cbdab :=_gbgff .PdfObject .(*_fg .PdfObjectDictionary );if !_cbdab {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0050\u0061\u0067\u0065\u0073\u0020\u006f\u0062j\u0065c\u0074\u0020\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0028\u0025\u0073\u0029",_gbgff );
|
||
return _ce .New ("p\u0061g\u0065\u0073\u0020\u006f\u0062\u006a\u0065\u0063t\u0020\u0069\u006e\u0076al\u0069\u0064");};_gcgfg ,_cbdab :=_fg .GetInt (_fdccf .Get ("\u0043\u006f\u0075n\u0074"));if !_cbdab {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a \u0050\u0061\u0067\u0065\u0073\u0020\u0063\u006f\u0075\u006e\u0074\u0020\u006fb\u006a\u0065\u0063\u0074\u0020\u0069\u006ev\u0061\u006c\u0069\u0064");
|
||
return _ce .New ("\u0070\u0061\u0067\u0065s \u0063\u006f\u0075\u006e\u0074\u0020\u0069\u006e\u0076\u0061\u006c\u0069\u0064");};if _ ,_cbdab =_fg .GetName (_fdccf .Get ("\u0054\u0079\u0070\u0065"));!_cbdab {_aa .Log .Debug ("\u0050\u0061\u0067\u0065\u0073\u0020\u0064\u0069\u0063\u0074\u0020T\u0079\u0070\u0065\u0020\u0066\u0069\u0065\u006cd\u0020n\u006f\u0074\u0020\u0073\u0065\u0074\u002e\u0020\u0053\u0065\u0074\u0074\u0069\u006e\u0067\u0020\u0054\u0079p\u0065\u0020\u0074\u006f\u0020\u0050\u0061\u0067\u0065\u0073\u002e");
|
||
_fdccf .Set ("\u0054\u0079\u0070\u0065",_fg .MakeName ("\u0050\u0061\u0067e\u0073"));};if _bcdebe ,_face :=_fg .GetInt (_fdccf .Get ("\u0052\u006f\u0074\u0061\u0074\u0065"));_face {_fdece :=int64 (*_bcdebe );_bbcfc .Rotate =&_fdece ;};_bbcfc ._degeg =_cfcfc ;
|
||
_bbcfc ._cgegd =_fgade ;_bbcfc ._efgae =_fdccf ;_bbcfc ._ecef =_gbgff ;_bbcfc ._befaa =int (*_gcgfg );_bbcfc ._bgce =[]*_fg .PdfIndirectObject {};_gbaed :=map[_fg .PdfObject ]struct{}{};_gdad =_bbcfc .buildPageList (_gbgff ,nil ,_gbaed );if _gdad !=nil {return _gdad ;
|
||
};_aa .Log .Trace ("\u002d\u002d\u002d");_aa .Log .Trace ("\u0054\u004f\u0043");_aa .Log .Trace ("\u0050\u0061\u0067e\u0073");_aa .Log .Trace ("\u0025\u0064\u003a\u0020\u0025\u0073",len (_bbcfc ._bgce ),_bbcfc ._bgce );_bbcfc ._cfac ,_gdad =_bbcfc .loadOutlines ();
|
||
if _gdad !=nil {_aa .Log .Debug ("E\u0052\u0052\u004f\u0052\u003a\u0020\u0046\u0061\u0069\u006c\u0065\u0064\u0020\u0074\u006f\u0020\u0062\u0075i\u006c\u0064\u0020\u006f\u0075\u0074\u006c\u0069\u006e\u0065 t\u0072\u0065\u0065 \u0028%\u0073\u0029",_gdad );
|
||
return _gdad ;};_bbcfc .AcroForm ,_gdad =_bbcfc .loadForms ();if _gdad !=nil {return _gdad ;};_bbcfc .DSS ,_gdad =_bbcfc .loadDSS ();if _gdad !=nil {return _gdad ;};_bbcfc ._eadc ,_gdad =_bbcfc .loadPerms ();if _gdad !=nil {return _gdad ;};return nil ;
|
||
};func (_aeda *PdfColorspaceSpecialPattern )String ()string {return "\u0050a\u0074\u0074\u0065\u0072\u006e";};
|
||
|
||
// C returns the value of the cyan component of the color.
|
||
func (_gagc *PdfColorDeviceCMYK )C ()float64 {return _gagc [0]};
|
||
|
||
// HasColorspaceByName checks if the colorspace with the specified name exists in the page resources.
|
||
func (_dbfg *PdfPageResources )HasColorspaceByName (keyName _fg .PdfObjectName )bool {_faee ,_dbfgf :=_dbfg .GetColorspaces ();if _dbfgf !=nil {_aa .Log .Debug ("\u0045\u0052R\u004f\u0052\u0020\u0067\u0065\u0074\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072\u0073\u0070\u0072\u0061\u0063\u0065: \u0025\u0076",_dbfgf );
|
||
return false ;};if _faee ==nil {return false ;};_ ,_bbbca :=_faee .Colorspaces [string (keyName )];return _bbbca ;};
|
||
|
||
// PdfColor interface represents a generic color in PDF.
|
||
type PdfColor interface{};
|
||
|
||
// StandardApplier is the interface that performs optimization of the whole PDF document.
|
||
// As a result an input document is being changed by the optimizer.
|
||
// The writer than takes back all it's parts and overwrites it.
|
||
// NOTE: This implementation is in experimental development state.
|
||
// Keep in mind that it might change in the subsequent minor versions.
|
||
type StandardApplier interface{ApplyStandard (_ffgc *_dab .Document )error ;};
|
||
|
||
// GetOutlineTree returns the outline tree.
|
||
func (_addgb *PdfReader )GetOutlineTree ()*PdfOutlineTreeNode {return _addgb ._cfac };
|
||
|
||
// PdfColorDeviceGray represents a grayscale color value that shall be represented by a single number in the
|
||
// range 0.0 to 1.0 where 0.0 corresponds to black and 1.0 to white.
|
||
type PdfColorDeviceGray float64 ;
|
||
|
||
// NewPdfAnnotationFreeText returns a new free text annotation.
|
||
func NewPdfAnnotationFreeText ()*PdfAnnotationFreeText {_edb :=NewPdfAnnotation ();_gccc :=&PdfAnnotationFreeText {};_gccc .PdfAnnotation =_edb ;_gccc .PdfAnnotationMarkup =&PdfAnnotationMarkup {};_edb .SetContext (_gccc );return _gccc ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_bfaa *PdfAnnotationLink )ToPdfObject ()_fg .PdfObject {_bfaa .PdfAnnotation .ToPdfObject ();_cagg :=_bfaa ._agb ;_gcbb :=_cagg .PdfObject .(*_fg .PdfObjectDictionary );_gcbb .SetIfNotNil ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u004c\u0069\u006e\u006b"));
|
||
if _bfaa ._efc !=nil &&_bfaa ._efc ._bd !=nil {_gcbb .Set ("\u0041",_bfaa ._efc ._bd .ToPdfObject ());}else if _bfaa .A !=nil {_gcbb .Set ("\u0041",_bfaa .A );};_gcbb .SetIfNotNil ("\u0044\u0065\u0073\u0074",_bfaa .Dest );_gcbb .SetIfNotNil ("\u0048",_bfaa .H );
|
||
_gcbb .SetIfNotNil ("\u0050\u0041",_bfaa .PA );_gcbb .SetIfNotNil ("\u0051\u0075\u0061\u0064\u0050\u006f\u0069\u006e\u0074\u0073",_bfaa .QuadPoints );_gcbb .SetIfNotNil ("\u0042\u0053",_bfaa .BS );return _cagg ;};
|
||
|
||
// SetColorspaceByName adds the provided colorspace to the page resources.
|
||
func (_dddge *PdfPageResources )SetColorspaceByName (keyName _fg .PdfObjectName ,cs PdfColorspace )error {_bagcd ,_fbeae :=_dddge .GetColorspaces ();if _fbeae !=nil {_aa .Log .Debug ("\u0045\u0052R\u004f\u0052\u0020\u0067\u0065\u0074\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072\u0073\u0070\u0072\u0061\u0063\u0065: \u0025\u0076",_fbeae );
|
||
return _fbeae ;};if _bagcd ==nil {_bagcd =NewPdfPageResourcesColorspaces ();_dddge .SetColorSpace (_bagcd );};_bagcd .Set (keyName ,cs );return nil ;};func (_gcdgb *PdfWriter )setWriter (_eacba _ff .Writer ){_gcdgb ._fcgga =_gcdgb ._beddc ;_gcdgb ._dbdde =_da .NewWriter (_eacba );
|
||
};
|
||
|
||
// PdfOutline represents a PDF outline dictionary (Table 152 - p. 376).
|
||
type PdfOutline struct{PdfOutlineTreeNode ;Parent *PdfOutlineTreeNode ;Count *int64 ;_adece *_fg .PdfIndirectObject ;};
|
||
|
||
// PartialName returns the partial name of the field.
|
||
func (_ecge *PdfField )PartialName ()string {_bbb :="";if _ecge .T !=nil {_bbb =_ecge .T .Decoded ();}else {_aa .Log .Debug ("\u0046\u0069el\u0064\u0020\u006di\u0073\u0073\u0069\u006eg T\u0020fi\u0065\u006c\u0064\u0020\u0028\u0069\u006eco\u006d\u0070\u0061\u0074\u0069\u0062\u006ce\u0029");
|
||
};return _bbb ;};
|
||
|
||
// PdfFunctionType4 is a Postscript calculator functions.
|
||
type PdfFunctionType4 struct{Domain []float64 ;Range []float64 ;Program *_bc .PSProgram ;_babdc *_bc .PSExecutor ;_dedbd []byte ;_dega *_fg .PdfObjectStream ;};
|
||
|
||
// PdfAnnotationLink represents Link annotations.
|
||
// (Section 12.5.6.5 p. 403).
|
||
type PdfAnnotationLink struct{*PdfAnnotation ;A _fg .PdfObject ;Dest _fg .PdfObject ;H _fg .PdfObject ;PA _fg .PdfObject ;QuadPoints _fg .PdfObject ;BS _fg .PdfObject ;_efc *PdfAction ;_abag *PdfReader ;};
|
||
|
||
// ToPdfObject converts colorspace to a PDF object. [/Indexed base hival lookup]
|
||
func (_agcbb *PdfColorspaceSpecialIndexed )ToPdfObject ()_fg .PdfObject {_bfae :=_fg .MakeArray (_fg .MakeName ("\u0049n\u0064\u0065\u0078\u0065\u0064"));_bfae .Append (_agcbb .Base .ToPdfObject ());_bfae .Append (_fg .MakeInteger (int64 (_agcbb .HiVal )));
|
||
_bfae .Append (_agcbb .Lookup );if _agcbb ._gfeg !=nil {_agcbb ._gfeg .PdfObject =_bfae ;return _agcbb ._gfeg ;};return _bfae ;};
|
||
|
||
// String returns a string that describes `base`.
|
||
func (_gbaec fontCommon )String ()string {return _d .Sprintf ("\u0046\u004f\u004e\u0054\u007b\u0025\u0073\u007d",_gbaec .coreString ());};
|
||
|
||
// GetContainingPdfObject implements interface PdfModel.
|
||
func (_bece *PdfFilespec )GetContainingPdfObject ()_fg .PdfObject {return _bece ._ccbdc };
|
||
|
||
// BorderEffect represents a border effect (Table 167 p. 395).
|
||
type BorderEffect int ;
|
||
|
||
// NewImageFromGoImage creates a new NRGBA32 unidoc Image from a golang Image.
|
||
// If `goimg` is grayscale (*goimage.Gray8) then calls NewGrayImageFromGoImage instead.
|
||
func (_dfced DefaultImageHandler )NewImageFromGoImage (goimg _ac .Image )(*Image ,error ){_cbeba ,_bbcfa :=_cc .FromGoImage (goimg );if _bbcfa !=nil {return nil ,_bbcfa ;};_aaagf :=_adad (_cbeba .Base ());return &_aaagf ,nil ;};
|
||
|
||
// Clear clears flag fl from the flag and returns the resulting flag.
|
||
func (_efbgd FieldFlag )Clear (fl FieldFlag )FieldFlag {return FieldFlag (_efbgd .Mask ()&^fl .Mask ())};
|
||
|
||
// GetCharMetrics returns the char metrics for character code `code`.
|
||
func (_cgbgf pdfCIDFontType2 )GetCharMetrics (code _dg .CharCode )(_eed .CharMetrics ,bool ){if _bdae ,_egbg :=_cgbgf ._dbgce [code ];_egbg {return _eed .CharMetrics {Wx :_bdae },true ;};_caggg :=rune (code );_eaffg ,_faae :=_cgbgf ._ebda [_caggg ];if !_faae {_eaffg =int (_cgbgf ._gagd );
|
||
};return _eed .CharMetrics {Wx :float64 (_eaffg )},true ;};var _beab =map[string ]struct{}{"\u0046\u0054":{},"\u004b\u0069\u0064\u0073":{},"\u0054":{},"\u0054\u0055":{},"\u0054\u004d":{},"\u0046\u0066":{},"\u0056":{},"\u0044\u0056":{},"\u0041\u0041":{},"\u0044\u0041":{},"\u0051":{},"\u0044\u0053":{},"\u0052\u0056":{}};
|
||
func _bcdga (_fggge *fontCommon )*pdfCIDFontType0 {return &pdfCIDFontType0 {fontCommon :*_fggge }};
|
||
|
||
// GetPdfInfo returns the PDF info dictionary.
|
||
func (_fefgee *PdfReader )GetPdfInfo ()(*PdfInfo ,error ){_cebgc ,_bfcg :=_fefgee .GetTrailer ();if _bfcg !=nil {return nil ,_bfcg ;};var _cbdb *_fg .PdfObjectDictionary ;_ggeag :=_cebgc .Get ("\u0049\u006e\u0066\u006f");switch _beegf :=_ggeag .(type ){case *_fg .PdfObjectReference :_afabb :=_beegf ;
|
||
_ggeag ,_bfcg =_fefgee .GetIndirectObjectByNumber (int (_afabb .ObjectNumber ));_ggeag =_fg .TraceToDirectObject (_ggeag );if _bfcg !=nil {return nil ,_bfcg ;};_cbdb ,_ =_ggeag .(*_fg .PdfObjectDictionary );case *_fg .PdfObjectDictionary :_cbdb =_beegf ;
|
||
};if _cbdb ==nil {return nil ,_ce .New ("I\u006e\u0066\u006f\u0020\u0064\u0069c\u0074\u0069\u006f\u006e\u0061\u0072\u0079\u0020\u006eo\u0074\u0020\u0070r\u0065s\u0065\u006e\u0074");};_fcefc ,_bfcg :=NewPdfInfoFromObject (_cbdb );if _bfcg !=nil {return nil ,_bfcg ;
|
||
};return _fcefc ,nil ;};
|
||
|
||
// ToPdfObject converts the pdfFontSimple to its PDF representation for outputting.
|
||
func (_bddccf *pdfFontSimple )ToPdfObject ()_fg .PdfObject {if _bddccf ._ddbcd ==nil {_bddccf ._ddbcd =&_fg .PdfIndirectObject {};};_ffbbe :=_bddccf .baseFields ().asPdfObjectDictionary ("");_bddccf ._ddbcd .PdfObject =_ffbbe ;if _bddccf .FirstChar !=nil {_ffbbe .Set ("\u0046i\u0072\u0073\u0074\u0043\u0068\u0061r",_bddccf .FirstChar );
|
||
};if _bddccf .LastChar !=nil {_ffbbe .Set ("\u004c\u0061\u0073\u0074\u0043\u0068\u0061\u0072",_bddccf .LastChar );};if _bddccf .Widths !=nil {_ffbbe .Set ("\u0057\u0069\u0064\u0074\u0068\u0073",_bddccf .Widths );};if _bddccf .Encoding !=nil {_ffbbe .Set ("\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067",_bddccf .Encoding );
|
||
}else if _bddccf ._bdgda !=nil {_aacbc :=_bddccf ._bdgda .ToPdfObject ();if _aacbc !=nil {_ffbbe .Set ("\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067",_aacbc );};};return _bddccf ._ddbcd ;};
|
||
|
||
// PdfActionSound represents a sound action.
|
||
type PdfActionSound struct{*PdfAction ;Sound _fg .PdfObject ;Volume _fg .PdfObject ;Synchronous _fg .PdfObject ;Repeat _fg .PdfObject ;Mix _fg .PdfObject ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_acg *PdfActionTrans )ToPdfObject ()_fg .PdfObject {_acg .PdfAction .ToPdfObject ();_ddg :=_acg ._bda ;_agfg :=_ddg .PdfObject .(*_fg .PdfObjectDictionary );_agfg .SetIfNotNil ("\u0053",_fg .MakeName (string (ActionTypeTrans )));_agfg .SetIfNotNil ("\u0054\u0072\u0061n\u0073",_acg .Trans );
|
||
return _ddg ;};
|
||
|
||
// PdfActionGoTo represents a GoTo action.
|
||
type PdfActionGoTo struct{*PdfAction ;D _fg .PdfObject ;};
|
||
|
||
// GetContainingPdfObject gets the primitive used to parse the color space.
|
||
func (_dbfbe *PdfColorspaceICCBased )GetContainingPdfObject ()_fg .PdfObject {return _dbfbe ._cebf };
|
||
|
||
// IsTerminal returns true for terminal fields, false otherwise.
|
||
// Terminal fields are fields whose descendants are only widget annotations.
|
||
func (_edefeb *PdfField )IsTerminal ()bool {return len (_edefeb .Kids )==0};
|
||
|
||
// ToPdfObject returns the PDF representation of the shading pattern.
|
||
func (_gadgd *PdfShadingPatternType3 )ToPdfObject ()_fg .PdfObject {_gadgd .PdfPattern .ToPdfObject ();_gagfd :=_gadgd .getDict ();if _gadgd .Shading !=nil {_gagfd .Set ("\u0053h\u0061\u0064\u0069\u006e\u0067",_gadgd .Shading .ToPdfObject ());};if _gadgd .Matrix !=nil {_gagfd .Set ("\u004d\u0061\u0074\u0072\u0069\u0078",_gadgd .Matrix );
|
||
};if _gadgd .ExtGState !=nil {_gagfd .Set ("\u0045x\u0074\u0047\u0053\u0074\u0061\u0074e",_gadgd .ExtGState );};return _gadgd ._gaac ;};func _eddb (_efd *_fg .PdfObjectDictionary )(*PdfFieldButton ,error ){_gecca :=&PdfFieldButton {};_gecca .PdfField =NewPdfField ();
|
||
_gecca .PdfField .SetContext (_gecca );_gecca .Opt ,_ =_fg .GetArray (_efd .Get ("\u004f\u0070\u0074"));_gaabe :=NewPdfAnnotationWidget ();_gaabe .A ,_ =_fg .GetDict (_efd .Get ("\u0041"));_gaabe .AP ,_ =_fg .GetDict (_efd .Get ("\u0041\u0050"));_gaabe .SetContext (_gecca );
|
||
_gecca .PdfField .Annotations =append (_gecca .PdfField .Annotations ,_gaabe );return _gecca ,nil ;};
|
||
|
||
// GetType returns the button field type which returns one of the following
|
||
// - PdfFieldButtonPush for push button fields
|
||
// - PdfFieldButtonCheckbox for checkbox fields
|
||
// - PdfFieldButtonRadio for radio button fields
|
||
func (_bbce *PdfFieldButton )GetType ()ButtonType {_eadfd :=ButtonTypeCheckbox ;if _bbce .Ff !=nil {if (uint32 (*_bbce .Ff )&FieldFlagPushbutton .Mask ())> 0{_eadfd =ButtonTypePush ;}else if (uint32 (*_bbce .Ff )&FieldFlagRadio .Mask ())> 0{_eadfd =ButtonTypeRadio ;
|
||
};};return _eadfd ;};
|
||
|
||
// RemovePage removes a page by number.
|
||
func (_bfac *PdfAppender )RemovePage (pageNum int ){_gdea :=pageNum -1;_bfac ._agbg =append (_bfac ._agbg [0:_gdea ],_bfac ._agbg [pageNum :]...);};func _aedae (_afca StdFontName )(pdfFontSimple ,error ){_fgcff ,_dfde :=_eed .NewStdFontByName (_afca );
|
||
if !_dfde {return pdfFontSimple {},ErrFontNotSupported ;};_ebga :=_dfebg (_fgcff );return _ebga ,nil ;};var ErrColorOutOfRange =_ce .New ("\u0063o\u006co\u0072\u0020\u006f\u0075\u0074 \u006f\u0066 \u0072\u0061\u006e\u0067\u0065");
|
||
|
||
// PdfActionImportData represents a importData action.
|
||
type PdfActionImportData struct{*PdfAction ;F *PdfFilespec ;};
|
||
|
||
// GetContainingPdfObject returns the container of the outline item (indirect object).
|
||
func (_cbcba *PdfOutlineItem )GetContainingPdfObject ()_fg .PdfObject {return _cbcba ._aeadb };
|
||
|
||
// PageCallback callback function used in page loading
|
||
// that could be used to modify the page content.
|
||
//
|
||
// Deprecated: will be removed in v4. Use PageProcessCallback instead.
|
||
type PageCallback func (_debcd int ,_ebgfa *PdfPage );func (_fcdgd *PdfReader )loadDSS ()(*DSS ,error ){if _fcdgd ._ccgg .GetCrypter ()!=nil &&!_fcdgd ._ccgg .IsAuthenticated (){return nil ,_d .Errorf ("\u0066\u0069\u006ce\u0020\u006e\u0065\u0065d\u0020\u0074\u006f\u0020\u0062\u0065\u0020d\u0065\u0063\u0072\u0079\u0070\u0074\u0065\u0064\u0020\u0066\u0069\u0072\u0073\u0074");
|
||
};_gfaedg :=_fcdgd ._cgegd .Get ("\u0044\u0053\u0053");if _gfaedg ==nil {return nil ,nil ;};_fdgc ,_ :=_fg .GetIndirect (_gfaedg );_gfaedg =_fg .TraceToDirectObject (_gfaedg );switch _egbgf :=_gfaedg .(type ){case *_fg .PdfObjectNull :return nil ,nil ;
|
||
case *_fg .PdfObjectDictionary :return _afdd (_fdgc ,_egbgf );};return nil ,_d .Errorf ("i\u006ev\u0061\u006c\u0069\u0064\u0020\u0044\u0053\u0053 \u0065\u006e\u0074\u0072y \u0025\u0054",_gfaedg );};func (_ccgb *PdfReader )newPdfActionJavaScriptFromDict (_aefb *_fg .PdfObjectDictionary )(*PdfActionJavaScript ,error ){return &PdfActionJavaScript {JS :_aefb .Get ("\u004a\u0053")},nil ;
|
||
};func _beca (_bffc *_fg .PdfIndirectObject )(*PdfOutline ,error ){_gbbff ,_dfbdb :=_bffc .PdfObject .(*_fg .PdfObjectDictionary );if !_dfbdb {return nil ,_d .Errorf ("\u006f\u0075\u0074l\u0069\u006e\u0065\u0020o\u0062\u006a\u0065\u0063\u0074\u0020\u006eo\u0074\u0020\u0061\u0020\u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061\u0072\u0079");
|
||
};_ebaee :=NewPdfOutline ();if _dcabg :=_gbbff .Get ("\u0054\u0079\u0070\u0065");_dcabg !=nil {_cedf ,_fdgee :=_dcabg .(*_fg .PdfObjectName );if _fdgee {if *_cedf !="\u004f\u0075\u0074\u006c\u0069\u006e\u0065\u0073"{_aa .Log .Debug ("E\u0052\u0052\u004f\u0052\u0020\u0054y\u0070\u0065\u0020\u0021\u003d\u0020\u004f\u0075\u0074l\u0069\u006e\u0065s\u0020(\u0025\u0073\u0029",*_cedf );
|
||
};};};if _cbgb :=_gbbff .Get ("\u0043\u006f\u0075n\u0074");_cbgb !=nil {_acccc ,_ccedg :=_fg .GetNumberAsInt64 (_cbgb );if _ccedg !=nil {return nil ,_ccedg ;};_ebaee .Count =&_acccc ;};return _ebaee ,nil ;};
|
||
|
||
// GetContainingPdfObject returns the XObject Form's containing object (indirect object).
|
||
func (_bbggf *XObjectForm )GetContainingPdfObject ()_fg .PdfObject {return _bbggf ._bdage };
|
||
|
||
// GetObjectNums returns the object numbers of the PDF objects in the file
|
||
// Numbered objects are either indirect objects or stream objects.
|
||
// e.g. objNums := pdfReader.GetObjectNums()
|
||
// The underlying objects can then be accessed with
|
||
// pdfReader.GetIndirectObjectByNumber(objNums[0]) for the first available object.
|
||
func (_bebfa *PdfReader )GetObjectNums ()[]int {return _bebfa ._ccgg .GetObjectNums ()};
|
||
|
||
// SetRotation sets the rotation of all pages added to writer. The rotation is
|
||
// specified in degrees and must be a multiple of 90.
|
||
// The Rotate field of individual pages has priority over the global rotation.
|
||
func (_cggff *PdfWriter )SetRotation (rotate int64 )error {_ccge ,_fbbgfb :=_fg .GetDict (_cggff ._feccd );if !_fbbgfb {return ErrTypeCheck ;};_ccge .Set ("\u0052\u006f\u0074\u0061\u0074\u0065",_fg .MakeInteger (rotate ));return nil ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_cgc *PdfActionHide )ToPdfObject ()_fg .PdfObject {_cgc .PdfAction .ToPdfObject ();_fcc :=_cgc ._bda ;_bcb :=_fcc .PdfObject .(*_fg .PdfObjectDictionary );_bcb .SetIfNotNil ("\u0053",_fg .MakeName (string (ActionTypeHide )));_bcb .SetIfNotNil ("\u0054",_cgc .T );
|
||
_bcb .SetIfNotNil ("\u0048",_cgc .H );return _fcc ;};
|
||
|
||
// ContentStreamWrapper wraps the Page's contentstream into q ... Q blocks.
|
||
type ContentStreamWrapper interface{WrapContentStream (_eecb *PdfPage )error ;};var _ pdfFont =(*pdfCIDFontType0 )(nil );
|
||
|
||
// ToOutlineTree returns a low level PdfOutlineTreeNode object, based on
|
||
// the current instance.
|
||
func (_cbfbe *Outline )ToOutlineTree ()*PdfOutlineTreeNode {return &_cbfbe .ToPdfOutline ().PdfOutlineTreeNode ;};func (_bfbfb *PdfReader )newPdfAcroFormFromDict (_caeeg *_fg .PdfIndirectObject ,_bedg *_fg .PdfObjectDictionary )(*PdfAcroForm ,error ){_fdfgd :=NewPdfAcroForm ();
|
||
if _caeeg !=nil {_fdfgd ._daca =_caeeg ;_caeeg .PdfObject =_fg .MakeDict ();};if _eeebc :=_bedg .Get ("\u0046\u0069\u0065\u006c\u0064\u0073");_eeebc !=nil &&!_fg .IsNullObject (_eeebc ){_bgea ,_ebca :=_fg .GetArray (_eeebc );if !_ebca {return nil ,_d .Errorf ("\u0066i\u0065\u006c\u0064\u0073\u0020\u006e\u006f\u0074\u0020\u0061\u006e \u0061\u0072\u0072\u0061\u0079\u0020\u0028\u0025\u0054\u0029",_eeebc );
|
||
};var _edgbb []*PdfField ;for _ ,_bgcf :=range _bgea .Elements (){_cdac ,_edegdf :=_fg .GetIndirect (_bgcf );if !_edegdf {if _ ,_bbbgg :=_bgcf .(*_fg .PdfObjectNull );_bbbgg {_aa .Log .Trace ("\u0053k\u0069\u0070\u0070\u0069\u006e\u0067\u0020\u006f\u0076\u0065\u0072 \u006e\u0075\u006c\u006c\u0020\u0066\u0069\u0065\u006c\u0064");
|
||
continue ;};_aa .Log .Debug ("\u0046\u0069\u0065\u006c\u0064 \u006e\u006f\u0074\u0020\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0065\u0064 \u0069\u006e\u0020\u0069\u006e\u0064\u0069\u0072\u0065\u0063\u0074\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u0020\u0025\u0054",_bgcf );
|
||
return nil ,_d .Errorf ("\u0066\u0069\u0065l\u0064\u0020\u006e\u006ft\u0020\u0069\u006e\u0020\u0061\u006e\u0020i\u006e\u0064\u0069\u0072\u0065\u0063\u0074\u0020\u006f\u0062\u006a\u0065\u0063\u0074");};_bbeda ,_ddbf :=_bfbfb .newPdfFieldFromIndirectObject (_cdac ,nil );
|
||
if _ddbf !=nil {return nil ,_ddbf ;};_aa .Log .Trace ("\u0041\u0063\u0072\u006fFo\u0072\u006d\u0020\u0046\u0069\u0065\u006c\u0064\u003a\u0020\u0025\u002b\u0076",*_bbeda );_edgbb =append (_edgbb ,_bbeda );};_fdfgd .Fields =&_edgbb ;};if _cabf :=_bedg .Get ("\u004ee\u0065d\u0041\u0070\u0070\u0065\u0061\u0072\u0061\u006e\u0063\u0065\u0073");
|
||
_cabf !=nil {_daba ,_abae :=_fg .GetBool (_cabf );if _abae {_fdfgd .NeedAppearances =_daba ;}else {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u004e\u0065\u0065\u0064\u0041\u0070p\u0065\u0061\u0072\u0061\u006e\u0063e\u0073\u0020\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0028\u0067\u006ft\u0020\u0025\u0054\u0029",_cabf );
|
||
};};if _cfccf :=_bedg .Get ("\u0053\u0069\u0067\u0046\u006c\u0061\u0067\u0073");_cfccf !=nil {_gfbd ,_ddgc :=_fg .GetInt (_cfccf );if _ddgc {_fdfgd .SigFlags =_gfbd ;}else {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0053\u0069\u0067\u0046\u006c\u0061\u0067\u0073 \u0069n\u0076\u0061\u006c\u0069\u0064\u0020\u0028\u0067\u006f\u0074\u0020\u0025\u0054\u0029",_cfccf );
|
||
};};if _fcce :=_bedg .Get ("\u0043\u004f");_fcce !=nil {_bbdc ,_cacde :=_fg .GetArray (_fcce );if _cacde {_fdfgd .CO =_bbdc ;}else {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0043\u004f\u0020\u0069n\u0076\u0061\u006c\u0069\u0064\u0020\u0028\u0067\u006f\u0074 \u0025\u0054\u0029",_fcce );
|
||
};};if _abab :=_bedg .Get ("\u0044\u0052");_abab !=nil {if _fdfa ,_gdddg :=_fg .GetDict (_abab );_gdddg {_dbgac ,_dcee :=NewPdfPageResourcesFromDict (_fdfa );if _dcee !=nil {_aa .Log .Error ("\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0044R\u003a\u0020\u0025\u0076",_dcee );
|
||
return nil ,_dcee ;};_fdfgd .DR =_dbgac ;}else {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0044\u0052\u0020\u0069n\u0076\u0061\u006c\u0069\u0064\u0020\u0028\u0067\u006f\u0074 \u0025\u0054\u0029",_abab );};};if _dccgg :=_bedg .Get ("\u0044\u0041");
|
||
_dccgg !=nil {_edga ,_ffdg :=_fg .GetString (_dccgg );if _ffdg {_fdfgd .DA =_edga ;}else {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0044\u0041\u0020\u0069n\u0076\u0061\u006c\u0069\u0064\u0020\u0028\u0067\u006f\u0074 \u0025\u0054\u0029",_dccgg );
|
||
};};if _eedbf :=_bedg .Get ("\u0051");_eedbf !=nil {_gafa ,_ggbe :=_fg .GetInt (_eedbf );if _ggbe {_fdfgd .Q =_gafa ;}else {_aa .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a \u0051\u0020\u0069\u006e\u0076a\u006ci\u0064 \u0028\u0067\u006f\u0074\u0020\u0025\u0054)",_eedbf );
|
||
};};if _caccg :=_bedg .Get ("\u0058\u0046\u0041");_caccg !=nil {_fdfgd .XFA =_caccg ;};if _baged :=_bedg .Get ("\u0041\u0044\u0042\u0045\u005f\u0045\u0063\u0068\u006f\u0053\u0069\u0067\u006e");_baged !=nil {_fdfgd .ADBEEchoSign =_baged ;};_fdfgd .ToPdfObject ();
|
||
return _fdfgd ,nil ;};
|
||
|
||
// NewPdfColorCalGray returns a new CalGray color.
|
||
func NewPdfColorCalGray (grayVal float64 )*PdfColorCalGray {_eagdf :=PdfColorCalGray (grayVal );return &_eagdf ;};func _defgb (_gaagga _fg .PdfObject )(PdfFunction ,error ){_gaagga =_fg .ResolveReference (_gaagga );if _gfdbd ,_baaag :=_gaagga .(*_fg .PdfObjectStream );
|
||
_baaag {_cdfg :=_gfdbd .PdfObjectDictionary ;_dacbb ,_geaee :=_cdfg .Get ("\u0046\u0075\u006ec\u0074\u0069\u006f\u006e\u0054\u0079\u0070\u0065").(*_fg .PdfObjectInteger );if !_geaee {_aa .Log .Error ("F\u0075\u006e\u0063\u0074\u0069\u006fn\u0054\u0079\u0070\u0065\u0020\u006e\u0075\u006d\u0062e\u0072\u0020\u006di\u0073s\u0069\u006e\u0067");
|
||
return nil ,_ce .New ("\u0069\u006e\u0076\u0061l\u0069\u0064\u0020\u0070\u0061\u0072\u0061\u006d\u0065\u0074e\u0072 \u006f\u0072\u0020\u006d\u0069\u0073\u0073i\u006e\u0067");};if *_dacbb ==0{return _fbace (_gfdbd );}else if *_dacbb ==4{return _cfdcd (_gfdbd );
|
||
}else {return nil ,_ce .New ("i\u006e\u0076\u0061\u006cid\u0020f\u0075\u006e\u0063\u0074\u0069o\u006e\u0020\u0074\u0079\u0070\u0065");};}else if _decdf ,_fdgdf :=_gaagga .(*_fg .PdfIndirectObject );_fdgdf {_agegg ,_bbdb :=_decdf .PdfObject .(*_fg .PdfObjectDictionary );
|
||
if !_bbdb {_aa .Log .Error ("\u0046\u0075\u006e\u0063\u0074\u0069\u006f\u006e\u0020\u0049\u006e\u0064\u0069\u0072\u0065\u0063\u0074\u0020o\u0062\u006a\u0065\u0063\u0074\u0020\u006eo\u0074\u0020\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0069\u006eg\u0020\u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061\u0072\u0079");
|
||
return nil ,_ce .New ("\u0069\u006e\u0076\u0061l\u0069\u0064\u0020\u0070\u0061\u0072\u0061\u006d\u0065\u0074e\u0072 \u006f\u0072\u0020\u006d\u0069\u0073\u0073i\u006e\u0067");};_bbcbe ,_bbdb :=_agegg .Get ("\u0046\u0075\u006ec\u0074\u0069\u006f\u006e\u0054\u0079\u0070\u0065").(*_fg .PdfObjectInteger );
|
||
if !_bbdb {_aa .Log .Error ("F\u0075\u006e\u0063\u0074\u0069\u006fn\u0054\u0079\u0070\u0065\u0020\u006e\u0075\u006d\u0062e\u0072\u0020\u006di\u0073s\u0069\u006e\u0067");return nil ,_ce .New ("\u0069\u006e\u0076\u0061l\u0069\u0064\u0020\u0070\u0061\u0072\u0061\u006d\u0065\u0074e\u0072 \u006f\u0072\u0020\u006d\u0069\u0073\u0073i\u006e\u0067");
|
||
};if *_bbcbe ==2{return _debe (_decdf );}else if *_bbcbe ==3{return _cgef (_decdf );}else {return nil ,_ce .New ("i\u006e\u0076\u0061\u006cid\u0020f\u0075\u006e\u0063\u0074\u0069o\u006e\u0020\u0074\u0079\u0070\u0065");};}else if _fgbf ,_aege :=_gaagga .(*_fg .PdfObjectDictionary );
|
||
_aege {_dcec ,_gdde :=_fgbf .Get ("\u0046\u0075\u006ec\u0074\u0069\u006f\u006e\u0054\u0079\u0070\u0065").(*_fg .PdfObjectInteger );if !_gdde {_aa .Log .Error ("F\u0075\u006e\u0063\u0074\u0069\u006fn\u0054\u0079\u0070\u0065\u0020\u006e\u0075\u006d\u0062e\u0072\u0020\u006di\u0073s\u0069\u006e\u0067");
|
||
return nil ,_ce .New ("\u0069\u006e\u0076\u0061l\u0069\u0064\u0020\u0070\u0061\u0072\u0061\u006d\u0065\u0074e\u0072 \u006f\u0072\u0020\u006d\u0069\u0073\u0073i\u006e\u0067");};if *_dcec ==2{return _debe (_fgbf );}else if *_dcec ==3{return _cgef (_fgbf );
|
||
}else {return nil ,_ce .New ("i\u006e\u0076\u0061\u006cid\u0020f\u0075\u006e\u0063\u0074\u0069o\u006e\u0020\u0074\u0079\u0070\u0065");};}else {_aa .Log .Debug ("\u0046u\u006e\u0063\u0074\u0069\u006f\u006e\u0020\u0054\u0079\u0070\u0065 \u0065\u0072\u0072\u006f\u0072\u003a\u0020\u0025\u0023\u0076",_gaagga );
|
||
return nil ,_ce .New ("\u0074\u0079\u0070\u0065\u0020\u0065\u0072\u0072\u006f\u0072");};};
|
||
|
||
// PdfShadingPatternType2 is shading patterns that will use a Type 2 shading pattern (Axial).
|
||
type PdfShadingPatternType2 struct{*PdfPattern ;Shading *PdfShadingType2 ;Matrix *_fg .PdfObjectArray ;ExtGState _fg .PdfObject ;};func (_dggc *PdfReader )newPdfActionResetFormFromDict (_gbea *_fg .PdfObjectDictionary )(*PdfActionResetForm ,error ){return &PdfActionResetForm {Fields :_gbea .Get ("\u0046\u0069\u0065\u006c\u0064\u0073"),Flags :_gbea .Get ("\u0046\u006c\u0061g\u0073")},nil ;
|
||
};
|
||
|
||
// A returns the value of the A component of the color.
|
||
func (_bbcb *PdfColorCalRGB )A ()float64 {return _bbcb [0]};
|
||
|
||
// SetContext sets the specific fielddata type, e.g. would be PdfFieldButton for a button field.
|
||
func (_aaag *PdfField )SetContext (ctx PdfModel ){_aaag ._abcbb =ctx };
|
||
|
||
// Optimizer is the interface that performs optimization of PDF object structure for output writing.
|
||
//
|
||
// Optimize receives a slice of input `objects`, performs optimization, including removing, replacing objects and
|
||
// output the optimized slice of objects.
|
||
type Optimizer interface{Optimize (_dcca []_fg .PdfObject )([]_fg .PdfObject ,error );};
|
||
|
||
// String returns a human readable description of `fontfile`.
|
||
func (_befce *fontFile )String ()string {_abbac :="\u005b\u004e\u006f\u006e\u0065\u005d";if _befce ._ffff !=nil {_abbac =_befce ._ffff .String ();};return _d .Sprintf ("\u0046O\u004e\u0054\u0046\u0049\u004c\u0045\u007b\u0025\u0023\u0071\u0020e\u006e\u0063\u006f\u0064\u0065\u0072\u003d\u0025\u0073\u007d",_befce ._gaefe ,_abbac );
|
||
};
|
||
|
||
// ToPdfObject returns the PDF representation of the tiling pattern.
|
||
func (_baaeg *PdfTilingPattern )ToPdfObject ()_fg .PdfObject {_baaeg .PdfPattern .ToPdfObject ();_cfcf :=_baaeg .getDict ();if _baaeg .PaintType !=nil {_cfcf .Set ("\u0050a\u0069\u006e\u0074\u0054\u0079\u0070e",_baaeg .PaintType );};if _baaeg .TilingType !=nil {_cfcf .Set ("\u0054\u0069\u006c\u0069\u006e\u0067\u0054\u0079\u0070\u0065",_baaeg .TilingType );
|
||
};if _baaeg .BBox !=nil {_cfcf .Set ("\u0042\u0042\u006f\u0078",_baaeg .BBox .ToPdfObject ());};if _baaeg .XStep !=nil {_cfcf .Set ("\u0058\u0053\u0074e\u0070",_baaeg .XStep );};if _baaeg .YStep !=nil {_cfcf .Set ("\u0059\u0053\u0074e\u0070",_baaeg .YStep );
|
||
};if _baaeg .Resources !=nil {_cfcf .Set ("\u0052e\u0073\u006f\u0075\u0072\u0063\u0065s",_baaeg .Resources .ToPdfObject ());};if _baaeg .Matrix !=nil {_cfcf .Set ("\u004d\u0061\u0074\u0072\u0069\u0078",_baaeg .Matrix );};return _baaeg ._gaac ;};var (ErrRequiredAttributeMissing =_ce .New ("\u0072\u0065\u0071\u0075\u0069\u0072\u0065\u0064\u0020\u0061\u0074t\u0072\u0069\u0062\u0075\u0074\u0065\u0020\u006d\u0069\u0073s\u0069\u006e\u0067");
|
||
ErrInvalidAttribute =_ce .New ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0061\u0074\u0074\u0072i\u0062\u0075\u0074\u0065");ErrTypeCheck =_ce .New ("\u0074\u0079\u0070\u0065\u0020\u0063\u0068\u0065\u0063\u006b");_gbfa =_ce .New ("\u0072\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b\u0020e\u0072\u0072\u006f\u0072");
|
||
ErrEncrypted =_ce .New ("\u0066\u0069\u006c\u0065\u0020\u006e\u0065\u0065\u0064\u0073\u0020\u0074\u006f\u0020\u0062e\u0020d\u0065\u0063\u0072\u0079\u0070\u0074\u0065\u0064\u0020\u0066\u0069\u0072\u0073\u0074");ErrNoFont =_ce .New ("\u0066\u006fn\u0074\u0020\u006eo\u0074\u0020\u0064\u0065\u0066\u0069\u006e\u0065\u0064");
|
||
ErrFontNotSupported =_bb .Errorf ("u\u006e\u0073\u0075\u0070po\u0072t\u0065\u0064\u0020\u0066\u006fn\u0074\u0020\u0028\u0025\u0077\u0029",_fg .ErrNotSupported );ErrType1CFontNotSupported =_bb .Errorf ("\u0054y\u0070\u00651\u0043\u0020\u0066o\u006e\u0074\u0073\u0020\u0061\u0072\u0065 \u006e\u006f\u0074\u0020\u0063\u0075r\u0072\u0065\u006e\u0074\u006c\u0079\u0020\u0073\u0075\u0070\u0070o\u0072\u0074\u0065\u0064\u0020\u0028\u0025\u0077\u0029",_fg .ErrNotSupported );
|
||
ErrType3FontNotSupported =_bb .Errorf ("\u0054y\u0070\u00653\u0020\u0066\u006f\u006et\u0073\u0020\u0061r\u0065\u0020\u006e\u006f\u0074\u0020\u0063\u0075\u0072re\u006e\u0074\u006cy\u0020\u0073u\u0070\u0070\u006f\u0072\u0074\u0065d\u0020\u0028%\u0077\u0029",_fg .ErrNotSupported );
|
||
ErrTTCmapNotSupported =_bb .Errorf ("\u0075\u006es\u0075\u0070\u0070\u006fr\u0074\u0065d\u0020\u0054\u0072\u0075\u0065\u0054\u0079\u0070e\u0020\u0063\u006d\u0061\u0070\u0020\u0066\u006f\u0072\u006d\u0061\u0074 \u0028\u0025\u0077\u0029",_fg .ErrNotSupported );
|
||
ErrSignNotEnoughSpace =_bb .Errorf ("\u0069\u006e\u0073\u0075\u0066\u0066\u0069c\u0069\u0065\u006et\u0020\u0073\u0070a\u0063\u0065 \u0061\u006c\u006c\u006f\u0063\u0061t\u0065d \u0066\u006f\u0072\u0020\u0074\u0068\u0065\u0020\u0073\u0069\u0067\u006e\u0061\u0074\u0075\u0072\u0065\u0020\u0063\u006f\u006e\u0074\u0065\u006e\u0074\u0073");
|
||
ErrSignNoCertificates =_bb .Errorf ("\u0063\u006ful\u0064\u0020\u006eo\u0074\u0020\u0072\u0065tri\u0065ve\u0020\u0063\u0065\u0072\u0074\u0069\u0066ic\u0061\u0074\u0065\u0020\u0063\u0068\u0061i\u006e"););func _adad (_fdddf *_cc .ImageBase )(_bafbb Image ){_bafbb .Width =int64 (_fdddf .Width );
|
||
_bafbb .Height =int64 (_fdddf .Height );_bafbb .BitsPerComponent =int64 (_fdddf .BitsPerComponent );_bafbb .ColorComponents =_fdddf .ColorComponents ;_bafbb .Data =_fdddf .Data ;_bafbb ._dbge =_fdddf .Decode ;_bafbb ._gccd =_fdddf .Alpha ;return _bafbb ;
|
||
};
|
||
|
||
// Read reads an image and loads into a new Image object with an RGB
|
||
// colormap and 8 bits per component.
|
||
func (_ddfe DefaultImageHandler )Read (reader _ff .Reader )(*Image ,error ){_aeaba ,_ ,_aefbe :=_ac .Decode (reader );if _aefbe !=nil {_aa .Log .Debug ("\u0045\u0072\u0072or\u0020\u0064\u0065\u0063\u006f\u0064\u0069\u006e\u0067\u0020\u0066\u0069\u006c\u0065\u003a\u0020\u0025\u0073",_aefbe );
|
||
return nil ,_aefbe ;};return _ddfe .NewImageFromGoImage (_aeaba );};
|
||
|
||
// ToInteger convert to an integer format.
|
||
func (_cddfg *PdfColorCalRGB )ToInteger (bits int )[3]uint32 {_adfg :=_ef .Pow (2,float64 (bits ))-1;return [3]uint32 {uint32 (_adfg *_cddfg .A ()),uint32 (_adfg *_cddfg .B ()),uint32 (_adfg *_cddfg .C ())};};
|
||
|
||
// ToPdfObject returns the PDF representation of the pattern.
|
||
func (_gffdf *PdfPattern )ToPdfObject ()_fg .PdfObject {_cddbe :=_gffdf .getDict ();_cddbe .Set ("\u0054\u0079\u0070\u0065",_fg .MakeName ("\u0050a\u0074\u0074\u0065\u0072\u006e"));_cddbe .Set ("P\u0061\u0074\u0074\u0065\u0072\u006e\u0054\u0079\u0070\u0065",_fg .MakeInteger (_gffdf .PatternType ));
|
||
return _gffdf ._gaac ;};
|
||
|
||
// Inspect inspects the object types, subtypes and content in the PDF file returning a map of
|
||
// object type to number of instances of each.
|
||
func (_bdabd *PdfReader )Inspect ()(map[string ]int ,error ){return _bdabd ._ccgg .Inspect ()};
|
||
|
||
// ImageToRGB converts CalRGB colorspace image to RGB and returns the result.
|
||
func (_dgdb *PdfColorspaceCalRGB )ImageToRGB (img Image )(Image ,error ){_abdaa :=_ade .NewReader (img .getBase ());_aegb :=_cc .NewImageBase (int (img .Width ),int (img .Height ),int (img .BitsPerComponent ),3,nil ,nil ,nil );_cfbfc :=_ade .NewWriter (_aegb );
|
||
_abafg :=_ef .Pow (2,float64 (img .BitsPerComponent ))-1;_agcbe :=make ([]uint32 ,3);var (_ccfe error ;_fgeff ,_gcfb ,_cbfe ,_aaea ,_aedc ,_aeeg float64 ;);for {_ccfe =_abdaa .ReadSamples (_agcbe );if _ccfe ==_ff .EOF {break ;}else if _ccfe !=nil {return img ,_ccfe ;
|
||
};_fgeff =float64 (_agcbe [0])/_abafg ;_gcfb =float64 (_agcbe [1])/_abafg ;_cbfe =float64 (_agcbe [2])/_abafg ;_aaea =_dgdb .Matrix [0]*_ef .Pow (_fgeff ,_dgdb .Gamma [0])+_dgdb .Matrix [3]*_ef .Pow (_gcfb ,_dgdb .Gamma [1])+_dgdb .Matrix [6]*_ef .Pow (_cbfe ,_dgdb .Gamma [2]);
|
||
_aedc =_dgdb .Matrix [1]*_ef .Pow (_fgeff ,_dgdb .Gamma [0])+_dgdb .Matrix [4]*_ef .Pow (_gcfb ,_dgdb .Gamma [1])+_dgdb .Matrix [7]*_ef .Pow (_cbfe ,_dgdb .Gamma [2]);_aeeg =_dgdb .Matrix [2]*_ef .Pow (_fgeff ,_dgdb .Gamma [0])+_dgdb .Matrix [5]*_ef .Pow (_gcfb ,_dgdb .Gamma [1])+_dgdb .Matrix [8]*_ef .Pow (_cbfe ,_dgdb .Gamma [2]);
|
||
_fgeff =3.240479*_aaea +-1.537150*_aedc +-0.498535*_aeeg ;_gcfb =-0.969256*_aaea +1.875992*_aedc +0.041556*_aeeg ;_cbfe =0.055648*_aaea +-0.204043*_aedc +1.057311*_aeeg ;_fgeff =_ef .Min (_ef .Max (_fgeff ,0),1.0);_gcfb =_ef .Min (_ef .Max (_gcfb ,0),1.0);
|
||
_cbfe =_ef .Min (_ef .Max (_cbfe ,0),1.0);_agcbe [0]=uint32 (_fgeff *_abafg );_agcbe [1]=uint32 (_gcfb *_abafg );_agcbe [2]=uint32 (_cbfe *_abafg );if _ccfe =_cfbfc .WriteSamples (_agcbe );_ccfe !=nil {return img ,_ccfe ;};};return _adad (&_aegb ),nil ;
|
||
};
|
||
|
||
// OutlineItem represents a PDF outline item dictionary (Table 153 - pp. 376 - 377).
|
||
type OutlineItem struct{Title string `json:"title"`;Dest OutlineDest `json:"dest"`;Entries []*OutlineItem `json:"entries,omitempty"`;};
|
||
|
||
// NewOutline returns a new outline instance.
|
||
func NewOutline ()*Outline {return &Outline {}};
|
||
|
||
// ToWriter creates a new writer from the current reader, based on the specified options.
|
||
// If no options are provided, all reader properties are copied to the writer.
|
||
func (_bbgbc *PdfReader )ToWriter (opts *ReaderToWriterOpts )(*PdfWriter ,error ){_gcff :=NewPdfWriter ();if opts ==nil {opts =&ReaderToWriterOpts {};};_gbfgc ,_aggbb :=_bbgbc .GetNumPages ();if _aggbb !=nil {_aa .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_aggbb );
|
||
return nil ,_aggbb ;};for _dcbb :=1;_dcbb <=_gbfgc ;_dcbb ++{_abacf ,_agcbcf :=_bbgbc .GetPage (_dcbb );if _agcbcf !=nil {_aa .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_agcbcf );return nil ,_agcbcf ;};if opts .PageProcessCallback !=nil {_agcbcf =opts .PageProcessCallback (_dcbb ,_abacf );
|
||
if _agcbcf !=nil {_aa .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_agcbcf );return nil ,_agcbcf ;};}else if opts .PageCallback !=nil {opts .PageCallback (_dcbb ,_abacf );};_agcbcf =_gcff .AddPage (_abacf );if _agcbcf !=nil {_aa .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_agcbcf );
|
||
return nil ,_agcbcf ;};};_gcff ._fbbec =_bbgbc .PdfVersion ();if !opts .SkipInfo {_effee ,_facbd :=_bbgbc .GetPdfInfo ();if _facbd !=nil {_aa .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_facbd );}else {_gcff ._deabg .PdfObject =_effee .ToPdfObject ();
|
||
};};if !opts .SkipMetadata {if _dfede :=_bbgbc ._cgegd .Get ("\u004d\u0065\u0074\u0061\u0064\u0061\u0074\u0061");_dfede !=nil {if _accfd :=_gcff .SetCatalogMetadata (_dfede );_accfd !=nil {return nil ,_accfd ;};};};if !opts .SkipAcroForm {_acbgg :=_gcff .SetForms (_bbgbc .AcroForm );
|
||
if _acbgg !=nil {_aa .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_acbgg );return nil ,_acbgg ;};};if !opts .SkipOutlines {_gcff .AddOutlineTree (_bbgbc .GetOutlineTree ());};if !opts .SkipOCProperties {_fbffgd ,_gcffa :=_bbgbc .GetOCProperties ();
|
||
if _gcffa !=nil {_aa .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_gcffa );}else {_gcffa =_gcff .SetOCProperties (_fbffgd );if _gcffa !=nil {_aa .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_gcffa );};};};if !opts .SkipPageLabels {_bfdec ,_gggg :=_bbgbc .GetPageLabels ();
|
||
if _gggg !=nil {_aa .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_gggg );}else {_gggg =_gcff .SetPageLabels (_bfdec );if _gggg !=nil {_aa .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_gggg );};};};if !opts .SkipNamedDests {_decce ,_geaeg :=_bbgbc .GetNamedDestinations ();
|
||
if _geaeg !=nil {_aa .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_geaeg );}else {_geaeg =_gcff .SetNamedDestinations (_decce );if _geaeg !=nil {_aa .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_geaeg );};};};if !opts .SkipNameDictionary {_eafdd ,_gfbba :=_bbgbc .GetNameDictionary ();
|
||
if _gfbba !=nil {_aa .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_gfbba );}else {_gfbba =_gcff .SetNameDictionary (_eafdd );if _gfbba !=nil {_aa .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_gfbba );};};};if !opts .SkipRotation &&_bbgbc .Rotate !=nil {if _gfcfgb :=_gcff .SetRotation (*_bbgbc .Rotate );
|
||
_gfcfgb !=nil {_aa .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_gfcfgb );};};return &_gcff ,nil ;};
|
||
|
||
// ColorToRGB converts a color in Separation colorspace to RGB colorspace.
|
||
func (_fefc *PdfColorspaceSpecialSeparation )ColorToRGB (color PdfColor )(PdfColor ,error ){if _fefc .AlternateSpace ==nil {return nil ,_ce .New ("\u0061\u006c\u0074\u0065\u0072\u006e\u0061\u0074\u0065\u0020c\u006f\u006c\u006f\u0072\u0073\u0070\u0061c\u0065\u0020\u0075\u006e\u0064\u0065\u0066\u0069\u006e\u0065\u0064");
|
||
};return _fefc .AlternateSpace .ColorToRGB (color );};
|
||
|
||
// ColorFromFloats returns a new PdfColor based on the input slice of color
|
||
// components. The slice should contain a single element.
|
||
func (_gbgdc *PdfColorspaceSpecialSeparation )ColorFromFloats (vals []float64 )(PdfColor ,error ){if len (vals )!=1{return nil ,_ce .New ("r\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b");};_gbgdg :=vals [0];_daged :=[]float64 {_gbgdg };
|
||
_dbff ,_adfe :=_gbgdc .TintTransform .Evaluate (_daged );if _adfe !=nil {_aa .Log .Debug ("\u0045\u0072r\u006f\u0072\u002c\u0020\u0066\u0061\u0069\u006c\u0065\u0064\u0020\u0074\u006f\u0020\u0065\u0076\u0061\u006c\u0075\u0061\u0074\u0065: \u0025\u0076",_adfe );
|
||
_aa .Log .Trace ("\u0054\u0069\u006e\u0074 t\u0072\u0061\u006e\u0073\u0066\u006f\u0072\u006d\u003a\u0020\u0025\u002b\u0076",_gbgdc .TintTransform );return nil ,_adfe ;};_aa .Log .Trace ("\u0050\u0072\u006f\u0063\u0065\u0073\u0073\u0069\u006e\u0067\u0020\u0043\u006f\u006c\u006fr\u0046\u0072\u006f\u006d\u0046\u006c\u006f\u0061\u0074\u0073\u0028\u0025\u002bv\u0029\u0020\u006f\u006e\u0020\u0041\u006c\u0074\u0065\u0072\u006e\u0061te\u0053\u0070\u0061\u0063\u0065\u003a\u0020\u0025\u0023\u0076",_dbff ,_gbgdc .AlternateSpace );
|
||
_dcbaa ,_adfe :=_gbgdc .AlternateSpace .ColorFromFloats (_dbff );if _adfe !=nil {_aa .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u002c\u0020\u0066a\u0069\u006c\u0065d \u0074\u006f\u0020\u0065\u0076\u0061l\u0075\u0061\u0074\u0065\u0020\u0069\u006e\u0020\u0061\u006c\u0074\u0065\u0072\u006e\u0061t\u0065\u0020\u0073\u0070\u0061\u0063\u0065\u003a \u0025\u0076",_adfe );
|
||
return nil ,_adfe ;};return _dcbaa ,nil ;};
|
||
|
||
// SetForms sets the Acroform for a PDF file.
|
||
func (_gaaga *PdfWriter )SetForms (form *PdfAcroForm )error {_gaaga ._feaea =form ;return nil };func (_ggdad *PdfWriter )setHashIDs (_bddaed _e .Hash )error {_aaefc :=_bddaed .Sum (nil );if _ggdad ._deeab ==""{_ggdad ._deeab =_ed .EncodeToString (_aaefc [:8]);
|
||
};_ggdad .setDocumentIDs (_ggdad ._deeab ,_ed .EncodeToString (_aaefc [8:]));return nil ;};
|
||
|
||
// ApplyStandard is used to apply changes required on the document to match the rules required by the input standard.
|
||
// The writer's content would be changed after all the document parts are already established during the Write method.
|
||
// A good example of the StandardApplier could be a PDF/A Profile (i.e.: pdfa.Profile1A). In such a case PdfWriter would
|
||
// set up all rules required by that Profile.
|
||
func (_afadb *PdfWriter )ApplyStandard (optimizer StandardApplier ){_afadb ._effb =optimizer };
|
||
|
||
// ToPdfObject returns the PDF representation of the shading dictionary.
|
||
func (_bbgga *PdfShadingType4 )ToPdfObject ()_fg .PdfObject {_bbgga .PdfShading .ToPdfObject ();_fbce ,_afcgg :=_bbgga .getShadingDict ();if _afcgg !=nil {_aa .Log .Error ("\u0055\u006ea\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0061\u0063\u0063\u0065\u0073\u0073\u0020\u0073\u0068\u0061\u0064\u0069\u006e\u0067\u0020di\u0063\u0074");
|
||
return nil ;};if _bbgga .BitsPerCoordinate !=nil {_fbce .Set ("\u0042\u0069\u0074\u0073\u0050\u0065\u0072\u0043\u006f\u006f\u0072\u0064i\u006e\u0061\u0074\u0065",_bbgga .BitsPerCoordinate );};if _bbgga .BitsPerComponent !=nil {_fbce .Set ("\u0042\u0069t\u0073\u0050\u0065r\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074",_bbgga .BitsPerComponent );
|
||
};if _bbgga .BitsPerFlag !=nil {_fbce .Set ("B\u0069\u0074\u0073\u0050\u0065\u0072\u0046\u006c\u0061\u0067",_bbgga .BitsPerFlag );};if _bbgga .Decode !=nil {_fbce .Set ("\u0044\u0065\u0063\u006f\u0064\u0065",_bbgga .Decode );};if _bbgga .Function !=nil {if len (_bbgga .Function )==1{_fbce .Set ("\u0046\u0075\u006e\u0063\u0074\u0069\u006f\u006e",_bbgga .Function [0].ToPdfObject ());
|
||
}else {_adfdf :=_fg .MakeArray ();for _ ,_fafga :=range _bbgga .Function {_adfdf .Append (_fafga .ToPdfObject ());};_fbce .Set ("\u0046\u0075\u006e\u0063\u0074\u0069\u006f\u006e",_adfdf );};};return _bbgga ._cbabf ;};func (_aebd *PdfReader )newPdfActionGotoEFromDict (_eaa *_fg .PdfObjectDictionary )(*PdfActionGoToE ,error ){_cfcd ,_ecb :=_ddd (_eaa .Get ("\u0046"));
|
||
if _ecb !=nil {return nil ,_ecb ;};return &PdfActionGoToE {D :_eaa .Get ("\u0044"),NewWindow :_eaa .Get ("\u004ee\u0077\u0057\u0069\u006e\u0064\u006fw"),T :_eaa .Get ("\u0054"),F :_cfcd },nil ;};
|
||
|
||
// GetOutlinesFlattened returns a flattened list of tree nodes and titles.
|
||
// NOTE: for most use cases, it is recommended to use the high-level GetOutlines
|
||
// method instead, which also provides information regarding the destination
|
||
// of the outline items.
|
||
func (_bbbcc *PdfReader )GetOutlinesFlattened ()([]*PdfOutlineTreeNode ,[]string ,error ){var _gbagb []*PdfOutlineTreeNode ;var _bbeeg []string ;var _gbeea func (*PdfOutlineTreeNode ,*[]*PdfOutlineTreeNode ,*[]string ,int );_gbeea =func (_cdcbg *PdfOutlineTreeNode ,_ebega *[]*PdfOutlineTreeNode ,_gbcg *[]string ,_fgfbb int ){if _cdcbg ==nil {return ;
|
||
};if _cdcbg ._gfcge ==nil {_aa .Log .Debug ("E\u0052\u0052\u004f\u0052\u003a\u0020M\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u006e\u006fd\u0065\u002e\u0063o\u006et\u0065\u0078\u0074");return ;};_fbab ,_dfdag :=_cdcbg ._gfcge .(*PdfOutlineItem );if _dfdag {*_ebega =append (*_ebega ,&_fbab .PdfOutlineTreeNode );
|
||
_abcbdg :=_dc .Repeat ("\u0020",_fgfbb *2)+_fbab .Title .Decoded ();*_gbcg =append (*_gbcg ,_abcbdg );};if _cdcbg .First !=nil {_gcfa :=_dc .Repeat ("\u0020",_fgfbb *2)+"\u002b";*_gbcg =append (*_gbcg ,_gcfa );_gbeea (_cdcbg .First ,_ebega ,_gbcg ,_fgfbb +1);
|
||
};if _dfdag &&_fbab .Next !=nil {_gbeea (_fbab .Next ,_ebega ,_gbcg ,_fgfbb );};};_gbeea (_bbbcc ._cfac ,&_gbagb ,&_bbeeg ,0);return _gbagb ,_bbeeg ,nil ;};
|
||
|
||
// PdfActionGoToR represents a GoToR action.
|
||
type PdfActionGoToR struct{*PdfAction ;F *PdfFilespec ;D _fg .PdfObject ;NewWindow _fg .PdfObject ;};
|
||
|
||
// ColorToRGB converts a CalRGB color to an RGB color.
|
||
func (_gdbdb *PdfColorspaceCalRGB )ColorToRGB (color PdfColor )(PdfColor ,error ){_ebbb ,_gffdc :=color .(*PdfColorCalRGB );if !_gffdc {_aa .Log .Debug ("\u0049\u006e\u0070ut\u0020\u0063\u006f\u006c\u006f\u0072\u0020\u006e\u006f\u0074\u0020\u0063\u0061\u006c\u0020\u0072\u0067\u0062");
|
||
return nil ,_ce .New ("\u0074\u0079p\u0065\u0020\u0063h\u0065\u0063\u006b\u0020\u0065\u0072\u0072\u006f\u0072");};_bacc :=_ebbb .A ();_degb :=_ebbb .B ();_bdga :=_ebbb .C ();X :=_gdbdb .Matrix [0]*_ef .Pow (_bacc ,_gdbdb .Gamma [0])+_gdbdb .Matrix [3]*_ef .Pow (_degb ,_gdbdb .Gamma [1])+_gdbdb .Matrix [6]*_ef .Pow (_bdga ,_gdbdb .Gamma [2]);
|
||
Y :=_gdbdb .Matrix [1]*_ef .Pow (_bacc ,_gdbdb .Gamma [0])+_gdbdb .Matrix [4]*_ef .Pow (_degb ,_gdbdb .Gamma [1])+_gdbdb .Matrix [7]*_ef .Pow (_bdga ,_gdbdb .Gamma [2]);Z :=_gdbdb .Matrix [2]*_ef .Pow (_bacc ,_gdbdb .Gamma [0])+_gdbdb .Matrix [5]*_ef .Pow (_degb ,_gdbdb .Gamma [1])+_gdbdb .Matrix [8]*_ef .Pow (_bdga ,_gdbdb .Gamma [2]);
|
||
_eeed :=3.240479*X +-1.537150*Y +-0.498535*Z ;_bgag :=-0.969256*X +1.875992*Y +0.041556*Z ;_ffgeb :=0.055648*X +-0.204043*Y +1.057311*Z ;_eeed =_ef .Min (_ef .Max (_eeed ,0),1.0);_bgag =_ef .Min (_ef .Max (_bgag ,0),1.0);_ffgeb =_ef .Min (_ef .Max (_ffgeb ,0),1.0);
|
||
return NewPdfColorDeviceRGB (_eeed ,_bgag ,_ffgeb ),nil ;};
|
||
|
||
// XObjectImage (Table 89 in 8.9.5.1).
|
||
// Implements PdfModel interface.
|
||
type XObjectImage struct{
|
||
|
||
//ColorSpace PdfObject
|
||
Width *int64 ;Height *int64 ;ColorSpace PdfColorspace ;BitsPerComponent *int64 ;Filter _fg .StreamEncoder ;Intent _fg .PdfObject ;ImageMask _fg .PdfObject ;Mask _fg .PdfObject ;Matte _fg .PdfObject ;Decode _fg .PdfObject ;Interpolate _fg .PdfObject ;Alternatives _fg .PdfObject ;
|
||
SMask _fg .PdfObject ;SMaskInData _fg .PdfObject ;Name _fg .PdfObject ;StructParent _fg .PdfObject ;ID _fg .PdfObject ;OPI _fg .PdfObject ;Metadata _fg .PdfObject ;OC _fg .PdfObject ;Stream []byte ;_eafbc *_fg .PdfObjectStream ;};func (_ceffe *PdfFunctionType0 )processSamples ()error {_fdgge :=_ade .ResampleBytes (_ceffe ._cfed ,_ceffe .BitsPerSample );
|
||
_ceffe ._fccae =_fdgge ;return nil ;};
|
||
|
||
// ColorFromPdfObjects loads the color from PDF objects.
|
||
// The first objects (if present) represent the color in underlying colorspace. The last one represents
|
||
// the name of the pattern.
|
||
func (_afbb *PdfColorspaceSpecialPattern )ColorFromPdfObjects (objects []_fg .PdfObject )(PdfColor ,error ){if len (objects )< 1{return nil ,_ce .New ("\u0069\u006e\u0076\u0061l\u0069\u0064\u0020\u006e\u0075\u006d\u0062\u0065\u0072\u0020o\u0066 \u0070\u0061\u0072\u0061\u006d\u0065\u0074e\u0072\u0073");
|
||
};_gdeag :=&PdfColorPattern {};_babab ,_dcegf :=objects [len (objects )-1].(*_fg .PdfObjectName );if !_dcegf {_aa .Log .Debug ("\u0050\u0061\u0074\u0074\u0065\u0072\u006e\u0020\u006e\u0061\u006d\u0065\u0020\u006e\u006ft\u0020a\u0020\u006e\u0061\u006d\u0065\u0020\u0028\u0067\u006f\u0074\u0020\u0025\u0054\u0029",objects [len (objects )-1]);
|
||
return nil ,ErrTypeCheck ;};_gdeag .PatternName =*_babab ;if len (objects )> 1{_gebc :=objects [0:len (objects )-1];if _afbb .UnderlyingCS ==nil {_aa .Log .Debug ("P\u0061\u0074t\u0065\u0072\u006e\u0020\u0063\u006f\u006c\u006f\u0072\u0020\u0077\u0069\u0074\u0068\u0020\u0064\u0065\u0066\u0069\u006ee\u0064\u0020\u0063\u006f\u006c\u006f\u0072\u0020\u0063\u006f\u006d\u0070\u006f\u006e\u0065\u006et\u0073\u0020\u0062\u0075\u0074\u0020\u0075\u006e\u0064\u0065\u0072\u006c\u0079i\u006e\u0067\u0020\u0063\u0073\u0020\u006d\u0069\u0073\u0073\u0069n\u0067");
|
||
return nil ,_ce .New ("\u0075n\u0064\u0065\u0072\u006cy\u0069\u006e\u0067\u0020\u0043S\u0020n\u006ft\u0020\u0064\u0065\u0066\u0069\u006e\u0065d");};_cde ,_cafgc :=_afbb .UnderlyingCS .ColorFromPdfObjects (_gebc );if _cafgc !=nil {_aa .Log .Debug ("\u0045\u0052R\u004f\u0052\u003a\u0020\u0055n\u0061\u0062\u006c\u0065\u0020t\u006f\u0020\u0063\u006f\u006e\u0076\u0065\u0072\u0074\u0020\u0063\u006f\u006c\u006f\u0072\u0020\u0076\u0069\u0061\u0020\u0075\u006e\u0064\u0065\u0072\u006c\u0079\u0069\u006e\u0067\u0020\u0063\u0073\u003a\u0020\u0025\u0076",_cafgc );
|
||
return nil ,_cafgc ;};_gdeag .Color =_cde ;};return _gdeag ,nil ;};func (_ecgc *PdfWriter )writeTrailer (_cdba int ){_ecgc .writeString ("\u0078\u0072\u0065\u0066\u000d\u000a");for _dgdeb :=0;_dgdeb <=_cdba ;{for ;_dgdeb <=_cdba ;_dgdeb ++{_bddaec ,_gaaad :=_ecgc ._aafgd [_dgdeb ];
|
||
if _gaaad &&(!_ecgc ._cdafg ||_ecgc ._cdafg &&(_bddaec .Type ==1&&_bddaec .Offset >=_ecgc ._cecef ||_bddaec .Type ==0)){break ;};};var _aaec int ;for _aaec =_dgdeb +1;_aaec <=_cdba ;_aaec ++{_bbagg ,_bfbgc :=_ecgc ._aafgd [_aaec ];if _bfbgc &&(!_ecgc ._cdafg ||_ecgc ._cdafg &&(_bbagg .Type ==1&&_bbagg .Offset > _ecgc ._cecef )){continue ;
|
||
};break ;};_gcga :=_d .Sprintf ("\u0025d\u0020\u0025\u0064\u000d\u000a",_dgdeb ,_aaec -_dgdeb );_ecgc .writeString (_gcga );for _aggfd :=_dgdeb ;_aggfd < _aaec ;_aggfd ++{_gbfd :=_ecgc ._aafgd [_aggfd ];switch _gbfd .Type {case 0:_gcga =_d .Sprintf ("\u0025\u002e\u0031\u0030\u0064\u0020\u0025\u002e\u0035d\u0020\u0066\u000d\u000a",0,65535);
|
||
_ecgc .writeString (_gcga );case 1:_gcga =_d .Sprintf ("\u0025\u002e\u0031\u0030\u0064\u0020\u0025\u002e\u0035d\u0020\u006e\u000d\u000a",_gbfd .Offset ,0);_ecgc .writeString (_gcga );};};_dgdeb =_aaec +1;};_bcgdgb :=_fg .MakeDict ();_bcgdgb .Set ("\u0049\u006e\u0066\u006f",_ecgc ._deabg );
|
||
_bcgdgb .Set ("\u0052\u006f\u006f\u0074",_ecgc ._cegde );_bcgdgb .Set ("\u0053\u0069\u007a\u0065",_fg .MakeInteger (int64 (_cdba +1)));if _ecgc ._cdafg &&_ecgc ._cgdbf > 0{_bcgdgb .Set ("\u0050\u0072\u0065\u0076",_fg .MakeInteger (_ecgc ._cgdbf ));};if _ecgc ._bbdbd !=nil {_bcgdgb .Set ("\u0045n\u0063\u0072\u0079\u0070\u0074",_ecgc ._abgdg );
|
||
};if _ecgc ._dadgc ==nil &&_ecgc ._deeab !=""&&_ecgc ._ccccb !=""{_ecgc ._dadgc =_fg .MakeArray (_fg .MakeHexString (_ecgc ._deeab ),_fg .MakeHexString (_ecgc ._ccccb ));};if _ecgc ._dadgc !=nil {_bcgdgb .Set ("\u0049\u0044",_ecgc ._dadgc );_aa .Log .Trace ("\u0049d\u0073\u003a\u0020\u0025\u0073",_ecgc ._dadgc );
|
||
};_ecgc .writeString ("\u0074\u0072\u0061\u0069\u006c\u0065\u0072\u000a");_ecgc .writeString (_bcgdgb .WriteString ());_ecgc .writeString ("\u000a");};
|
||
|
||
// AddImageResource adds an image to the XObject resources.
|
||
func (_ggede *PdfPage )AddImageResource (name _fg .PdfObjectName ,ximg *XObjectImage )error {var _acedg *_fg .PdfObjectDictionary ;if _ggede .Resources .XObject ==nil {_acedg =_fg .MakeDict ();_ggede .Resources .XObject =_acedg ;}else {var _egbd bool ;
|
||
_acedg ,_egbd =(_ggede .Resources .XObject ).(*_fg .PdfObjectDictionary );if !_egbd {return _ce .New ("\u0069\u006e\u0076\u0061li\u0064\u0020\u0078\u0072\u0065\u0073\u0020\u0064\u0069\u0063\u0074\u0020\u0074\u0079p\u0065");};};_acedg .Set (name ,ximg .ToPdfObject ());
|
||
return nil ;};
|
||
|
||
// FlattenFieldsWithOpts flattens the AcroForm fields of the reader using the
|
||
// provided field appearance generator and the specified options. If no options
|
||
// are specified, all form fields are flattened.
|
||
// If a filter function is provided using the opts parameter, only the filtered
|
||
// fields are flattened. Otherwise, all form fields are flattened.
|
||
// At the end of the process, the AcroForm contains all the fields which were
|
||
// not flattened. If all fields are flattened, the reader's AcroForm field
|
||
// is set to nil.
|
||
func (_gedg *PdfReader )FlattenFieldsWithOpts (appgen FieldAppearanceGenerator ,opts *FieldFlattenOpts )error {return _gedg .flattenFieldsWithOpts (false ,appgen ,opts );};
|
||
|
||
// NewPdfActionNamed returns a new "named" action.
|
||
func NewPdfActionNamed ()*PdfActionNamed {_efg :=NewPdfAction ();_efgb :=&PdfActionNamed {};_efgb .PdfAction =_efg ;_efg .SetContext (_efgb );return _efgb ;};
|
||
|
||
// ToJBIG2Image converts current image to the core.JBIG2Image.
|
||
func (_abbaf *Image )ToJBIG2Image ()(*_fg .JBIG2Image ,error ){_cgcbb ,_ebee :=_abbaf .ToGoImage ();if _ebee !=nil {return nil ,_ebee ;};return _fg .GoImageToJBIG2 (_cgcbb ,_fg .JB2ImageAutoThreshold );};func (_eced *PdfColorspaceSpecialIndexed )String ()string {return "\u0049n\u0064\u0065\u0078\u0065\u0064";
|
||
};
|
||
|
||
// IsPush returns true if the button field represents a push button, false otherwise.
|
||
func (_decb *PdfFieldButton )IsPush ()bool {return _decb .GetType ()==ButtonTypePush };func (_fced *PdfReader )newPdfActionNamedFromDict (_edfg *_fg .PdfObjectDictionary )(*PdfActionNamed ,error ){return &PdfActionNamed {N :_edfg .Get ("\u004e")},nil ;
|
||
};
|
||
|
||
// EnableAll LTV enables all signatures in the PDF document.
|
||
// The signing certificate chain is extracted from each signature dictionary.
|
||
// Optionally, additional certificates can be specified through the
|
||
// `extraCerts` parameter. The LTV client attempts to build the certificate
|
||
// chain up to a trusted root by downloading any missing certificates.
|
||
func (_ggaa *LTV )EnableAll (extraCerts []*_ge .Certificate )error {_fadaa :=_ggaa ._edgba ._cbb .AcroForm ;for _ ,_eccbc :=range _fadaa .AllFields (){_acbbg ,_ :=_eccbc .GetContext ().(*PdfFieldSignature );if _acbbg ==nil {continue ;};_aabaa :=_acbbg .V ;
|
||
if _cegda :=_ggaa .validateSig (_aabaa );_cegda !=nil {_aa .Log .Debug ("\u0057\u0041\u0052N\u003a\u0020\u0053\u006b\u0069\u0070\u0070\u0069\u006e\u0067\u0020\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0073\u0069\u0067\u006e\u0061\u0074\u0075\u0072\u0065\u0020f\u0069\u0065\u006c\u0064\u003a\u0020\u0025\u0076",_cegda );
|
||
};if _ccfg :=_ggaa .Enable (_aabaa ,extraCerts );_ccfg !=nil {return _ccfg ;};};return nil ;};
|
||
|
||
// GetStandardApplier gets currently used StandardApplier..
|
||
func (_geefa *PdfWriter )GetStandardApplier ()StandardApplier {return _geefa ._effb };
|
||
|
||
// ToPdfObject returns the PDF representation of the shading dictionary.
|
||
func (_dfbfg *PdfShadingType2 )ToPdfObject ()_fg .PdfObject {_dfbfg .PdfShading .ToPdfObject ();_dgbba ,_ddcfdc :=_dfbfg .getShadingDict ();if _ddcfdc !=nil {_aa .Log .Error ("\u0055\u006ea\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0061\u0063\u0063\u0065\u0073\u0073\u0020\u0073\u0068\u0061\u0064\u0069\u006e\u0067\u0020di\u0063\u0074");
|
||
return nil ;};if _dgbba ==nil {_aa .Log .Error ("\u0053\u0068\u0061\u0064in\u0067\u0020\u0064\u0069\u0063\u0074\u0020\u0069\u0073\u0020\u006e\u0069\u006c");return nil ;};if _dfbfg .Coords !=nil {_dgbba .Set ("\u0043\u006f\u006f\u0072\u0064\u0073",_dfbfg .Coords );
|
||
};if _dfbfg .Domain !=nil {_dgbba .Set ("\u0044\u006f\u006d\u0061\u0069\u006e",_dfbfg .Domain );};if _dfbfg .Function !=nil {if len (_dfbfg .Function )==1{_dgbba .Set ("\u0046\u0075\u006e\u0063\u0074\u0069\u006f\u006e",_dfbfg .Function [0].ToPdfObject ());
|
||
}else {_gabbf :=_fg .MakeArray ();for _ ,_babcg :=range _dfbfg .Function {_gabbf .Append (_babcg .ToPdfObject ());};_dgbba .Set ("\u0046\u0075\u006e\u0063\u0074\u0069\u006f\u006e",_gabbf );};};if _dfbfg .Extend !=nil {_dgbba .Set ("\u0045\u0078\u0074\u0065\u006e\u0064",_dfbfg .Extend );
|
||
};return _dfbfg ._cbabf ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_gfe *PdfActionImportData )ToPdfObject ()_fg .PdfObject {_gfe .PdfAction .ToPdfObject ();_gff :=_gfe ._bda ;_eead :=_gff .PdfObject .(*_fg .PdfObjectDictionary );_eead .SetIfNotNil ("\u0053",_fg .MakeName (string (ActionTypeImportData )));if _gfe .F !=nil {_eead .Set ("\u0046",_gfe .F .ToPdfObject ());
|
||
};return _gff ;};
|
||
|
||
// ColorFromPdfObjects returns a new PdfColor based on the input slice of color
|
||
// components. The slice should contain a single PdfObjectFloat element.
|
||
func (_cdbc *PdfColorspaceSpecialSeparation )ColorFromPdfObjects (objects []_fg .PdfObject )(PdfColor ,error ){if len (objects )!=1{return nil ,_ce .New ("r\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b");};_bddag ,_dada :=_fg .GetNumbersAsFloat (objects );
|
||
if _dada !=nil {return nil ,_dada ;};return _cdbc .ColorFromFloats (_bddag );};
|
||
|
||
// Y returns the value of the yellow component of the color.
|
||
func (_abba *PdfColorDeviceCMYK )Y ()float64 {return _abba [2]};
|
||
|
||
// GetNumComponents returns the number of color components of the colorspace device.
|
||
// Returns 3 for a CalRGB device.
|
||
func (_cdbf *PdfColorspaceCalRGB )GetNumComponents ()int {return 3};
|
||
|
||
// GetContainingPdfObject implements interface PdfModel.
|
||
func (_debbe *PdfSignatureReference )GetContainingPdfObject ()_fg .PdfObject {return _debbe ._gafdc };
|
||
|
||
// GetPrimitiveFromModel returns the primitive object corresponding to the input `model`.
|
||
func (_dfcccg *modelManager )GetPrimitiveFromModel (model PdfModel )_fg .PdfObject {_dadfg ,_fbde :=_dfcccg ._abga [model ];if !_fbde {return nil ;};return _dadfg ;};func _cfedc (_dgbcg *_fg .PdfObjectDictionary )(*PdfShadingType6 ,error ){_bgfacc :=PdfShadingType6 {};
|
||
_cgaee :=_dgbcg .Get ("\u0042\u0069\u0074\u0073\u0050\u0065\u0072\u0043\u006f\u006f\u0072\u0064i\u006e\u0061\u0074\u0065");if _cgaee ==nil {_aa .Log .Debug ("\u0052e\u0071\u0075i\u0072\u0065\u0064 \u0061\u0074\u0074\u0072\u0069\u0062\u0075t\u0065\u0020\u006d\u0069\u0073\u0073i\u006e\u0067\u003a\u0020\u0042\u0069\u0074\u0073\u0050\u0065\u0072C\u006f\u006f\u0072\u0064\u0069\u006e\u0061\u0074\u0065");
|
||
return nil ,ErrRequiredAttributeMissing ;};_fddcd ,_adfdc :=_cgaee .(*_fg .PdfObjectInteger );if !_adfdc {_aa .Log .Debug ("\u0042\u0069\u0074\u0073\u0050e\u0072\u0043\u006f\u006f\u0072\u0064\u0069\u006e\u0061\u0074\u0065\u0020\u006eo\u0074\u0020\u0061\u006e\u0020\u0069\u006e\u0074\u0065\u0067\u0065\u0072\u0020\u0028\u0067\u006f\u0074\u0020\u0025\u0054\u0029",_cgaee );
|
||
return nil ,_fg .ErrTypeError ;};_bgfacc .BitsPerCoordinate =_fddcd ;_cgaee =_dgbcg .Get ("\u0042\u0069t\u0073\u0050\u0065r\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074");if _cgaee ==nil {_aa .Log .Debug ("\u0052e\u0071\u0075i\u0072\u0065\u0064\u0020a\u0074\u0074\u0072i\u0062\u0075\u0074\u0065\u0020\u006d\u0069\u0073\u0073in\u0067\u003a\u0020B\u0069\u0074s\u0050\u0065\u0072\u0043\u006f\u006dp\u006f\u006ee\u006e\u0074");
|
||
return nil ,ErrRequiredAttributeMissing ;};_fddcd ,_adfdc =_cgaee .(*_fg .PdfObjectInteger );if !_adfdc {_aa .Log .Debug ("B\u0069\u0074\u0073\u0050\u0065\u0072\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074\u0020\u006e\u006ft\u0020\u0061\u006e\u0020\u0069\u006e\u0074\u0065\u0067\u0065r \u0028\u0067\u006ft\u0020%\u0054\u0029",_cgaee );
|
||
return nil ,_fg .ErrTypeError ;};_bgfacc .BitsPerComponent =_fddcd ;_cgaee =_dgbcg .Get ("B\u0069\u0074\u0073\u0050\u0065\u0072\u0046\u006c\u0061\u0067");if _cgaee ==nil {_aa .Log .Debug ("\u0052\u0065\u0071\u0075\u0069\u0072\u0065\u0064\u0020\u0061\u0074\u0074\u0072i\u0062\u0075\u0074\u0065\u0020\u006di\u0073\u0073\u0069\u006e\u0067\u003a\u0020\u0042\u0069\u0074\u0073\u0050\u0065r\u0046\u006c\u0061\u0067");
|
||
return nil ,ErrRequiredAttributeMissing ;};_fddcd ,_adfdc =_cgaee .(*_fg .PdfObjectInteger );if !_adfdc {_aa .Log .Debug ("B\u0069\u0074\u0073\u0050\u0065\u0072F\u006c\u0061\u0067\u0020\u006e\u006ft\u0020\u0061\u006e\u0020\u0069\u006e\u0074e\u0067\u0065\u0072\u0020\u0028\u0067\u006f\u0074\u0020\u0025T\u0029",_cgaee );
|
||
return nil ,_fg .ErrTypeError ;};_bgfacc .BitsPerComponent =_fddcd ;_cgaee =_dgbcg .Get ("\u0044\u0065\u0063\u006f\u0064\u0065");if _cgaee ==nil {_aa .Log .Debug ("\u0052\u0065\u0071ui\u0072\u0065\u0064\u0020\u0061\u0074\u0074\u0072\u0069b\u0075t\u0065 \u006di\u0073\u0073\u0069\u006e\u0067\u003a\u0020\u0044\u0065\u0063\u006f\u0064\u0065");
|
||
return nil ,ErrRequiredAttributeMissing ;};_febfb ,_adfdc :=_cgaee .(*_fg .PdfObjectArray );if !_adfdc {_aa .Log .Debug ("\u0044\u0065\u0063\u006fd\u0065\u0020\u006e\u006f\u0074\u0020\u0061\u006e\u0020\u0061r\u0072a\u0079\u0020\u0028\u0067\u006f\u0074\u0020%\u0054\u0029",_cgaee );
|
||
return nil ,_fg .ErrTypeError ;};_bgfacc .Decode =_febfb ;if _ggff :=_dgbcg .Get ("\u0046\u0075\u006e\u0063\u0074\u0069\u006f\u006e");_ggff !=nil {_bgfacc .Function =[]PdfFunction {};if _cffeg ,_dagcg :=_ggff .(*_fg .PdfObjectArray );_dagcg {for _ ,_cgfca :=range _cffeg .Elements (){_dbbfe ,_gbcga :=_defgb (_cgfca );
|
||
if _gbcga !=nil {_aa .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0070\u0061\u0072\u0073\u0069n\u0067\u0020\u0066\u0075\u006e\u0063\u0074\u0069\u006f\u006e:\u0020\u0025\u0076",_gbcga );return nil ,_gbcga ;};_bgfacc .Function =append (_bgfacc .Function ,_dbbfe );
|
||
};}else {_afcf ,_fdbee :=_defgb (_ggff );if _fdbee !=nil {_aa .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0070\u0061\u0072\u0073\u0069n\u0067\u0020\u0066\u0075\u006e\u0063\u0074\u0069\u006f\u006e:\u0020\u0025\u0076",_fdbee );return nil ,_fdbee ;
|
||
};_bgfacc .Function =append (_bgfacc .Function ,_afcf );};};return &_bgfacc ,nil ;};
|
||
|
||
// NewPdfColorDeviceGray returns a new grayscale color based on an input grayscale float value in range [0-1].
|
||
func NewPdfColorDeviceGray (grayVal float64 )*PdfColorDeviceGray {_abcbd :=PdfColorDeviceGray (grayVal );return &_abcbd ;};func _daeb (_eeffc *_fg .PdfObjectDictionary )(*PdfFieldChoice ,error ){_ecgg :=&PdfFieldChoice {};_ecgg .Opt ,_ =_fg .GetArray (_eeffc .Get ("\u004f\u0070\u0074"));
|
||
_ecgg .TI ,_ =_fg .GetInt (_eeffc .Get ("\u0054\u0049"));_ecgg .I ,_ =_fg .GetArray (_eeffc .Get ("\u0049"));return _ecgg ,nil ;};
|
||
|
||
// NewPdfColorCalRGB returns a new CalRBG color.
|
||
func NewPdfColorCalRGB (a ,b ,c float64 )*PdfColorCalRGB {_cbcd :=PdfColorCalRGB {a ,b ,c };return &_cbcd ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_geed *PdfActionSetOCGState )ToPdfObject ()_fg .PdfObject {_geed .PdfAction .ToPdfObject ();_gca :=_geed ._bda ;_agg :=_gca .PdfObject .(*_fg .PdfObjectDictionary );_agg .SetIfNotNil ("\u0053",_fg .MakeName (string (ActionTypeSetOCGState )));_agg .SetIfNotNil ("\u0053\u0074\u0061t\u0065",_geed .State );
|
||
_agg .SetIfNotNil ("\u0050\u0072\u0065\u0073\u0065\u0072\u0076\u0065\u0052\u0042",_geed .PreserveRB );return _gca ;};
|
||
|
||
// K returns the value of the key component of the color.
|
||
func (_ebfg *PdfColorDeviceCMYK )K ()float64 {return _ebfg [3]};
|
||
|
||
// ColorFromFloats returns a new PdfColor based on the input slice of color
|
||
// components. The slice should contain a single element between 0 and 1.
|
||
func (_eecf *PdfColorspaceCalGray )ColorFromFloats (vals []float64 )(PdfColor ,error ){if len (vals )!=1{return nil ,_ce .New ("r\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b");};_gecc :=vals [0];if _gecc < 0.0||_gecc > 1.0{_aa .Log .Debug ("\u0063\u006f\u006cor\u0020\u006f\u0075\u0074\u0020\u006f\u0066\u0020\u0043\u0053\u0020\u0072\u0061\u006e\u0067\u0065\u003a\u0020",_gecc );
|
||
return nil ,ErrColorOutOfRange ;};_cbfa :=NewPdfColorCalGray (_gecc );return _cbfa ,nil ;};
|
||
|
||
// GetRuneMetrics returns the character metrics for the specified rune.
|
||
// A bool flag is returned to indicate whether or not the entry was found.
|
||
func (_eeag pdfFontType0 )GetRuneMetrics (r rune )(_eed .CharMetrics ,bool ){if _eeag .DescendantFont ==nil {_aa .Log .Debug ("\u0045\u0052R\u004f\u0052\u003a\u0020\u004e\u006f\u0020\u0064\u0065\u0073\u0063\u0065\u006e\u0064\u0061\u006e\u0074\u002e\u0020\u0066\u006f\u006et=\u0025\u0073",_eeag );
|
||
return _eed .CharMetrics {},false ;};return _eeag .DescendantFont .GetRuneMetrics (r );};func _cgga (_fcggg *_fg .PdfObjectDictionary )(*PdfShadingType5 ,error ){_fdeec :=PdfShadingType5 {};_degaa :=_fcggg .Get ("\u0042\u0069\u0074\u0073\u0050\u0065\u0072\u0043\u006f\u006f\u0072\u0064i\u006e\u0061\u0074\u0065");
|
||
if _degaa ==nil {_aa .Log .Debug ("\u0052e\u0071\u0075i\u0072\u0065\u0064 \u0061\u0074\u0074\u0072\u0069\u0062\u0075t\u0065\u0020\u006d\u0069\u0073\u0073i\u006e\u0067\u003a\u0020\u0042\u0069\u0074\u0073\u0050\u0065\u0072C\u006f\u006f\u0072\u0064\u0069\u006e\u0061\u0074\u0065");
|
||
return nil ,ErrRequiredAttributeMissing ;};_dfcdf ,_adca :=_degaa .(*_fg .PdfObjectInteger );if !_adca {_aa .Log .Debug ("\u0042\u0069\u0074\u0073\u0050e\u0072\u0043\u006f\u006f\u0072\u0064\u0069\u006e\u0061\u0074\u0065\u0020\u006eo\u0074\u0020\u0061\u006e\u0020\u0069\u006e\u0074\u0065\u0067\u0065\u0072\u0020\u0028\u0067\u006f\u0074\u0020\u0025\u0054\u0029",_degaa );
|
||
return nil ,_fg .ErrTypeError ;};_fdeec .BitsPerCoordinate =_dfcdf ;_degaa =_fcggg .Get ("\u0042\u0069t\u0073\u0050\u0065r\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074");if _degaa ==nil {_aa .Log .Debug ("\u0052e\u0071\u0075i\u0072\u0065\u0064\u0020a\u0074\u0074\u0072i\u0062\u0075\u0074\u0065\u0020\u006d\u0069\u0073\u0073in\u0067\u003a\u0020B\u0069\u0074s\u0050\u0065\u0072\u0043\u006f\u006dp\u006f\u006ee\u006e\u0074");
|
||
return nil ,ErrRequiredAttributeMissing ;};_dfcdf ,_adca =_degaa .(*_fg .PdfObjectInteger );if !_adca {_aa .Log .Debug ("B\u0069\u0074\u0073\u0050\u0065\u0072\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074\u0020\u006e\u006ft\u0020\u0061\u006e\u0020\u0069\u006e\u0074\u0065\u0067\u0065r \u0028\u0067\u006ft\u0020%\u0054\u0029",_degaa );
|
||
return nil ,_fg .ErrTypeError ;};_fdeec .BitsPerComponent =_dfcdf ;_degaa =_fcggg .Get ("\u0056\u0065\u0072\u0074\u0069\u0063\u0065\u0073\u0050e\u0072\u0052\u006f\u0077");if _degaa ==nil {_aa .Log .Debug ("\u0052\u0065\u0071u\u0069\u0072\u0065\u0064\u0020\u0061\u0074\u0074\u0072\u0069\u0062\u0075\u0074\u0065\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u003a\u0020\u0056\u0065\u0072\u0074\u0069c\u0065\u0073\u0050\u0065\u0072\u0052\u006f\u0077");
|
||
return nil ,ErrRequiredAttributeMissing ;};_dfcdf ,_adca =_degaa .(*_fg .PdfObjectInteger );if !_adca {_aa .Log .Debug ("\u0056\u0065\u0072\u0074\u0069\u0063\u0065\u0073\u0050\u0065\u0072\u0052\u006f\u0077\u0020\u006e\u006f\u0074\u0020\u0061\u006e\u0020\u0069\u006et\u0065\u0067\u0065\u0072\u0020(\u0067\u006ft\u0020\u0025\u0054\u0029",_degaa );
|
||
return nil ,_fg .ErrTypeError ;};_fdeec .VerticesPerRow =_dfcdf ;_degaa =_fcggg .Get ("\u0044\u0065\u0063\u006f\u0064\u0065");if _degaa ==nil {_aa .Log .Debug ("\u0052\u0065\u0071ui\u0072\u0065\u0064\u0020\u0061\u0074\u0074\u0072\u0069b\u0075t\u0065 \u006di\u0073\u0073\u0069\u006e\u0067\u003a\u0020\u0044\u0065\u0063\u006f\u0064\u0065");
|
||
return nil ,ErrRequiredAttributeMissing ;};_geefb ,_adca :=_degaa .(*_fg .PdfObjectArray );if !_adca {_aa .Log .Debug ("\u0044\u0065\u0063\u006fd\u0065\u0020\u006e\u006f\u0074\u0020\u0061\u006e\u0020\u0061r\u0072a\u0079\u0020\u0028\u0067\u006f\u0074\u0020%\u0054\u0029",_degaa );
|
||
return nil ,_fg .ErrTypeError ;};_fdeec .Decode =_geefb ;if _baeb :=_fcggg .Get ("\u0046\u0075\u006e\u0063\u0074\u0069\u006f\u006e");_baeb !=nil {_fdeec .Function =[]PdfFunction {};if _cfbad ,_fgefcf :=_baeb .(*_fg .PdfObjectArray );_fgefcf {for _ ,_afead :=range _cfbad .Elements (){_ffeba ,_baddd :=_defgb (_afead );
|
||
if _baddd !=nil {_aa .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0070\u0061\u0072\u0073\u0069n\u0067\u0020\u0066\u0075\u006e\u0063\u0074\u0069\u006f\u006e:\u0020\u0025\u0076",_baddd );return nil ,_baddd ;};_fdeec .Function =append (_fdeec .Function ,_ffeba );
|
||
};}else {_cfegc ,_abgcg :=_defgb (_baeb );if _abgcg !=nil {_aa .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0070\u0061\u0072\u0073\u0069n\u0067\u0020\u0066\u0075\u006e\u0063\u0074\u0069\u006f\u006e:\u0020\u0025\u0076",_abgcg );return nil ,_abgcg ;
|
||
};_fdeec .Function =append (_fdeec .Function ,_cfegc );};};return &_fdeec ,nil ;};
|
||
|
||
// NewReaderOpts generates a default `ReaderOpts` instance.
|
||
func NewReaderOpts ()*ReaderOpts {return &ReaderOpts {Password :"",LazyLoad :true }};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_ffcbb *PdfTransformParamsDocMDP )ToPdfObject ()_fg .PdfObject {_geaeb :=_fg .MakeDict ();_geaeb .SetIfNotNil ("\u0054\u0079\u0070\u0065",_ffcbb .Type );_geaeb .SetIfNotNil ("\u0056",_ffcbb .V );_geaeb .SetIfNotNil ("\u0050",_ffcbb .P );return _geaeb ;
|
||
};func _gfacd (_ffbef string )(string ,error ){var _bagda _cb .Buffer ;_bagda .WriteString (_ffbef );_dcfecf :=make ([]byte ,8+16);_bfbgd :=_g .Now ().UTC ().UnixNano ();_df .BigEndian .PutUint64 (_dcfecf ,uint64 (_bfbgd ));_ ,_ffgfc :=_eg .Read (_dcfecf [8:]);
|
||
if _ffgfc !=nil {return "",_ffgfc ;};_bagda .WriteString (_ed .EncodeToString (_dcfecf ));return _bagda .String (),nil ;};
|
||
|
||
// GetNumComponents returns the number of color components of the colorspace device.
|
||
// Returns 1 for a CalGray device.
|
||
func (_ccag *PdfColorspaceCalGray )GetNumComponents ()int {return 1};
|
||
|
||
// NewPdfActionGoTo3DView returns a new "goTo3DView" action.
|
||
func NewPdfActionGoTo3DView ()*PdfActionGoTo3DView {_fae :=NewPdfAction ();_cgd :=&PdfActionGoTo3DView {};_cgd .PdfAction =_fae ;_fae .SetContext (_cgd );return _cgd ;};func (_geeb *PdfReader )newPdfActionFromIndirectObject (_gab *_fg .PdfIndirectObject )(*PdfAction ,error ){_gd ,_fbb :=_gab .PdfObject .(*_fg .PdfObjectDictionary );
|
||
if !_fbb {return nil ,_d .Errorf ("\u0061\u0063\u0074\u0069\u006f\u006e\u0020\u0069\u006e\u0064\u0069\u0072\u0065\u0063\u0074\u0020\u006f\u0062j\u0065\u0063\u0074\u0020\u006e\u006f\u0074 \u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0069\u006e\u0067\u0020a\u0020\u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061\u0072\u0079");
|
||
};if model :=_geeb ._edebb .GetModelFromPrimitive (_gd );model !=nil {_gaa ,_gbc :=model .(*PdfAction );if !_gbc {return nil ,_d .Errorf ("\u0063\u0061c\u0068\u0065\u0064\u0020\u006d\u006f\u0064\u0065\u006c\u0020\u006e\u006f\u0074\u0020\u0061\u0020\u0050\u0044\u0046\u0020\u0061\u0063ti\u006f\u006e");
|
||
};return _gaa ,nil ;};_fdf :=&PdfAction {};_fdf ._bda =_gab ;_geeb ._edebb .Register (_gd ,_fdf );if _gcc :=_gd .Get ("\u0054\u0079\u0070\u0065");_gcc !=nil {_cfag ,_fdfg :=_gcc .(*_fg .PdfObjectName );if !_fdfg {_aa .Log .Trace ("\u0049\u006e\u0063\u006f\u006d\u0070\u0061\u0074\u0069\u0062\u0069\u006c\u0069\u0074\u0079\u0021\u0020\u0049\u006e\u0076a\u006c\u0069\u0064\u0020\u0074\u0079\u0070\u0065\u0020\u006f\u0066\u0020\u0054\u0079\u0070\u0065\u0020\u0028\u0025\u0054\u0029\u0020\u002d\u0020\u0073\u0068\u006f\u0075\u006c\u0064 \u0062\u0065\u0020\u004e\u0061m\u0065",_gcc );
|
||
}else {if *_cfag !="\u0041\u0063\u0074\u0069\u006f\u006e"{_aa .Log .Trace ("\u0055\u006e\u0073u\u0073\u0070\u0065\u0063t\u0065\u0064\u0020\u0054\u0079\u0070\u0065 \u0021\u003d\u0020\u0041\u0063\u0074\u0069\u006f\u006e\u0020\u0028\u0025\u0073\u0029",*_cfag );
|
||
};_fdf .Type =_cfag ;};};if _ceab :=_gd .Get ("\u004e\u0065\u0078\u0074");_ceab !=nil {_fdf .Next =_ceab ;};if _fea :=_gd .Get ("\u0053");_fea !=nil {_fdf .S =_fea ;};_bfgd ,_ffg :=_fdf .S .(*_fg .PdfObjectName );if !_ffg {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052:\u0020\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0053\u0020\u006f\u0062j\u0065\u0063\u0074\u0020\u0074\u0079\u0070\u0065\u0020\u0021\u003d\u0020\u006e\u0061\u006d\u0065\u0020\u0028\u0025\u0054\u0029",_fdf .S );
|
||
return nil ,_d .Errorf ("\u0069\u006e\u0076al\u0069\u0064\u0020\u0053\u0020\u006f\u0062\u006a\u0065c\u0074 \u0074y\u0070e\u0020\u0021\u003d\u0020\u006e\u0061\u006d\u0065\u0020\u0028\u0025\u0054\u0029",_fdf .S );};_bbd :=PdfActionType (_bfgd .String ());
|
||
switch _bbd {case ActionTypeGoTo :_fdb ,_fbbd :=_geeb .newPdfActionGotoFromDict (_gd );if _fbbd !=nil {return nil ,_fbbd ;};_fdb .PdfAction =_fdf ;_fdf ._bd =_fdb ;return _fdf ,nil ;case ActionTypeGoToR :_bdf ,_dag :=_geeb .newPdfActionGotoRFromDict (_gd );
|
||
if _dag !=nil {return nil ,_dag ;};_bdf .PdfAction =_fdf ;_fdf ._bd =_bdf ;return _fdf ,nil ;case ActionTypeGoToE :_eef ,_beb :=_geeb .newPdfActionGotoEFromDict (_gd );if _beb !=nil {return nil ,_beb ;};_eef .PdfAction =_fdf ;_fdf ._bd =_eef ;return _fdf ,nil ;
|
||
case ActionTypeLaunch :_bgfa ,_ddaa :=_geeb .newPdfActionLaunchFromDict (_gd );if _ddaa !=nil {return nil ,_ddaa ;};_bgfa .PdfAction =_fdf ;_fdf ._bd =_bgfa ;return _fdf ,nil ;case ActionTypeThread :_gdb ,_eff :=_geeb .newPdfActionThreadFromDict (_gd );
|
||
if _eff !=nil {return nil ,_eff ;};_gdb .PdfAction =_fdf ;_fdf ._bd =_gdb ;return _fdf ,nil ;case ActionTypeURI :_aae ,_egd :=_geeb .newPdfActionURIFromDict (_gd );if _egd !=nil {return nil ,_egd ;};_aae .PdfAction =_fdf ;_fdf ._bd =_aae ;return _fdf ,nil ;
|
||
case ActionTypeSound :_bde ,_dcf :=_geeb .newPdfActionSoundFromDict (_gd );if _dcf !=nil {return nil ,_dcf ;};_bde .PdfAction =_fdf ;_fdf ._bd =_bde ;return _fdf ,nil ;case ActionTypeMovie :_gfa ,_aaf :=_geeb .newPdfActionMovieFromDict (_gd );if _aaf !=nil {return nil ,_aaf ;
|
||
};_gfa .PdfAction =_fdf ;_fdf ._bd =_gfa ;return _fdf ,nil ;case ActionTypeHide :_cgb ,_gbd :=_geeb .newPdfActionHideFromDict (_gd );if _gbd !=nil {return nil ,_gbd ;};_cgb .PdfAction =_fdf ;_fdf ._bd =_cgb ;return _fdf ,nil ;case ActionTypeNamed :_fag ,_gabg :=_geeb .newPdfActionNamedFromDict (_gd );
|
||
if _gabg !=nil {return nil ,_gabg ;};_fag .PdfAction =_fdf ;_fdf ._bd =_fag ;return _fdf ,nil ;case ActionTypeSubmitForm :_cfb ,_bdg :=_geeb .newPdfActionSubmitFormFromDict (_gd );if _bdg !=nil {return nil ,_bdg ;};_cfb .PdfAction =_fdf ;_fdf ._bd =_cfb ;
|
||
return _fdf ,nil ;case ActionTypeResetForm :_aee ,_dcd :=_geeb .newPdfActionResetFormFromDict (_gd );if _dcd !=nil {return nil ,_dcd ;};_aee .PdfAction =_fdf ;_fdf ._bd =_aee ;return _fdf ,nil ;case ActionTypeImportData :_fegb ,_fce :=_geeb .newPdfActionImportDataFromDict (_gd );
|
||
if _fce !=nil {return nil ,_fce ;};_fegb .PdfAction =_fdf ;_fdf ._bd =_fegb ;return _fdf ,nil ;case ActionTypeSetOCGState :_ffc ,_bea :=_geeb .newPdfActionSetOCGStateFromDict (_gd );if _bea !=nil {return nil ,_bea ;};_ffc .PdfAction =_fdf ;_fdf ._bd =_ffc ;
|
||
return _fdf ,nil ;case ActionTypeRendition :_bcf ,_acf :=_geeb .newPdfActionRenditionFromDict (_gd );if _acf !=nil {return nil ,_acf ;};_bcf .PdfAction =_fdf ;_fdf ._bd =_bcf ;return _fdf ,nil ;case ActionTypeTrans :_gba ,_bacb :=_geeb .newPdfActionTransFromDict (_gd );
|
||
if _bacb !=nil {return nil ,_bacb ;};_gba .PdfAction =_fdf ;_fdf ._bd =_gba ;return _fdf ,nil ;case ActionTypeGoTo3DView :_ecc ,_aga :=_geeb .newPdfActionGoTo3DViewFromDict (_gd );if _aga !=nil {return nil ,_aga ;};_ecc .PdfAction =_fdf ;_fdf ._bd =_ecc ;
|
||
return _fdf ,nil ;case ActionTypeJavaScript :_bbg ,_edf :=_geeb .newPdfActionJavaScriptFromDict (_gd );if _edf !=nil {return nil ,_edf ;};_bbg .PdfAction =_fdf ;_fdf ._bd =_bbg ;return _fdf ,nil ;};_aa .Log .Debug ("\u0045\u0052\u0052OR\u003a\u0020\u0049\u0067\u006e\u006f\u0072\u0069\u006eg\u0020u\u006ek\u006eo\u0077\u006e\u0020\u0061\u0063\u0074\u0069\u006f\u006e\u003a\u0020\u0025\u0073",_bbd );
|
||
return nil ,nil ;};
|
||
|
||
// GetTrailer returns the PDF's trailer dictionary.
|
||
func (_aaeacc *PdfReader )GetTrailer ()(*_fg .PdfObjectDictionary ,error ){_badde :=_aaeacc ._ccgg .GetTrailer ();if _badde ==nil {return nil ,_ce .New ("\u0074r\u0061i\u006c\u0065\u0072\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067");};return _badde ,nil ;
|
||
};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_ddbc *PdfAnnotationUnderline )ToPdfObject ()_fg .PdfObject {_ddbc .PdfAnnotation .ToPdfObject ();_cafg :=_ddbc ._agb ;_bee :=_cafg .PdfObject .(*_fg .PdfObjectDictionary );_ddbc .PdfAnnotationMarkup .appendToPdfDictionary (_bee );_bee .SetIfNotNil ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u0055n\u0064\u0065\u0072\u006c\u0069\u006ee"));
|
||
_bee .SetIfNotNil ("\u0051\u0075\u0061\u0064\u0050\u006f\u0069\u006e\u0074\u0073",_ddbc .QuadPoints );return _cafg ;};
|
||
|
||
// SetPdfSubject sets the Subject attribute of the output PDF.
|
||
func SetPdfSubject (subject string ){_baacg .Lock ();defer _baacg .Unlock ();_ggbag =subject };var _ pdfFont =(*pdfCIDFontType2 )(nil );func (_dgceb *PdfWriter )updateObjectNumbers (){_dabgc :=_dgceb .ObjNumOffset ;_aabfb :=0;for _ ,_acbgb :=range _dgceb ._bbfd {_dcfgf :=int64 (_aabfb +1+_dabgc );
|
||
_dcdf :=true ;if _dgceb ._cdafg {if _faaab ,_bagg :=_dgceb ._cbeab [_acbgb ];_bagg {_dcfgf =_faaab ;_dcdf =false ;};};switch _abed :=_acbgb .(type ){case *_fg .PdfIndirectObject :_abed .ObjectNumber =_dcfgf ;_abed .GenerationNumber =0;case *_fg .PdfObjectStream :_abed .ObjectNumber =_dcfgf ;
|
||
_abed .GenerationNumber =0;case *_fg .PdfObjectStreams :_abed .ObjectNumber =_dcfgf ;_abed .GenerationNumber =0;default:_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a \u0055\u006e\u006b\u006e\u006f\u0077\u006e\u0020\u0074\u0079\u0070\u0065\u0020%\u0054\u0020\u002d\u0020\u0073\u006b\u0069p\u0070\u0069\u006e\u0067",_abed );
|
||
continue ;};if _dcdf {_aabfb ++;};};_gdadg :=func (_ggafc _fg .PdfObject )int64 {switch _gdaac :=_ggafc .(type ){case *_fg .PdfIndirectObject :return _gdaac .ObjectNumber ;case *_fg .PdfObjectStream :return _gdaac .ObjectNumber ;case *_fg .PdfObjectStreams :return _gdaac .ObjectNumber ;
|
||
};return 0;};_ad .SliceStable (_dgceb ._bbfd ,func (_bgab ,_bfaae int )bool {return _gdadg (_dgceb ._bbfd [_bgab ])< _gdadg (_dgceb ._bbfd [_bfaae ])});};
|
||
|
||
// IsCheckbox returns true if the button field represents a checkbox, false otherwise.
|
||
func (_cbedc *PdfFieldButton )IsCheckbox ()bool {return _cbedc .GetType ()==ButtonTypeCheckbox };
|
||
|
||
// PdfColorDeviceCMYK is a CMYK32 color, where each component is defined in the range 0.0 - 1.0 where 1.0 is the primary intensity.
|
||
type PdfColorDeviceCMYK [4]float64 ;func (_afddc *PdfReader )buildPageList (_cdecc *_fg .PdfIndirectObject ,_gcbe *_fg .PdfIndirectObject ,_aaagb map[_fg .PdfObject ]struct{})error {if _cdecc ==nil {return nil ;};if _ ,_gcfff :=_aaagb [_cdecc ];_gcfff {_aa .Log .Debug ("\u0043\u0079\u0063l\u0069\u0063\u0020\u0072e\u0063\u0075\u0072\u0073\u0069\u006f\u006e,\u0020\u0073\u006b\u0069\u0070\u0070\u0069\u006e\u0067\u0020\u0028\u0025\u0076\u0029",_cdecc .ObjectNumber );
|
||
return nil ;};_aaagb [_cdecc ]=struct{}{};_ebecb ,_ecgea :=_cdecc .PdfObject .(*_fg .PdfObjectDictionary );if !_ecgea {return _ce .New ("n\u006f\u0064\u0065\u0020no\u0074 \u0061\u0020\u0064\u0069\u0063t\u0069\u006f\u006e\u0061\u0072\u0079");};_dcdag ,_ecgea :=(*_ebecb ).Get ("\u0054\u0079\u0070\u0065").(*_fg .PdfObjectName );
|
||
if !_ecgea {if _ebecb .Get ("\u004b\u0069\u0064\u0073")==nil {return _ce .New ("\u006e\u006f\u0064\u0065 \u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0054\u0079p\u0065 \u0028\u0052\u0065\u0071\u0075\u0069\u0072e\u0064\u0029");};_aa .Log .Debug ("ER\u0052\u004fR\u003a\u0020\u006e\u006f\u0064\u0065\u0020\u006d\u0069s\u0073\u0069\u006e\u0067\u0020\u0054\u0079\u0070\u0065\u002c\u0020\u0062\u0075\u0074\u0020\u0068\u0061\u0073\u0020\u004b\u0069\u0064\u0073\u002e\u0020\u0041\u0073\u0073u\u006di\u006e\u0067\u0020\u0050\u0061\u0067\u0065\u0073 \u006eo\u0064\u0065.");
|
||
_dcdag =_fg .MakeName ("\u0050\u0061\u0067e\u0073");_ebecb .Set ("\u0054\u0079\u0070\u0065",_dcdag );};_aa .Log .Trace ("\u0062\u0075\u0069\u006c\u0064\u0050a\u0067\u0065\u004c\u0069\u0073\u0074\u0020\u006e\u006f\u0064\u0065\u0020\u0074y\u0070\u0065\u003a\u0020\u0025\u0073\u0020(\u0025\u002b\u0076\u0029",*_dcdag ,_cdecc );
|
||
if *_dcdag =="\u0050\u0061\u0067\u0065"{_dagef ,_cgdd :=_afddc .newPdfPageFromDict (_ebecb );if _cgdd !=nil {return _cgdd ;};_dagef .setContainer (_cdecc );if _gcbe !=nil {_ebecb .Set ("\u0050\u0061\u0072\u0065\u006e\u0074",_gcbe );};_afddc ._bgce =append (_afddc ._bgce ,_cdecc );
|
||
_afddc .PageList =append (_afddc .PageList ,_dagef );return nil ;};if *_dcdag !="\u0050\u0061\u0067e\u0073"{_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0054\u0061\u0062\u006c\u0065\u0020\u006f\u0066\u0020\u0063\u006fnt\u0065n\u0074\u0020\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0069\u006e\u0067 \u006e\u006f\u006e\u0020\u0050\u0061\u0067\u0065\u002f\u0050\u0061\u0067\u0065\u0073\u0020\u006f\u0062j\u0065\u0063\u0074\u0021\u0020\u0028\u0025\u0073\u0029",_dcdag );
|
||
return _ce .New ("\u0074\u0061\u0062\u006c\u0065\u0020o\u0066\u0020\u0063\u006f\u006e\u0074\u0065\u006e\u0074\u0020\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0069\u006e\u0067 \u006e\u006f\u006e\u0020\u0050\u0061\u0067\u0065\u002f\u0050\u0061\u0067\u0065\u0073 \u006fb\u006a\u0065\u0063\u0074");
|
||
};if _gcbe !=nil {_ebecb .Set ("\u0050\u0061\u0072\u0065\u006e\u0074",_gcbe );};if !_afddc ._beegg {_egdee :=_afddc .traverseObjectData (_cdecc );if _egdee !=nil {return _egdee ;};};_dacfb ,_cgcg :=_afddc ._ccgg .Resolve (_ebecb .Get ("\u004b\u0069\u0064\u0073"));
|
||
if _cgcg !=nil {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a \u0046\u0061\u0069\u006c\u0065\u0064\u0020\u006c\u006f\u0061\u0064\u0069\u006eg\u0020\u004b\u0069\u0064\u0073\u0020\u006fb\u006a\u0065\u0063\u0074");return _cgcg ;};var _acdea *_fg .PdfObjectArray ;
|
||
_acdea ,_ecgea =_dacfb .(*_fg .PdfObjectArray );if !_ecgea {_gbeaf ,_fggdf :=_dacfb .(*_fg .PdfIndirectObject );if !_fggdf {return _ce .New ("\u0069\u006e\u0076\u0061li\u0064\u0020\u004b\u0069\u0064\u0073\u0020\u006f\u0062\u006a\u0065\u0063\u0074");};_acdea ,_ecgea =_gbeaf .PdfObject .(*_fg .PdfObjectArray );
|
||
if !_ecgea {return _ce .New ("\u0069\u006e\u0076\u0061l\u0069\u0064\u0020\u004b\u0069\u0064\u0073\u0020\u0069\u006ed\u0069r\u0065\u0063\u0074\u0020\u006f\u0062\u006ae\u0063\u0074");};};_aa .Log .Trace ("\u004b\u0069\u0064\u0073\u003a\u0020\u0025\u0073",_acdea );
|
||
for _fbfdc ,_ffdfbd :=range _acdea .Elements (){_bgafg ,_cdgbf :=_fg .GetIndirect (_ffdfbd );if !_cdgbf {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0050\u0061\u0067\u0065\u0020\u006e\u006f\u0074\u0020\u0069\u006e\u0064\u0069\u0072\u0065\u0063\u0074 \u006f\u0062\u006a\u0065\u0063t\u0020\u002d \u0028\u0025\u0073\u0029",_bgafg );
|
||
return _ce .New ("\u0070a\u0067\u0065\u0020\u006e\u006f\u0074\u0020\u0069\u006e\u0064\u0069r\u0065\u0063\u0074\u0020\u006f\u0062\u006a\u0065\u0063\u0074");};_acdea .Set (_fbfdc ,_bgafg );_cgcg =_afddc .buildPageList (_bgafg ,_cdecc ,_aaagb );if _cgcg !=nil {return _cgcg ;
|
||
};};return nil ;};
|
||
|
||
// GetDSS gets the DSS dictionary (ETSI TS 102 778-4 V1.1.1) of the current
|
||
// document revision.
|
||
func (_fadac *PdfAppender )GetDSS ()(_ggbf *DSS ){return _fadac ._dgbf };func _cbee (_deffa []byte )(_ddeb ,_cadb string ,_gdbdd error ){_aa .Log .Trace ("g\u0065\u0074\u0041\u0053CI\u0049S\u0065\u0063\u0074\u0069\u006fn\u0073\u003a\u0020\u0025\u0064\u0020",len (_deffa ));
|
||
_cfbcf :=_edegd .FindIndex (_deffa );if _cfbcf ==nil {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a \u0067\u0065\u0074\u0041\u0053\u0043\u0049\u0049\u0053\u0065\u0063\u0074\u0069o\u006e\u0073\u002e\u0020\u004e\u006f\u0020d\u0069\u0063\u0074\u002e");
|
||
return "","",_fg .ErrTypeError ;};_bbbab :=_cfbcf [1];_caedb :=_dc .Index (string (_deffa [_bbbab :]),_ccce );if _caedb < 0{_ddeb =string (_deffa [_bbbab :]);return _ddeb ,"",nil ;};_ddgec :=_bbbab +_caedb ;_ddeb =string (_deffa [_bbbab :_ddgec ]);_gecfe :=_ddgec ;
|
||
_caedb =_dc .Index (string (_deffa [_gecfe :]),_gfbc );if _caedb < 0{_aa .Log .Debug ("\u0045\u0052\u0052O\u0052\u003a\u0020\u0067e\u0074\u0041\u0053\u0043\u0049\u0049\u0053e\u0063\u0074\u0069\u006f\u006e\u0073\u002e\u0020\u0065\u0072\u0072\u003d\u0025\u0076",_gdbdd );
|
||
return "","",_fg .ErrTypeError ;};_fbcd :=_gecfe +_caedb ;_cadb =string (_deffa [_gecfe :_fbcd ]);return _ddeb ,_cadb ,nil ;};
|
||
|
||
// Sign signs a specific page with a digital signature.
|
||
// The signature field parameter must have a valid signature dictionary
|
||
// specified by its V field.
|
||
func (_gag *PdfAppender )Sign (pageNum int ,field *PdfFieldSignature )error {if field ==nil {return _ce .New ("\u0073\u0069g\u006e\u0061\u0074\u0075\u0072\u0065\u0020\u0066\u0069\u0065\u006c\u0064\u0020\u0063\u0061\u006e\u006e\u006f\u0074\u0020\u0062\u0065 n\u0069\u006c");
|
||
};_gfdg :=field .V ;if _gfdg ==nil {return _ce .New ("\u0073\u0069\u0067na\u0074\u0075\u0072\u0065\u0020\u0064\u0069\u0063\u0074i\u006fn\u0061r\u0079 \u0063\u0061\u006e\u006e\u006f\u0074\u0020\u0062\u0065\u0020\u006e\u0069\u006c");};_badeg :=pageNum -1;
|
||
if _badeg < 0||_badeg > len (_gag ._agbg )-1{return _d .Errorf ("\u0070\u0061\u0067\u0065\u0020\u0025\u0064\u0020\u006e\u006f\u0074\u0020f\u006f\u0075\u006e\u0064",pageNum );};_bcee :=_gag .Reader .PageList [_badeg ];field .P =_bcee .ToPdfObject ();if field .T ==nil ||field .T .String ()==""{field .T =_fg .MakeString (_d .Sprintf ("\u0053\u0069\u0067n\u0061\u0074\u0075\u0072\u0065\u0020\u0025\u0064",pageNum ));
|
||
};_bcee .AddAnnotation (field .PdfAnnotationWidget .PdfAnnotation );if _gag ._cacc ==_gag ._cbb .AcroForm {_gag ._cacc =_gag .Reader .AcroForm ;};_aegg :=_gag ._cacc ;if _aegg ==nil {_aegg =NewPdfAcroForm ();};_aegg .SigFlags =_fg .MakeInteger (3);if _aegg .NeedAppearances !=nil {_aegg .NeedAppearances =nil ;
|
||
};_ggdc :=append (_aegg .AllFields (),field .PdfField );_aegg .Fields =&_ggdc ;_gag .ReplaceAcroForm (_aegg );_gag .UpdatePage (_bcee );_gag ._agbg [_badeg ]=_bcee ;if _ ,_aebdg :=field .V .GetDocMDPPermission ();_aebdg {_gag ._fege =NewPermissions (field .V );
|
||
};return nil ;};
|
||
|
||
// ColorFromPdfObjects returns a new PdfColor based on the input slice of color
|
||
// components. The slice should contain three PdfObjectFloat elements representing
|
||
// the L, A and B components of the color.
|
||
func (_cagb *PdfColorspaceLab )ColorFromPdfObjects (objects []_fg .PdfObject )(PdfColor ,error ){if len (objects )!=3{return nil ,_ce .New ("r\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b");};_gcfd ,_fgfd :=_fg .GetNumbersAsFloat (objects );
|
||
if _fgfd !=nil {return nil ,_fgfd ;};return _cagb .ColorFromFloats (_gcfd );};
|
||
|
||
// WriteString outputs the object as it is to be written to file.
|
||
func (_gdefa *PdfTransformParamsDocMDP )WriteString ()string {return _gdefa .ToPdfObject ().WriteString ();};func (_bbfdb *PdfWriter )mapObjectStreams (_bgbgg bool )(map[_fg .PdfObject ]bool ,bool ){_cgacg :=make (map[_fg .PdfObject ]bool );for _ ,_gbeca :=range _bbfdb ._bbfd {if _cgfbd ,_ebbdg :=_gbeca .(*_fg .PdfObjectStreams );
|
||
_ebbdg {_bgbgg =true ;for _ ,_cecda :=range _cgfbd .Elements (){_cgacg [_cecda ]=true ;if _deeba ,_fabdb :=_cecda .(*_fg .PdfIndirectObject );_fabdb {_cgacg [_deeba .PdfObject ]=true ;};};};};return _cgacg ,_bgbgg ;};
|
||
|
||
// NewStandard14Font returns the standard 14 font named `basefont` as a *PdfFont, or an error if it
|
||
// `basefont` is not one of the standard 14 font names.
|
||
func NewStandard14Font (basefont StdFontName )(*PdfFont ,error ){_ffaf ,_edcb :=_aedae (basefont );if _edcb !=nil {return nil ,_edcb ;};if basefont !=SymbolName &&basefont !=ZapfDingbatsName {_ffaf ._bdgda =_dg .NewWinAnsiEncoder ();};return &PdfFont {_gcaeff :&_ffaf },nil ;
|
||
};func (_gcce *PdfReader )newPdfAnnotationFreeTextFromDict (_fgfag *_fg .PdfObjectDictionary )(*PdfAnnotationFreeText ,error ){_dfe :=PdfAnnotationFreeText {};_dbg ,_fgef :=_gcce .newPdfAnnotationMarkupFromDict (_fgfag );if _fgef !=nil {return nil ,_fgef ;
|
||
};_dfe .PdfAnnotationMarkup =_dbg ;_dfe .DA =_fgfag .Get ("\u0044\u0041");_dfe .Q =_fgfag .Get ("\u0051");_dfe .RC =_fgfag .Get ("\u0052\u0043");_dfe .DS =_fgfag .Get ("\u0044\u0053");_dfe .CL =_fgfag .Get ("\u0043\u004c");_dfe .IT =_fgfag .Get ("\u0049\u0054");
|
||
_dfe .BE =_fgfag .Get ("\u0042\u0045");_dfe .RD =_fgfag .Get ("\u0052\u0044");_dfe .BS =_fgfag .Get ("\u0042\u0053");_dfe .LE =_fgfag .Get ("\u004c\u0045");return &_dfe ,nil ;};
|
||
|
||
// HasShadingByName checks whether a shading is defined by the specified keyName.
|
||
func (_aaegc *PdfPageResources )HasShadingByName (keyName _fg .PdfObjectName )bool {_ ,_feaag :=_aaegc .GetShadingByName (keyName );return _feaag ;};type fontFile struct{_gaefe string ;_cede string ;_ffff _dg .SimpleEncoder ;};func (_bcccg *PdfWriter )copyObject (_ddbb _fg .PdfObject ,_bcgg map[_fg .PdfObject ]_fg .PdfObject ,_gbfaf map[_fg .PdfObject ]struct{},_cdgae bool )_fg .PdfObject {_bdfbfe :=!_bcccg ._cdafg &&_gbfaf !=nil ;
|
||
if _cabcge ,_edagc :=_bcgg [_ddbb ];_edagc {if _bdfbfe &&!_cdgae {delete (_gbfaf ,_ddbb );};return _cabcge ;};if _ddbb ==nil {_ffda :=_fg .MakeNull ();return _ffda ;};_aedgg :=_ddbb ;switch _adafg :=_ddbb .(type ){case *_fg .PdfObjectArray :_eeebbb :=_fg .MakeArray ();
|
||
_aedgg =_eeebbb ;_bcgg [_ddbb ]=_aedgg ;for _ ,_ffacc :=range _adafg .Elements (){_eeebbb .Append (_bcccg .copyObject (_ffacc ,_bcgg ,_gbfaf ,_cdgae ));};case *_fg .PdfObjectStreams :_efffa :=&_fg .PdfObjectStreams {PdfObjectReference :_adafg .PdfObjectReference };
|
||
_aedgg =_efffa ;_bcgg [_ddbb ]=_aedgg ;for _ ,_egdddg :=range _adafg .Elements (){_efffa .Append (_bcccg .copyObject (_egdddg ,_bcgg ,_gbfaf ,_cdgae ));};case *_fg .PdfObjectStream :_gccbc :=&_fg .PdfObjectStream {Stream :_adafg .Stream ,PdfObjectReference :_adafg .PdfObjectReference };
|
||
_aedgg =_gccbc ;_bcgg [_ddbb ]=_aedgg ;_gccbc .PdfObjectDictionary =_bcccg .copyObject (_adafg .PdfObjectDictionary ,_bcgg ,_gbfaf ,_cdgae ).(*_fg .PdfObjectDictionary );case *_fg .PdfObjectDictionary :var _bbgac bool ;if _bdfbfe &&!_cdgae {if _cgdbg ,_ :=_fg .GetNameVal (_adafg .Get ("\u0054\u0079\u0070\u0065"));
|
||
_cgdbg =="\u0050\u0061\u0067\u0065"{_ ,_acda :=_bcccg ._cbdbf [_adafg ];_cdgae =!_acda ;_bbgac =_cdgae ;};};_dfbdc :=_fg .MakeDict ();_aedgg =_dfbdc ;_bcgg [_ddbb ]=_aedgg ;for _ ,_bdcb :=range _adafg .Keys (){_dfbdc .Set (_bdcb ,_bcccg .copyObject (_adafg .Get (_bdcb ),_bcgg ,_gbfaf ,_cdgae ));
|
||
};if _bbgac {_aedgg =_fg .MakeNull ();_cdgae =false ;};case *_fg .PdfIndirectObject :_dadcd :=&_fg .PdfIndirectObject {PdfObjectReference :_adafg .PdfObjectReference };_aedgg =_dadcd ;_bcgg [_ddbb ]=_aedgg ;_dadcd .PdfObject =_bcccg .copyObject (_adafg .PdfObject ,_bcgg ,_gbfaf ,_cdgae );
|
||
case *_fg .PdfObjectString :_cggea :=*_adafg ;_aedgg =&_cggea ;_bcgg [_ddbb ]=_aedgg ;case *_fg .PdfObjectName :_cecag :=*_adafg ;_aedgg =&_cecag ;_bcgg [_ddbb ]=_aedgg ;case *_fg .PdfObjectNull :_aedgg =_fg .MakeNull ();_bcgg [_ddbb ]=_aedgg ;case *_fg .PdfObjectInteger :_bdfe :=*_adafg ;
|
||
_aedgg =&_bdfe ;_bcgg [_ddbb ]=_aedgg ;case *_fg .PdfObjectReference :_baebc :=*_adafg ;_aedgg =&_baebc ;_bcgg [_ddbb ]=_aedgg ;case *_fg .PdfObjectFloat :_bgcb :=*_adafg ;_aedgg =&_bgcb ;_bcgg [_ddbb ]=_aedgg ;case *_fg .PdfObjectBool :_gfdbdb :=*_adafg ;
|
||
_aedgg =&_gfdbdb ;_bcgg [_ddbb ]=_aedgg ;case *pdfSignDictionary :_decceb :=&pdfSignDictionary {PdfObjectDictionary :_fg .MakeDict (),_afcd :_adafg ._afcd ,_cggdd :_adafg ._cggdd };_aedgg =_decceb ;_bcgg [_ddbb ]=_aedgg ;for _ ,_efacc :=range _adafg .Keys (){_decceb .Set (_efacc ,_bcccg .copyObject (_adafg .Get (_efacc ),_bcgg ,_gbfaf ,_cdgae ));
|
||
};default:_aa .Log .Info ("\u0054\u004f\u0044\u004f\u0028\u0061\u0035\u0069\u0029\u003a\u0020\u0069\u006dp\u006c\u0065\u006d\u0065\u006e\u0074 \u0063\u006f\u0070\u0079\u004f\u0062\u006a\u0065\u0063\u0074\u0020\u0066\u006fr\u0020\u0025\u002b\u0076",_ddbb );
|
||
};if _bdfbfe &&_cdgae {_gbfaf [_ddbb ]=struct{}{};};return _aedgg ;};
|
||
|
||
// GetContentStreamObjs returns a slice of PDF objects containing the content
|
||
// streams of the page.
|
||
func (_cdffg *PdfPage )GetContentStreamObjs ()[]_fg .PdfObject {if _cdffg .Contents ==nil {return nil ;};_bbcce :=_fg .TraceToDirectObject (_cdffg .Contents );if _cffgf ,_egad :=_bbcce .(*_fg .PdfObjectArray );_egad {return _cffgf .Elements ();};return []_fg .PdfObject {_bbcce };
|
||
};func _cffgdbb ()string {return _aa .Version };
|
||
|
||
// NewPdfReaderLazy creates a new PdfReader for `rs` in lazy-loading mode. The difference
|
||
// from NewPdfReader is that in lazy-loading mode, objects are only loaded into memory when needed
|
||
// rather than entire structure being loaded into memory on reader creation.
|
||
// Note that it may make sense to use the lazy-load reader when processing only parts of files,
|
||
// rather than loading entire file into memory. Example: splitting a few pages from a large PDF file.
|
||
func NewPdfReaderLazy (rs _ff .ReadSeeker )(*PdfReader ,error ){const _dffac ="\u006d\u006f\u0064\u0065l:\u004e\u0065\u0077\u0050\u0064\u0066\u0052\u0065\u0061\u0064\u0065\u0072\u004c\u0061z\u0079";return _bgdaf (rs ,&ReaderOpts {LazyLoad :true },false ,_dffac );
|
||
};func _daaa (_aedfg _fg .PdfObject )(*PdfColorspaceDeviceNAttributes ,error ){_gcbg :=&PdfColorspaceDeviceNAttributes {};var _afc *_fg .PdfObjectDictionary ;switch _ccgae :=_aedfg .(type ){case *_fg .PdfIndirectObject :_gcbg ._eagf =_ccgae ;var _ddaf bool ;
|
||
_afc ,_ddaf =_ccgae .PdfObject .(*_fg .PdfObjectDictionary );if !_ddaf {_aa .Log .Error ("\u0044\u0065\u0076\u0069c\u0065\u004e\u0020\u0061\u0074\u0074\u0072\u0069\u0062\u0075t\u0065 \u0074\u0079\u0070\u0065\u0020\u0065\u0072r\u006f\u0072");return nil ,_ce .New ("\u0074\u0079\u0070\u0065\u0020\u0065\u0072\u0072\u006f\u0072");
|
||
};case *_fg .PdfObjectDictionary :_afc =_ccgae ;case *_fg .PdfObjectReference :_gffae :=_ccgae .Resolve ();return _daaa (_gffae );default:_aa .Log .Error ("\u0044\u0065\u0076\u0069c\u0065\u004e\u0020\u0061\u0074\u0074\u0072\u0069\u0062\u0075t\u0065 \u0074\u0079\u0070\u0065\u0020\u0065\u0072r\u006f\u0072");
|
||
return nil ,_ce .New ("\u0074\u0079\u0070\u0065\u0020\u0065\u0072\u0072\u006f\u0072");};if _ddba :=_afc .Get ("\u0053u\u0062\u0074\u0079\u0070\u0065");_ddba !=nil {_fcgg ,_gddb :=_fg .TraceToDirectObject (_ddba ).(*_fg .PdfObjectName );if !_gddb {_aa .Log .Error ("\u0044\u0065vi\u0063\u0065\u004e \u0061\u0074\u0074\u0072ibu\u0074e \u0053\u0075\u0062\u0074\u0079\u0070\u0065 t\u0079\u0070\u0065\u0020\u0065\u0072\u0072o\u0072");
|
||
return nil ,_ce .New ("\u0074\u0079\u0070\u0065\u0020\u0065\u0072\u0072\u006f\u0072");};_gcbg .Subtype =_fcgg ;};if _bbdf :=_afc .Get ("\u0043o\u006c\u006f\u0072\u0061\u006e\u0074s");_bbdf !=nil {_gcbg .Colorants =_bbdf ;};if _gaaf :=_afc .Get ("\u0050r\u006f\u0063\u0065\u0073\u0073");
|
||
_gaaf !=nil {_gcbg .Process =_gaaf ;};if _gdge :=_afc .Get ("M\u0069\u0078\u0069\u006e\u0067\u0048\u0069\u006e\u0074\u0073");_gdge !=nil {_gcbg .MixingHints =_gdge ;};return _gcbg ,nil ;};
|
||
|
||
// NewPdfRectangle creates a PDF rectangle object based on an input array of 4 integers.
|
||
// Defining the lower left (LL) and upper right (UR) corners with
|
||
// floating point numbers.
|
||
func NewPdfRectangle (arr _fg .PdfObjectArray )(*PdfRectangle ,error ){_gegdg :=PdfRectangle {};if arr .Len ()!=4{return nil ,_ce .New ("\u0069\u006e\u0076\u0061\u006c\u0069d\u0020\u0072\u0065\u0063\u0074\u0061\u006e\u0067\u006c\u0065\u0020\u0061\u0072r\u0061\u0079\u002c\u0020\u006c\u0065\u006e \u0021\u003d\u0020\u0034");
|
||
};var _dcbef error ;_gegdg .Llx ,_dcbef =_fg .GetNumberAsFloat (arr .Get (0));if _dcbef !=nil {return nil ,_dcbef ;};_gegdg .Lly ,_dcbef =_fg .GetNumberAsFloat (arr .Get (1));if _dcbef !=nil {return nil ,_dcbef ;};_gegdg .Urx ,_dcbef =_fg .GetNumberAsFloat (arr .Get (2));
|
||
if _dcbef !=nil {return nil ,_dcbef ;};_gegdg .Ury ,_dcbef =_fg .GetNumberAsFloat (arr .Get (3));if _dcbef !=nil {return nil ,_dcbef ;};return &_gegdg ,nil ;};func _dcbce (_efacd *PdfField ,_fabeb _fg .PdfObject )error {switch _efacd .GetContext ().(type ){case *PdfFieldText :switch _dabdd :=_fabeb .(type ){case *_fg .PdfObjectName :_bbdab :=_dabdd ;
|
||
_aa .Log .Debug ("\u0055\u006e\u0065\u0078\u0070\u0065\u0063\u0074\u0065\u0064\u003a\u0020\u0047\u006f\u0074 \u0056\u0020\u0061\u0073\u0020\u006e\u0061\u006d\u0065\u0020\u002d\u003e\u0020c\u006f\u006e\u0076\u0065\u0072\u0074\u0069\u006e\u0067\u0020\u0074\u006f s\u0074\u0072\u0069\u006e\u0067\u0020\u0027\u0025\u0073\u0027",_bbdab .String ());
|
||
_efacd .V =_fg .MakeEncodedString (_dabdd .String (),true );case *_fg .PdfObjectString :_efacd .V =_fg .MakeEncodedString (_dabdd .String (),true );default:_aa .Log .Debug ("\u0045\u0052R\u004f\u0052\u003a\u0020\u0055\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u0020\u0074\u0065\u0078\u0074\u0020\u0066\u0069\u0065\u006c\u0064\u0020\u0056\u0020\u0074\u0079\u0070\u0065\u003a\u0020\u0025\u0054\u0020\u0028\u0025\u0023\u0076\u0029",_dabdd ,_dabdd );
|
||
};case *PdfFieldButton :switch _fabeb .(type ){case *_fg .PdfObjectName :if len (_fabeb .String ())> 0{_efacd .V =_fabeb ;_cdaad (_efacd ,_fabeb );};case *_fg .PdfObjectString :if len (_fabeb .String ())> 0{_efacd .V =_fg .MakeName (_fabeb .String ());
|
||
_cdaad (_efacd ,_efacd .V );};default:_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0055\u004e\u0045\u0058P\u0045\u0043\u0054\u0045\u0044\u0020\u0025\u0073\u0020\u002d>\u0020\u0025\u0076",_efacd .PartialName (),_fabeb );_efacd .V =_fabeb ;
|
||
};case *PdfFieldChoice :switch _fabeb .(type ){case *_fg .PdfObjectName :if len (_fabeb .String ())> 0{_efacd .V =_fg .MakeString (_fabeb .String ());_cdaad (_efacd ,_fabeb );};case *_fg .PdfObjectString :if len (_fabeb .String ())> 0{_efacd .V =_fabeb ;
|
||
_cdaad (_efacd ,_fg .MakeName (_fabeb .String ()));};default:_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0055\u004e\u0045\u0058P\u0045\u0043\u0054\u0045\u0044\u0020\u0025\u0073\u0020\u002d>\u0020\u0025\u0076",_efacd .PartialName (),_fabeb );
|
||
_efacd .V =_fabeb ;};case *PdfFieldSignature :_aa .Log .Debug ("\u0054\u004f\u0044\u004f\u003a \u0053\u0069\u0067\u006e\u0061\u0074\u0075\u0072\u0065\u0020\u0061\u0070\u0070e\u0061\u0072\u0061\u006e\u0063\u0065\u0020\u006e\u006f\u0074\u0020\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u0020\u0079\u0065\u0074\u003a\u0020\u0025\u0073\u002f\u0025v",_efacd .PartialName (),_fabeb );
|
||
};return nil ;};
|
||
|
||
// ToInteger convert to an integer format.
|
||
func (_accaa *PdfColorCalGray )ToInteger (bits int )uint32 {_gffa :=_ef .Pow (2,float64 (bits ))-1;return uint32 (_gffa *_accaa .Val ());};
|
||
|
||
// Write writes the Appender output to io.Writer.
|
||
// It can only be called once and further invocations will result in an error.
|
||
func (_bga *PdfAppender )Write (w _ff .Writer )error {if _bga ._fgggf {return _ce .New ("\u0061\u0070\u0070\u0065\u006e\u0064\u0065\u0072\u0020\u0077\u0072\u0069\u0074e\u0020\u0063\u0061\u006e\u0020\u006fn\u006c\u0079\u0020\u0062\u0065\u0020\u0069\u006e\u0076\u006f\u006b\u0065\u0064 \u006f\u006e\u0063\u0065");
|
||
};_dcg :=NewPdfWriter ();_agbfd ,_gegb :=_fg .GetDict (_dcg ._feccd );if !_gegb {return _ce .New ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0050\u0061g\u0065\u0073\u0020\u006f\u0062\u006a\u0020(\u006e\u006f\u0074\u0020\u0061\u0020\u0064\u0069\u0063\u0074\u0029");
|
||
};_dgbb ,_gegb :=_agbfd .Get ("\u004b\u0069\u0064\u0073").(*_fg .PdfObjectArray );if !_gegb {return _ce .New ("\u0069\u006ev\u0061\u006c\u0069\u0064 \u0050\u0061g\u0065\u0073\u0020\u004b\u0069\u0064\u0073\u0020o\u0062\u006a\u0020\u0028\u006e\u006f\u0074\u0020\u0061\u006e\u0020\u0061r\u0072\u0061\u0079\u0029");
|
||
};_bddc ,_gegb :=_agbfd .Get ("\u0043\u006f\u0075n\u0074").(*_fg .PdfObjectInteger );if !_gegb {return _ce .New ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064 \u0050\u0061\u0067e\u0073\u0020\u0043\u006fu\u006e\u0074\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u0020\u0028\u006e\u006f\u0074\u0020\u0061\u006e\u0020\u0069\u006e\u0074\u0065\u0067\u0065\u0072\u0029");
|
||
};_ebdb :=_bga ._cbb ._ccgg ;_dec :=_ebdb .GetTrailer ();if _dec ==nil {return _ce .New ("\u006di\u0073s\u0069\u006e\u0067\u0020\u0074\u0072\u0061\u0069\u006c\u0065\u0072");};_badbb ,_gegb :=_fg .GetIndirect (_dec .Get ("\u0052\u006f\u006f\u0074"));if !_gegb {return _ce .New ("c\u0061\u0074\u0061\u006c\u006f\u0067 \u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0065\u0072 \u006e\u006f\u0074 \u0066o\u0075\u006e\u0064");
|
||
};_dead ,_gegb :=_fg .GetDict (_badbb );if !_gegb {_aa .Log .Debug ("\u0045\u0052R\u004f\u0052\u003a\u0020\u004d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0063\u0061\u0074\u0061\u006c\u006f\u0067\u003a\u0020\u0028\u0072\u006f\u006f\u0074\u0020\u0025\u0071\u0029\u0020\u0028\u0074\u0072\u0061\u0069\u006c\u0065\u0072\u0020\u0025\u0073\u0029",_badbb ,*_dec );
|
||
return _ce .New ("\u006di\u0073s\u0069\u006e\u0067\u0020\u0063\u0061\u0074\u0061\u006c\u006f\u0067");};for _ ,_fcfd :=range _dead .Keys (){if _dcg ._cgacf .Get (_fcfd )==nil {_cfe :=_dead .Get (_fcfd );_dcg ._cgacf .Set (_fcfd ,_cfe );};};if _bga ._cacc !=nil {if _bga ._cacc ._fgdbf {if _fagf :=_fg .TraceToDirectObject (_bga ._cacc .ToPdfObject ());
|
||
!_fg .IsNullObject (_fagf ){_dcg ._cgacf .Set ("\u0041\u0063\u0072\u006f\u0046\u006f\u0072\u006d",_fagf );_bga .updateObjectsDeep (_fagf ,nil );}else {_aa .Log .Debug ("\u0055\u006e\u0061\u0062\u006c\u0065 \u0074\u006f\u0020t\u0072\u0061\u0063e\u0020\u0041\u0063\u0072\u006f\u0046\u006f\u0072\u006d\u0020o\u0062\u006a\u0065\u0063\u0074, \u0066\u0061\u0069\u006c\u0065\u0064\u0020\u0074\u006f\u0020\u0061\u0064\u0064\u0020\u0041\u0063\u0072\u006f\u0046\u006f\u0072\u006d\u002e");
|
||
};}else {_dcg ._cgacf .Set ("\u0041\u0063\u0072\u006f\u0046\u006f\u0072\u006d",_bga ._cacc .ToPdfObject ());_bga .updateObjectsDeep (_bga ._cacc .ToPdfObject (),nil );};};if _bga ._dgbf !=nil {_bga .updateObjectsDeep (_bga ._dgbf .ToPdfObject (),nil );
|
||
_dcg ._cgacf .Set ("\u0044\u0053\u0053",_bga ._dgbf .GetContainingPdfObject ());};if _bga ._fege !=nil {_dcg ._cgacf .Set ("\u0050\u0065\u0072m\u0073",_bga ._fege .ToPdfObject ());_bga .updateObjectsDeep (_bga ._fege .ToPdfObject (),nil );};if _dcg ._fbbec .Major < 2{_dcg .AddExtension ("\u0045\u0053\u0049\u0043","\u0031\u002e\u0037",5);
|
||
_dcg .AddExtension ("\u0041\u0044\u0042\u0045","\u0031\u002e\u0037",8);};if _dbgc ,_dbga :=_fg .GetDict (_dec .Get ("\u0049\u006e\u0066\u006f"));_dbga {if _gddd ,_fceg :=_fg .GetDict (_dcg ._deabg );_fceg {for _ ,_dddcd :=range _dbgc .Keys (){if _gddd .Get (_dddcd )==nil {_gddd .Set (_dddcd ,_dbgc .Get (_dddcd ));
|
||
};};};};if _bga ._fadf !=nil {_dcg ._deabg =_fg .MakeIndirectObject (_bga ._fadf .ToPdfObject ());};_bga .addNewObject (_dcg ._deabg );_bga .addNewObject (_dcg ._cegde );_dabfa :=false ;if len (_bga ._cbb .PageList )!=len (_bga ._agbg ){_dabfa =true ;}else {for _edca :=range _bga ._cbb .PageList {switch {case _bga ._agbg [_edca ]==_bga ._cbb .PageList [_edca ]:case _bga ._agbg [_edca ]==_bga .Reader .PageList [_edca ]:default:_dabfa =true ;
|
||
};if _dabfa {break ;};};};if _dabfa {_bga .updateObjectsDeep (_dcg ._feccd ,nil );}else {_bga ._fgb [_dcg ._feccd ]=struct{}{};};_dcg ._feccd .ObjectNumber =_bga .Reader ._ecef .ObjectNumber ;_bga ._dcbad [_dcg ._feccd ]=_bga .Reader ._ecef .ObjectNumber ;
|
||
_ecfe :=[]_fg .PdfObjectName {"\u0052e\u0073\u006f\u0075\u0072\u0063\u0065s","\u004d\u0065\u0064\u0069\u0061\u0042\u006f\u0078","\u0043r\u006f\u0070\u0042\u006f\u0078","\u0052\u006f\u0074\u0061\u0074\u0065"};for _ ,_eecg :=range _bga ._agbg {_ceaa :=_eecg .ToPdfObject ();
|
||
*_bddc =*_bddc +1;if _ceeb ,_acec :=_ceaa .(*_fg .PdfIndirectObject );_acec &&_ceeb .GetParser ()==_bga ._cbb ._ccgg {_dgbb .Append (&_ceeb .PdfObjectReference );continue ;};if _dgfc ,_bfc :=_fg .GetDict (_ceaa );_bfc {_aabaf ,_edfe :=_dgfc .Get ("\u0050\u0061\u0072\u0065\u006e\u0074").(*_fg .PdfIndirectObject );
|
||
for _edfe {_aa .Log .Trace ("\u0050a\u0067e\u0020\u0050\u0061\u0072\u0065\u006e\u0074\u003a\u0020\u0025\u0054",_aabaf );_cecg ,_eada :=_aabaf .PdfObject .(*_fg .PdfObjectDictionary );if !_eada {return _ce .New ("i\u006e\u0076\u0061\u006cid\u0020P\u0061\u0072\u0065\u006e\u0074 \u006f\u0062\u006a\u0065\u0063\u0074");
|
||
};for _ ,_egce :=range _ecfe {_aa .Log .Trace ("\u0046\u0069\u0065\u006c\u0064\u0020\u0025\u0073",_egce );if _agbda :=_dgfc .Get (_egce );_agbda !=nil {_aa .Log .Trace ("\u002d \u0070a\u0067\u0065\u0020\u0068\u0061s\u0020\u0061l\u0072\u0065\u0061\u0064\u0079");
|
||
if len (_eecg ._cceb .Keys ())> 0&&!_dabfa {_geba :=_eecg ._cceb ;if _dgcg :=_geba .Get (_egce );_dgcg !=nil {if _agbda !=_dgcg {_aa .Log .Trace ("\u0049\u006e\u0068\u0065\u0072\u0069\u0074\u0069\u006e\u0067\u0020\u006f\u0072\u0069\u0067i\u006ea\u006c\u0020\u0066\u0069\u0065\u006c\u0064\u0020\u0025\u0073\u002c\u0020\u0025\u0054",_egce ,_dgcg );
|
||
_dgfc .Set (_egce ,_dgcg );};};};continue ;};if _bddcc :=_cecg .Get (_egce );_bddcc !=nil {_aa .Log .Trace ("\u0049\u006e\u0068\u0065ri\u0074\u0069\u006e\u0067\u0020\u0066\u0069\u0065\u006c\u0064\u0020\u0025\u0073",_egce );_dgfc .Set (_egce ,_bddcc );};
|
||
};_aabaf ,_edfe =_cecg .Get ("\u0050\u0061\u0072\u0065\u006e\u0074").(*_fg .PdfIndirectObject );_aa .Log .Trace ("\u004ee\u0078t\u0020\u0070\u0061\u0072\u0065\u006e\u0074\u003a\u0020\u0025\u0054",_cecg .Get ("\u0050\u0061\u0072\u0065\u006e\u0074"));};if _dabfa {_dgfc .Set ("\u0050\u0061\u0072\u0065\u006e\u0074",_dcg ._feccd );
|
||
};};_bga .updateObjectsDeep (_ceaa ,nil );_dgbb .Append (_ceaa );};if _ ,_bdac :=_bga ._ebd .Seek (0,_ff .SeekStart );_bdac !=nil {return _bdac ;};_dbfa :=make (map[SignatureHandler ]_ff .Writer );_abaf :=_fg .MakeArray ();for _ ,_egcef :=range _bga ._gcdb {if _abfg ,_ffac :=_fg .GetIndirect (_egcef );
|
||
_ffac {if _aaac ,_gfede :=_abfg .PdfObject .(*pdfSignDictionary );_gfede {_ggac :=*_aaac ._afcd ;var _afbe error ;_dbfa [_ggac ],_afbe =_ggac .NewDigest (_aaac ._cggdd );if _afbe !=nil {return _afbe ;};_abaf .Append (_fg .MakeInteger (0xfffff),_fg .MakeInteger (0xfffff));
|
||
};};};if _abaf .Len ()> 0{_abaf .Append (_fg .MakeInteger (0xfffff),_fg .MakeInteger (0xfffff));};for _ ,_geee :=range _bga ._gcdb {if _becb ,_cgbf :=_fg .GetIndirect (_geee );_cgbf {if _fagg ,_edeg :=_becb .PdfObject .(*pdfSignDictionary );_edeg {_fagg .Set ("\u0042y\u0074\u0065\u0052\u0061\u006e\u0067e",_abaf );
|
||
};};};_dagf :=len (_dbfa )> 0;var _ddde _ff .Reader =_bga ._ebd ;if _dagf {_ddgg :=make ([]_ff .Writer ,0,len (_dbfa ));for _ ,_aag :=range _dbfa {_ddgg =append (_ddgg ,_aag );};_ddde =_ff .TeeReader (_bga ._ebd ,_ff .MultiWriter (_ddgg ...));};_dbgd ,_ceca :=_ff .Copy (w ,_ddde );
|
||
if _ceca !=nil {return _ceca ;};if len (_bga ._gcdb )==0{return nil ;};_dcg ._beddc =_dbgd ;_dcg .ObjNumOffset =_bga ._egcab ;_dcg ._cdafg =true ;_dcg ._abeeb =_bga ._gaeb ;_dcg ._cgdbf =_bga ._dff ;_dcg ._cecef =_bga ._ggcf ;_dcg ._fbbec =_bga ._cbb .PdfVersion ();
|
||
_dcg ._cbeab =_bga ._dcbad ;_dcg ._bbdbd =_bga ._bbef .GetCrypter ();_dcg ._abgdg =_bga ._bbef .GetEncryptObj ();_gdgf :=_bga ._bbef .GetXrefType ();if _gdgf !=nil {_fedad :=*_gdgf ==_fg .XrefTypeObjectStream ;_dcg ._gefag =&_fedad ;};_dcg ._gcbec =map[_fg .PdfObject ]struct{}{};
|
||
_dcg ._bbfd =[]_fg .PdfObject {};for _ ,_ecccb :=range _bga ._gcdb {if _ ,_cegf :=_bga ._fgb [_ecccb ];_cegf {continue ;};_dcg .addObject (_ecccb );};_fbea :=w ;if _dagf {_fbea =_cb .NewBuffer (nil );};if _bga ._gccg !=""&&_dcg ._bbdbd ==nil {_dcg .Encrypt ([]byte (_bga ._gccg ),[]byte (_bga ._gccg ),_bga ._ggb );
|
||
};if _cccg :=_dec .Get ("\u0049\u0044");_cccg !=nil {if _fdec ,_fabg :=_fg .GetArray (_cccg );_fabg {_dcg ._dadgc =_fdec ;};};if _eaba :=_dcg .Write (_fbea );_eaba !=nil {return _eaba ;};if _dagf {_adagc :=_fbea .(*_cb .Buffer ).Bytes ();_ffba :=_fg .MakeArray ();
|
||
var _eeeff []*pdfSignDictionary ;var _dedf int64 ;for _ ,_eedb :=range _dcg ._bbfd {if _dabd ,_ggebab :=_fg .GetIndirect (_eedb );_ggebab {if _aebc ,_eadd :=_dabd .PdfObject .(*pdfSignDictionary );_eadd {_eeeff =append (_eeeff ,_aebc );_dcfg :=_aebc ._gaage +int64 (_aebc ._afade );
|
||
_ffba .Append (_fg .MakeInteger (_dedf ),_fg .MakeInteger (_dcfg -_dedf ));_dedf =_aebc ._gaage +int64 (_aebc ._accg );};};};_ffba .Append (_fg .MakeInteger (_dedf ),_fg .MakeInteger (_dbgd +int64 (len (_adagc ))-_dedf ));_cbedg :=[]byte (_ffba .WriteString ());
|
||
for _ ,_faf :=range _eeeff {_dded :=int (_faf ._gaage -_dbgd );for _edfef :=_faf ._aegfb ;_edfef < _faf ._ecdgb ;_edfef ++{_adagc [_dded +_edfef ]=' ';};_eaae :=_adagc [_dded +_faf ._aegfb :_dded +_faf ._ecdgb ];copy (_eaae ,_cbedg );};var _aged int ;for _ ,_ebfb :=range _eeeff {_gddg :=int (_ebfb ._gaage -_dbgd );
|
||
_dgdd :=_adagc [_aged :_gddg +_ebfb ._afade ];_ebg :=*_ebfb ._afcd ;_dbfa [_ebg ].Write (_dgdd );_aged =_gddg +_ebfb ._accg ;};for _ ,_gebad :=range _eeeff {_ddaaa :=_adagc [_aged :];_aabf :=*_gebad ._afcd ;_dbfa [_aabf ].Write (_ddaaa );};for _ ,_cfgb :=range _eeeff {_deag :=int (_cfgb ._gaage -_dbgd );
|
||
_aeae :=*_cfgb ._afcd ;_bcfe :=_dbfa [_aeae ];if _egdc :=_aeae .Sign (_cfgb ._cggdd ,_bcfe );_egdc !=nil {return _egdc ;};_cfgb ._cggdd .ByteRange =_ffba ;_fabb :=[]byte (_cfgb ._cggdd .Contents .WriteString ());for _cca :=_cfgb ._aegfb ;_cca < _cfgb ._ecdgb ;
|
||
_cca ++{_adagc [_deag +_cca ]=' ';};for _bcba :=_cfgb ._afade ;_bcba < _cfgb ._accg ;_bcba ++{_adagc [_deag +_bcba ]=' ';};_egee :=_adagc [_deag +_cfgb ._aegfb :_deag +_cfgb ._ecdgb ];copy (_egee ,_cbedg );_egee =_adagc [_deag +_cfgb ._afade :_deag +_cfgb ._accg ];
|
||
copy (_egee ,_fabb );};_cfda :=_cb .NewBuffer (_adagc );_ ,_ceca =_ff .Copy (w ,_cfda );if _ceca !=nil {return _ceca ;};};_bga ._fgggf =true ;return nil ;};
|
||
|
||
// ColorFromFloats returns a new PdfColor based on the input slice of color
|
||
// components.
|
||
func (_bdda *PdfColorspaceICCBased )ColorFromFloats (vals []float64 )(PdfColor ,error ){if _bdda .Alternate ==nil {if _bdda .N ==1{_gfac :=NewPdfColorspaceDeviceGray ();return _gfac .ColorFromFloats (vals );}else if _bdda .N ==3{_dae :=NewPdfColorspaceDeviceRGB ();
|
||
return _dae .ColorFromFloats (vals );}else if _bdda .N ==4{_dfbe :=NewPdfColorspaceDeviceCMYK ();return _dfbe .ColorFromFloats (vals );}else {return nil ,_ce .New ("I\u0043\u0043\u0020\u0042\u0061\u0073\u0065\u0064\u0020\u0063\u006f\u006c\u006f\u0072\u0073\u0070\u0061\u0063e\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0061lt\u0065\u0072\u006ea\u0074i\u0076\u0065");
|
||
};};return _bdda .Alternate .ColorFromFloats (vals );};
|
||
|
||
// Compress is yet to be implemented.
|
||
// Should be able to compress in terms of JPEG quality parameter,
|
||
// and DPI threshold (need to know bounding area dimensions).
|
||
func (_bbcba DefaultImageHandler )Compress (input *Image ,quality int64 )(*Image ,error ){return input ,nil ;};
|
||
|
||
// NewStandard14FontMustCompile returns the standard 14 font named `basefont` as a *PdfFont.
|
||
// If `basefont` is one of the 14 Standard14Font values defined above then NewStandard14FontMustCompile
|
||
// is guaranteed to succeed.
|
||
func NewStandard14FontMustCompile (basefont StdFontName )*PdfFont {_cagf ,_cggg :=NewStandard14Font (basefont );if _cggg !=nil {panic (_d .Errorf ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0053\u0074\u0061n\u0064\u0061\u0072\u0064\u0031\u0034\u0046\u006f\u006e\u0074 \u0025\u0023\u0071",basefont ));
|
||
};return _cagf ;};
|
||
|
||
// GetContentStream returns the XObject Form's content stream.
|
||
func (_eggdf *XObjectForm )GetContentStream ()([]byte ,error ){_dfdeb ,_bdcac :=_fg .DecodeStream (_eggdf ._bdage );if _bdcac !=nil {return nil ,_bdcac ;};return _dfdeb ,nil ;};
|
||
|
||
// PdfBorderStyle represents a border style dictionary (12.5.4 Border Styles p. 394).
|
||
type PdfBorderStyle struct{W *float64 ;S *BorderStyle ;D *[]int ;_ebeb _fg .PdfObject ;};
|
||
|
||
// GetContentStreamWithEncoder returns the pattern cell's content stream and its encoder
|
||
func (_gdgfb *PdfTilingPattern )GetContentStreamWithEncoder ()([]byte ,_fg .StreamEncoder ,error ){_afgae ,_aabfc :=_gdgfb ._gaac .(*_fg .PdfObjectStream );if !_aabfc {_aa .Log .Debug ("\u0054\u0069l\u0069\u006e\u0067\u0020\u0070\u0061\u0074\u0074\u0065\u0072\u006e\u0020\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0065\u0072\u0020\u006e\u006f\u0074\u0020\u0061\u0020\u0073\u0074\u0072\u0065\u0061\u006d\u0020\u0028\u0067\u006f\u0074\u0020\u0025\u0054\u0029",_gdgfb ._gaac );
|
||
return nil ,nil ,_fg .ErrTypeError ;};_cbggb ,_ddefd :=_fg .DecodeStream (_afgae );if _ddefd !=nil {_aa .Log .Debug ("\u0046\u0061\u0069l\u0065\u0064\u0020\u0064e\u0063\u006f\u0064\u0069\u006e\u0067\u0020s\u0074\u0072\u0065\u0061\u006d\u002c\u0020\u0065\u0072\u0072\u003a\u0020\u0025\u0076",_ddefd );
|
||
return nil ,nil ,_ddefd ;};_gbgcc ,_ddefd :=_fg .NewEncoderFromStream (_afgae );if _ddefd !=nil {_aa .Log .Debug ("F\u0061\u0069\u006c\u0065\u0064\u0020f\u0069\u006e\u0064\u0069\u006e\u0067 \u0064\u0065\u0063\u006f\u0064\u0069\u006eg\u0020\u0065\u006e\u0063\u006f\u0064\u0065\u0072\u003a\u0020%\u0076",_ddefd );
|
||
return nil ,nil ,_ddefd ;};return _cbggb ,_gbgcc ,nil ;};
|
||
|
||
// PdfAnnotationSquiggly represents Squiggly annotations.
|
||
// (Section 12.5.6.10).
|
||
type PdfAnnotationSquiggly struct{*PdfAnnotation ;*PdfAnnotationMarkup ;QuadPoints _fg .PdfObject ;};func (_ggg *PdfReader )newPdfAnnotationInkFromDict (_ecbf *_fg .PdfObjectDictionary )(*PdfAnnotationInk ,error ){_dccb :=PdfAnnotationInk {};_badc ,_ebcd :=_ggg .newPdfAnnotationMarkupFromDict (_ecbf );
|
||
if _ebcd !=nil {return nil ,_ebcd ;};_dccb .PdfAnnotationMarkup =_badc ;_dccb .InkList =_ecbf .Get ("\u0049n\u006b\u004c\u0069\u0073\u0074");_dccb .BS =_ecbf .Get ("\u0042\u0053");return &_dccb ,nil ;};
|
||
|
||
// ToPdfObject returns the PDF representation of the colorspace.
|
||
func (_fbge *PdfColorspaceDeviceCMYK )ToPdfObject ()_fg .PdfObject {return _fg .MakeName ("\u0044\u0065\u0076\u0069\u0063\u0065\u0043\u004d\u0059\u004b");};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_cfge *PdfActionURI )ToPdfObject ()_fg .PdfObject {_cfge .PdfAction .ToPdfObject ();_dgg :=_cfge ._bda ;_efgc :=_dgg .PdfObject .(*_fg .PdfObjectDictionary );_efgc .SetIfNotNil ("\u0053",_fg .MakeName (string (ActionTypeURI )));_efgc .SetIfNotNil ("\u0055\u0052\u0049",_cfge .URI );
|
||
_efgc .SetIfNotNil ("\u0049\u0073\u004da\u0070",_cfge .IsMap );return _dgg ;};type pdfCIDFontType2 struct{fontCommon ;_dbedf *_fg .PdfIndirectObject ;_deecfc _dg .TextEncoder ;
|
||
|
||
// Table 117 – Entries in a CIDFont dictionary (page 269)
|
||
// Dictionary that defines the character collection of the CIDFont (required).
|
||
// See Table 116.
|
||
CIDSystemInfo *_fg .PdfObjectDictionary ;
|
||
|
||
// Glyph metrics fields (optional).
|
||
DW _fg .PdfObject ;W _fg .PdfObject ;DW2 _fg .PdfObject ;W2 _fg .PdfObject ;
|
||
|
||
// CIDs to glyph indices mapping (optional).
|
||
CIDToGIDMap _fg .PdfObject ;_dbgce map[_dg .CharCode ]float64 ;_gagd float64 ;_ebda map[rune ]int ;};
|
||
|
||
// Normalize swaps (Llx,Urx) if Urx < Llx, and (Lly,Ury) if Ury < Lly.
|
||
func (_beacc *PdfRectangle )Normalize (){if _beacc .Llx > _beacc .Urx {_beacc .Llx ,_beacc .Urx =_beacc .Urx ,_beacc .Llx ;};if _beacc .Lly > _beacc .Ury {_beacc .Lly ,_beacc .Ury =_beacc .Ury ,_beacc .Lly ;};};
|
||
|
||
// EncryptOptions represents encryption options for an output PDF.
|
||
type EncryptOptions struct{Permissions _gb .Permissions ;Algorithm EncryptionAlgorithm ;};
|
||
|
||
// PdfColorLab represents a color in the L*, a*, b* 3 component colorspace.
|
||
// Each component is defined in the range 0.0 - 1.0 where 1.0 is the primary intensity.
|
||
type PdfColorLab [3]float64 ;
|
||
|
||
// SetContext sets the sub pattern (context). Either PdfTilingPattern or PdfShadingPattern.
|
||
func (_eegfa *PdfPattern )SetContext (ctx PdfModel ){_eegfa ._ccdc =ctx };
|
||
|
||
// ToPdfObject returns the PDF representation of the function.
|
||
func (_bffga *PdfFunctionType0 )ToPdfObject ()_fg .PdfObject {if _bffga ._ddgf ==nil {_bffga ._ddgf =&_fg .PdfObjectStream {};};_begfb :=_fg .MakeDict ();_begfb .Set ("\u0046\u0075\u006ec\u0074\u0069\u006f\u006e\u0054\u0079\u0070\u0065",_fg .MakeInteger (0));
|
||
_dcgd :=&_fg .PdfObjectArray {};for _ ,_gadgb :=range _bffga .Domain {_dcgd .Append (_fg .MakeFloat (_gadgb ));};_begfb .Set ("\u0044\u006f\u006d\u0061\u0069\u006e",_dcgd );_bcace :=&_fg .PdfObjectArray {};for _ ,_dabga :=range _bffga .Range {_bcace .Append (_fg .MakeFloat (_dabga ));
|
||
};_begfb .Set ("\u0052\u0061\u006eg\u0065",_bcace );_fddd :=&_fg .PdfObjectArray {};for _ ,_bccga :=range _bffga .Size {_fddd .Append (_fg .MakeInteger (int64 (_bccga )));};_begfb .Set ("\u0053\u0069\u007a\u0065",_fddd );_begfb .Set ("\u0042\u0069\u0074\u0073\u0050\u0065\u0072\u0053\u0061\u006d\u0070\u006c\u0065",_fg .MakeInteger (int64 (_bffga .BitsPerSample )));
|
||
if _bffga .Order !=1{_begfb .Set ("\u004f\u0072\u0064e\u0072",_fg .MakeInteger (int64 (_bffga .Order )));};_begfb .Set ("\u004c\u0065\u006e\u0067\u0074\u0068",_fg .MakeInteger (int64 (len (_bffga ._cfed ))));_bffga ._ddgf .Stream =_bffga ._cfed ;_bffga ._ddgf .PdfObjectDictionary =_begfb ;
|
||
return _bffga ._ddgf ;};func _badbc (_dcbgc _fg .PdfObject )(*fontFile ,error ){_aa .Log .Trace ("\u006e\u0065\u0077\u0046\u006f\u006e\u0074\u0046\u0069\u006c\u0065\u0046\u0072\u006f\u006dP\u0064f\u004f\u0062\u006a\u0065\u0063\u0074\u003a\u0020\u006f\u0062\u006a\u003d\u0025\u0073",_dcbgc );
|
||
_ggbb :=&fontFile {};_dcbgc =_fg .TraceToDirectObject (_dcbgc );_cgfdee ,_cfdcb :=_dcbgc .(*_fg .PdfObjectStream );if !_cfdcb {_aa .Log .Debug ("\u0045\u0052R\u004f\u0052\u003a\u0020F\u006f\u006et\u0046\u0069\u006c\u0065\u0020\u006d\u0075\u0073t\u0020\u0062\u0065\u0020\u0061\u0020\u0073\u0074\u0072\u0065\u0061\u006d \u0028\u0025\u0054\u0029",_dcbgc );
|
||
return nil ,_fg .ErrTypeError ;};_egcae :=_cgfdee .PdfObjectDictionary ;_edgg ,_dffbc :=_fg .DecodeStream (_cgfdee );if _dffbc !=nil {return nil ,_dffbc ;};_efgf ,_cfdcb :=_fg .GetNameVal (_egcae .Get ("\u0053u\u0062\u0074\u0079\u0070\u0065"));if !_cfdcb {_ggbb ._cede =_efgf ;
|
||
if _efgf =="\u0054\u0079\u0070\u0065\u0031\u0043"{_aa .Log .Debug ("T\u0079\u0070\u0065\u0031\u0043\u0020\u0066\u006f\u006e\u0074\u0073\u0020\u0061\u0072\u0065\u0020\u0063\u0075r\u0072\u0065\u006e\u0074\u006c\u0079\u0020\u006e\u006f\u0074 s\u0075\u0070\u0070o\u0072t\u0065\u0064");
|
||
return nil ,ErrType1CFontNotSupported ;};};_bbbg ,_ :=_fg .GetIntVal (_egcae .Get ("\u004ce\u006e\u0067\u0074\u0068\u0031"));_gaefef ,_ :=_fg .GetIntVal (_egcae .Get ("\u004ce\u006e\u0067\u0074\u0068\u0032"));if _bbbg > len (_edgg ){_bbbg =len (_edgg );
|
||
};if _bbbg +_gaefef > len (_edgg ){_gaefef =len (_edgg )-_bbbg ;};_adgc :=_edgg [:_bbbg ];var _cafde []byte ;if _gaefef > 0{_cafde =_edgg [_bbbg :_bbbg +_gaefef ];};if _bbbg > 0&&_gaefef > 0{_adfee :=_ggbb .loadFromSegments (_adgc ,_cafde );if _adfee !=nil {return nil ,_adfee ;
|
||
};};return _ggbb ,nil ;};
|
||
|
||
// PdfAnnotationText represents Text annotations.
|
||
// (Section 12.5.6.4 p. 402).
|
||
type PdfAnnotationText struct{*PdfAnnotation ;*PdfAnnotationMarkup ;Open _fg .PdfObject ;Name _fg .PdfObject ;State _fg .PdfObject ;StateModel _fg .PdfObject ;};
|
||
|
||
// SetName sets the `Name` field of the signature.
|
||
func (_ebgcg *PdfSignature )SetName (name string ){_ebgcg .Name =_fg .MakeString (name )};
|
||
|
||
// DSS represents a Document Security Store dictionary.
|
||
// The DSS dictionary contains both global and signature specific validation
|
||
// information. The certificates and revocation data in the `Certs`, `OCSPs`,
|
||
// and `CRLs` fields can be used to validate any signature in the document.
|
||
// Additionally, the VRI entry contains validation data per signature.
|
||
// The keys in the VRI entry are calculated as upper(hex(sha1(sig.Contents))).
|
||
// The values are VRI dictionaries containing certificates and revocation
|
||
// information used for validating a single signature.
|
||
// See ETSI TS 102 778-4 V1.1.1 for more information.
|
||
type DSS struct{_gbaf *_fg .PdfIndirectObject ;Certs []*_fg .PdfObjectStream ;OCSPs []*_fg .PdfObjectStream ;CRLs []*_fg .PdfObjectStream ;VRI map[string ]*VRI ;_aacde map[string ]*_fg .PdfObjectStream ;_cgbbd map[string ]*_fg .PdfObjectStream ;_fdcc map[string ]*_fg .PdfObjectStream ;
|
||
};
|
||
|
||
// AddWatermarkImage adds a watermark to the page.
|
||
func (_bdeea *PdfPage )AddWatermarkImage (ximg *XObjectImage ,opt WatermarkImageOptions )error {_fbgfc ,_dcbcf :=_bdeea .GetMediaBox ();if _dcbcf !=nil {return _dcbcf ;};_gdbbd :=_fbgfc .Urx -_fbgfc .Llx ;_ffed :=_fbgfc .Ury -_fbgfc .Lly ;_daaf :=float64 (*ximg .Width );
|
||
_facde :=(_gdbbd -_daaf )/2;if opt .FitToWidth {_daaf =_gdbbd ;_facde =0;};_fbfaaf :=_ffed ;_feeda :=float64 (0);if opt .PreserveAspectRatio {_fbfaaf =_daaf *float64 (*ximg .Height )/float64 (*ximg .Width );_feeda =(_ffed -_fbfaaf )/2;};if _bdeea .Resources ==nil {_bdeea .Resources =NewPdfPageResources ();
|
||
};_ceeed :=0;_cgaba :=_fg .PdfObjectName (_d .Sprintf ("\u0049\u006d\u0077%\u0064",_ceeed ));for _bdeea .Resources .HasXObjectByName (_cgaba ){_ceeed ++;_cgaba =_fg .PdfObjectName (_d .Sprintf ("\u0049\u006d\u0077%\u0064",_ceeed ));};_dcbcf =_bdeea .AddImageResource (_cgaba ,ximg );
|
||
if _dcbcf !=nil {return _dcbcf ;};_ceeed =0;_gfagg :=_fg .PdfObjectName (_d .Sprintf ("\u0047\u0053\u0025\u0064",_ceeed ));for _bdeea .HasExtGState (_gfagg ){_ceeed ++;_gfagg =_fg .PdfObjectName (_d .Sprintf ("\u0047\u0053\u0025\u0064",_ceeed ));};_gbff :=_fg .MakeDict ();
|
||
_gbff .Set ("\u0042\u004d",_fg .MakeName ("\u004e\u006f\u0072\u006d\u0061\u006c"));_gbff .Set ("\u0043\u0041",_fg .MakeFloat (opt .Alpha ));_gbff .Set ("\u0063\u0061",_fg .MakeFloat (opt .Alpha ));_dcbcf =_bdeea .AddExtGState (_gfagg ,_gbff );if _dcbcf !=nil {return _dcbcf ;
|
||
};_accff :=_d .Sprintf ("\u0071\u000a"+"\u002f%\u0073\u0020\u0067\u0073\u000a"+"%\u002e\u0030\u0066\u0020\u0030\u00200\u0020\u0025\u002e\u0030\u0066\u0020\u0025\u002e\u0034f\u0020\u0025\u002e4\u0066 \u0063\u006d\u000a"+"\u002f%\u0073\u0020\u0044\u006f\u000a"+"\u0051",_gfagg ,_daaf ,_fbfaaf ,_facde ,_feeda ,_cgaba );
|
||
_bdeea .AddContentStreamByString (_accff );return nil ;};func (_cbab *PdfField )inherit (_cebec func (*PdfField )bool )(bool ,error ){_cbaed :=map[*PdfField ]bool {};_dedb :=false ;_eeafg :=_cbab ;for _eeafg !=nil {if _ ,_befbd :=_cbaed [_eeafg ];_befbd {return false ,_ce .New ("\u0072\u0065\u0063\u0075rs\u0069\u0076\u0065\u0020\u0074\u0072\u0061\u0076\u0065\u0072\u0073\u0061\u006c");
|
||
};_agd :=_cebec (_eeafg );if _agd {_dedb =true ;break ;};_cbaed [_eeafg ]=true ;_eeafg =_eeafg .Parent ;};return _dedb ,nil ;};func _gfeff (_fedg _fg .PdfObject )(*PdfColorspaceCalRGB ,error ){_cbef :=NewPdfColorspaceCalRGB ();if _becg ,_bgfg :=_fedg .(*_fg .PdfIndirectObject );
|
||
_bgfg {_cbef ._cfcb =_becg ;};_fedg =_fg .TraceToDirectObject (_fedg );_ffbb ,_bbga :=_fedg .(*_fg .PdfObjectArray );if !_bbga {return nil ,_d .Errorf ("\u0074\u0079\u0070\u0065\u0020\u0065\u0072\u0072\u006f\u0072");};if _ffbb .Len ()!=2{return nil ,_d .Errorf ("\u0069n\u0076\u0061\u006c\u0069d\u0020\u0043\u0061\u006c\u0052G\u0042 \u0063o\u006c\u006f\u0072\u0073\u0070\u0061\u0063e");
|
||
};_fedg =_fg .TraceToDirectObject (_ffbb .Get (0));_ebaae ,_bbga :=_fedg .(*_fg .PdfObjectName );if !_bbga {return nil ,_d .Errorf ("\u0043\u0061l\u0052\u0047\u0042\u0020\u006e\u0061\u006d\u0065\u0020\u006e\u006f\u0074\u0020\u0061\u0020\u004e\u0061\u006d\u0065\u0020\u006f\u0062je\u0063\u0074");
|
||
};if *_ebaae !="\u0043\u0061\u006c\u0052\u0047\u0042"{return nil ,_d .Errorf ("\u006e\u006f\u0074 a\u0020\u0043\u0061\u006c\u0052\u0047\u0042\u0020\u0063\u006f\u006c\u006f\u0072\u0073\u0070\u0061\u0063\u0065");};_fedg =_fg .TraceToDirectObject (_ffbb .Get (1));
|
||
_ffeb ,_bbga :=_fedg .(*_fg .PdfObjectDictionary );if !_bbga {return nil ,_d .Errorf ("\u0043\u0061l\u0052\u0047\u0042\u0020\u006e\u0061\u006d\u0065\u0020\u006e\u006f\u0074\u0020\u0061\u0020\u004e\u0061\u006d\u0065\u0020\u006f\u0062je\u0063\u0074");};_fedg =_ffeb .Get ("\u0057\u0068\u0069\u0074\u0065\u0050\u006f\u0069\u006e\u0074");
|
||
_fedg =_fg .TraceToDirectObject (_fedg );_agff ,_bbga :=_fedg .(*_fg .PdfObjectArray );if !_bbga {return nil ,_d .Errorf ("\u0043\u0061\u006c\u0052\u0047\u0042\u003a\u0020\u0049\u006e\u0076a\u006c\u0069\u0064\u0020\u0057\u0068\u0069\u0074\u0065\u0050o\u0069\u006e\u0074");
|
||
};if _agff .Len ()!=3{return nil ,_d .Errorf ("\u0043\u0061\u006c\u0052\u0047\u0042\u003a\u0020\u0049\u006e\u0076\u0061\u006c\u0069\u0064 \u0057h\u0069\u0074\u0065\u0050\u006f\u0069\u006e\u0074\u0020\u0061\u0072\u0072\u0061\u0079");};_edg ,_fedac :=_agff .GetAsFloat64Slice ();
|
||
if _fedac !=nil {return nil ,_fedac ;};_cbef .WhitePoint =_edg ;_fedg =_ffeb .Get ("\u0042\u006c\u0061\u0063\u006b\u0050\u006f\u0069\u006e\u0074");if _fedg !=nil {_fedg =_fg .TraceToDirectObject (_fedg );_dbfb ,_fedd :=_fedg .(*_fg .PdfObjectArray );if !_fedd {return nil ,_d .Errorf ("\u0043\u0061\u006c\u0052\u0047\u0042\u003a\u0020\u0049\u006e\u0076a\u006c\u0069\u0064\u0020\u0042\u006c\u0061\u0063\u006b\u0050o\u0069\u006e\u0074");
|
||
};if _dbfb .Len ()!=3{return nil ,_d .Errorf ("\u0043\u0061\u006c\u0052\u0047\u0042\u003a\u0020\u0049\u006e\u0076\u0061\u006c\u0069\u0064 \u0042l\u0061\u0063\u006b\u0050\u006f\u0069\u006e\u0074\u0020\u0061\u0072\u0072\u0061\u0079");};_dcgg ,_dadg :=_dbfb .GetAsFloat64Slice ();
|
||
if _dadg !=nil {return nil ,_dadg ;};_cbef .BlackPoint =_dcgg ;};_fedg =_ffeb .Get ("\u0047\u0061\u006dm\u0061");if _fedg !=nil {_fedg =_fg .TraceToDirectObject (_fedg );_afbg ,_dfba :=_fedg .(*_fg .PdfObjectArray );if !_dfba {return nil ,_d .Errorf ("C\u0061\u006c\u0052\u0047B:\u0020I\u006e\u0076\u0061\u006c\u0069d\u0020\u0047\u0061\u006d\u006d\u0061");
|
||
};if _afbg .Len ()!=3{return nil ,_d .Errorf ("C\u0061\u006c\u0052\u0047\u0042\u003a \u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0047a\u006d\u006d\u0061 \u0061r\u0072\u0061\u0079");};_aead ,_gda :=_afbg .GetAsFloat64Slice ();if _gda !=nil {return nil ,_gda ;
|
||
};_cbef .Gamma =_aead ;};_fedg =_ffeb .Get ("\u004d\u0061\u0074\u0072\u0069\u0078");if _fedg !=nil {_fedg =_fg .TraceToDirectObject (_fedg );_deff ,_dfec :=_fedg .(*_fg .PdfObjectArray );if !_dfec {return nil ,_d .Errorf ("\u0043\u0061\u006c\u0052GB\u003a\u0020\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u004d\u0061\u0074\u0072i\u0078");
|
||
};if _deff .Len ()!=9{_aa .Log .Error ("\u004d\u0061t\u0072\u0069\u0078 \u0061\u0072\u0072\u0061\u0079\u003a\u0020\u0025\u0073",_deff .String ());return nil ,_d .Errorf ("\u0043\u0061\u006c\u0052G\u0042\u003a\u0020\u0049\u006e\u0076\u0061\u006c\u0069\u0064 \u004da\u0074\u0072\u0069\u0078\u0020\u0061\u0072r\u0061\u0079");
|
||
};_cggd ,_gfcb :=_deff .GetAsFloat64Slice ();if _gfcb !=nil {return nil ,_gfcb ;};_cbef .Matrix =_cggd ;};return _cbef ,nil ;};
|
||
|
||
// PdfAnnotationPolygon represents Polygon annotations.
|
||
// (Section 12.5.6.9).
|
||
type PdfAnnotationPolygon struct{*PdfAnnotation ;*PdfAnnotationMarkup ;Vertices _fg .PdfObject ;LE _fg .PdfObject ;BS _fg .PdfObject ;IC _fg .PdfObject ;BE _fg .PdfObject ;IT _fg .PdfObject ;Measure _fg .PdfObject ;};
|
||
|
||
// GetAllContentStreams gets all the content streams for a page as one string.
|
||
func (_afab *PdfPage )GetAllContentStreams ()(string ,error ){_ggaf ,_fedag :=_afab .GetContentStreams ();if _fedag !=nil {return "",_fedag ;};return _dc .Join (_ggaf ,"\u0020"),nil ;};
|
||
|
||
// GetPageDict converts the Page to a PDF object dictionary.
|
||
func (_dffa *PdfPage )GetPageDict ()*_fg .PdfObjectDictionary {_deffb :=_dffa ._eebge ;_deffb .Clear ();_deffb .Set ("\u0054\u0079\u0070\u0065",_fg .MakeName ("\u0050\u0061\u0067\u0065"));_deffb .Set ("\u0050\u0061\u0072\u0065\u006e\u0074",_dffa .Parent );
|
||
if _dffa .LastModified !=nil {_deffb .Set ("\u004c\u0061\u0073t\u004d\u006f\u0064\u0069\u0066\u0069\u0065\u0064",_dffa .LastModified .ToPdfObject ());};if _dffa .Resources !=nil {_deffb .Set ("\u0052e\u0073\u006f\u0075\u0072\u0063\u0065s",_dffa .Resources .ToPdfObject ());
|
||
};if _dffa .CropBox !=nil {_deffb .Set ("\u0043r\u006f\u0070\u0042\u006f\u0078",_dffa .CropBox .ToPdfObject ());};if _dffa .MediaBox !=nil {_deffb .Set ("\u004d\u0065\u0064\u0069\u0061\u0042\u006f\u0078",_dffa .MediaBox .ToPdfObject ());};if _dffa .BleedBox !=nil {_deffb .Set ("\u0042\u006c\u0065\u0065\u0064\u0042\u006f\u0078",_dffa .BleedBox .ToPdfObject ());
|
||
};if _dffa .TrimBox !=nil {_deffb .Set ("\u0054r\u0069\u006d\u0042\u006f\u0078",_dffa .TrimBox .ToPdfObject ());};if _dffa .ArtBox !=nil {_deffb .Set ("\u0041\u0072\u0074\u0042\u006f\u0078",_dffa .ArtBox .ToPdfObject ());};_deffb .SetIfNotNil ("\u0042\u006f\u0078C\u006f\u006c\u006f\u0072\u0049\u006e\u0066\u006f",_dffa .BoxColorInfo );
|
||
_deffb .SetIfNotNil ("\u0043\u006f\u006e\u0074\u0065\u006e\u0074\u0073",_dffa .Contents );if _dffa .Rotate !=nil {_deffb .Set ("\u0052\u006f\u0074\u0061\u0074\u0065",_fg .MakeInteger (*_dffa .Rotate ));};_deffb .SetIfNotNil ("\u0047\u0072\u006fu\u0070",_dffa .Group );
|
||
_deffb .SetIfNotNil ("\u0054\u0068\u0075m\u0062",_dffa .Thumb );_deffb .SetIfNotNil ("\u0042",_dffa .B );_deffb .SetIfNotNil ("\u0044\u0075\u0072",_dffa .Dur );_deffb .SetIfNotNil ("\u0054\u0072\u0061n\u0073",_dffa .Trans );_deffb .SetIfNotNil ("\u0041\u0041",_dffa .AA );
|
||
_deffb .SetIfNotNil ("\u004d\u0065\u0074\u0061\u0064\u0061\u0074\u0061",_dffa .Metadata );_deffb .SetIfNotNil ("\u0050i\u0065\u0063\u0065\u0049\u006e\u0066o",_dffa .PieceInfo );_deffb .SetIfNotNil ("\u0053\u0074\u0072\u0075\u0063\u0074\u0050\u0061\u0072\u0065\u006e\u0074\u0073",_dffa .StructParents );
|
||
_deffb .SetIfNotNil ("\u0049\u0044",_dffa .ID );_deffb .SetIfNotNil ("\u0050\u005a",_dffa .PZ );_deffb .SetIfNotNil ("\u0053\u0065\u0070\u0061\u0072\u0061\u0074\u0069\u006fn\u0049\u006e\u0066\u006f",_dffa .SeparationInfo );_deffb .SetIfNotNil ("\u0054\u0061\u0062\u0073",_dffa .Tabs );
|
||
_deffb .SetIfNotNil ("T\u0065m\u0070\u006c\u0061\u0074\u0065\u0049\u006e\u0073t\u0061\u006e\u0074\u0069at\u0065\u0064",_dffa .TemplateInstantiated );_deffb .SetIfNotNil ("\u0050r\u0065\u0073\u0053\u0074\u0065\u0070s",_dffa .PresSteps );_deffb .SetIfNotNil ("\u0055\u0073\u0065\u0072\u0055\u006e\u0069\u0074",_dffa .UserUnit );
|
||
_deffb .SetIfNotNil ("\u0056\u0050",_dffa .VP );if _dffa ._fbbb !=nil {_agaaa :=_fg .MakeArray ();for _ ,_ggaga :=range _dffa ._fbbb {if _cdaae :=_ggaga .GetContext ();_cdaae !=nil {_agaaa .Append (_cdaae .ToPdfObject ());}else {_agaaa .Append (_ggaga .ToPdfObject ());
|
||
};};if _agaaa .Len ()> 0{_deffb .Set ("\u0041\u006e\u006e\u006f\u0074\u0073",_agaaa );};}else if _dffa .Annots !=nil {_deffb .SetIfNotNil ("\u0041\u006e\u006e\u006f\u0074\u0073",_dffa .Annots );};return _deffb ;};
|
||
|
||
// PdfAction represents an action in PDF (section 12.6 p. 412).
|
||
type PdfAction struct{_bd PdfModel ;Type _fg .PdfObject ;S _fg .PdfObject ;Next _fg .PdfObject ;_bda *_fg .PdfIndirectObject ;};
|
||
|
||
// PdfBorderEffect represents a PDF border effect.
|
||
type PdfBorderEffect struct{S *BorderEffect ;I *float64 ;};
|
||
|
||
// ToPdfOutline returns a low level PdfOutline object, based on the current
|
||
// instance.
|
||
func (_cefc *Outline )ToPdfOutline ()*PdfOutline {_agda :=NewPdfOutline ();var _ecde []*PdfOutlineItem ;var _fafbd int64 ;var _daagfb *PdfOutlineItem ;for _ ,_efab :=range _cefc .Entries {_gcagg ,_fccea :=_efab .ToPdfOutlineItem ();_gcagg .Parent =&_agda .PdfOutlineTreeNode ;
|
||
if _daagfb !=nil {_daagfb .Next =&_gcagg .PdfOutlineTreeNode ;_gcagg .Prev =&_daagfb .PdfOutlineTreeNode ;};_ecde =append (_ecde ,_gcagg );_fafbd +=_fccea ;_daagfb =_gcagg ;};_cegb :=int64 (len (_ecde ));_fafbd +=_cegb ;if _cegb > 0{_agda .First =&_ecde [0].PdfOutlineTreeNode ;
|
||
_agda .Last =&_ecde [_cegb -1].PdfOutlineTreeNode ;_agda .Count =&_fafbd ;};return _agda ;};
|
||
|
||
// NewPdfActionLaunch returns a new "launch" action.
|
||
func NewPdfActionLaunch ()*PdfActionLaunch {_gbef :=NewPdfAction ();_age :=&PdfActionLaunch {};_age .PdfAction =_gbef ;_gbef .SetContext (_age );return _age ;};func (_gdefg *PdfReader )loadForms ()(*PdfAcroForm ,error ){if _gdefg ._ccgg .GetCrypter ()!=nil &&!_gdefg ._ccgg .IsAuthenticated (){return nil ,_d .Errorf ("\u0066\u0069\u006ce\u0020\u006e\u0065\u0065d\u0020\u0074\u006f\u0020\u0062\u0065\u0020d\u0065\u0063\u0072\u0079\u0070\u0074\u0065\u0064\u0020\u0066\u0069\u0072\u0073\u0074");
|
||
};_cgged :=_gdefg ._cgegd ;_cdca :=_cgged .Get ("\u0041\u0063\u0072\u006f\u0046\u006f\u0072\u006d");if _cdca ==nil {return nil ,nil ;};_ecbee ,_gdbbb :=_fg .GetIndirect (_cdca );_cdca =_fg .TraceToDirectObject (_cdca );if _fg .IsNullObject (_cdca ){_aa .Log .Trace ("\u0041\u0063\u0072of\u006f\u0072\u006d\u0020\u0069\u0073\u0020\u0061\u0020n\u0075l\u006c \u006fb\u006a\u0065\u0063\u0074\u0020\u0028\u0065\u006d\u0070\u0074\u0079\u0029\u000a");
|
||
return nil ,nil ;};_fbggf ,_gfaga :=_fg .GetDict (_cdca );if !_gfaga {_aa .Log .Debug ("\u0049n\u0076\u0061\u006c\u0069d\u0020\u0041\u0063\u0072\u006fF\u006fr\u006d \u0065\u006e\u0074\u0072\u0079\u0020\u0025T",_cdca );_aa .Log .Debug ("\u0044\u006f\u0065\u0073 n\u006f\u0074\u0020\u0068\u0061\u0076\u0065\u0020\u0066\u006f\u0072\u006d\u0073");
|
||
return nil ,_d .Errorf ("\u0069n\u0076\u0061\u006c\u0069d\u0020\u0061\u0063\u0072\u006ff\u006fr\u006d \u0065\u006e\u0074\u0072\u0079\u0020\u0025T",_cdca );};_aa .Log .Trace ("\u0048\u0061\u0073\u0020\u0041\u0063\u0072\u006f\u0020f\u006f\u0072\u006d\u0073");
|
||
_aa .Log .Trace ("\u0054\u0072\u0061\u0076\u0065\u0072\u0073\u0065\u0020\u0074\u0068\u0065\u0020\u0041\u0063r\u006ff\u006f\u0072\u006d\u0073\u0020\u0073\u0074\u0072\u0075\u0063\u0074\u0075\u0072\u0065");if !_gdefg ._beegg {_cadbd :=_gdefg .traverseObjectData (_fbggf );
|
||
if _cadbd !=nil {_aa .Log .Debug ("E\u0052\u0052\u004f\u0052\u003a\u0020\u0055\u006e\u0061\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0074\u0072a\u0076\u0065\u0072\u0073\u0065\u0020\u0041\u0063\u0072\u006fFo\u0072\u006d\u0073 \u0028%\u0073\u0029",_cadbd );
|
||
return nil ,_cadbd ;};};_caabe ,_aceaa :=_gdefg .newPdfAcroFormFromDict (_ecbee ,_fbggf );if _aceaa !=nil {return nil ,_aceaa ;};_caabe ._fgdbf =!_gdbbb ;return _caabe ,nil ;};
|
||
|
||
// NewPdfAnnotationWidget returns an initialized annotation widget.
|
||
func NewPdfAnnotationWidget ()*PdfAnnotationWidget {_bdd :=NewPdfAnnotation ();_becf :=&PdfAnnotationWidget {};_becf .PdfAnnotation =_bdd ;_bdd .SetContext (_becf );return _becf ;};
|
||
|
||
// AcroFormNeedsRepair returns true if the document contains widget annotations
|
||
// linked to fields which are not referenced in the AcroForm. The AcroForm can
|
||
// be repaired using the RepairAcroForm method of the reader.
|
||
func (_dbgcf *PdfReader )AcroFormNeedsRepair ()(bool ,error ){var _acede []*PdfField ;if _dbgcf .AcroForm !=nil {_acede =_dbgcf .AcroForm .AllFields ();};_fgcgf :=make (map[*PdfField ]struct{},len (_acede ));for _ ,_deddc :=range _acede {_fgcgf [_deddc ]=struct{}{};
|
||
};for _ ,_ecfbdc :=range _dbgcf .PageList {_dbcgf ,_efgff :=_ecfbdc .GetAnnotations ();if _efgff !=nil {return false ,_efgff ;};for _ ,_bdccb :=range _dbcgf {_ccbeb ,_afeca :=_bdccb .GetContext ().(*PdfAnnotationWidget );if !_afeca {continue ;};_aedg :=_ccbeb .Field ();
|
||
if _aedg ==nil {return true ,nil ;};if _ ,_cdabg :=_fgcgf [_aedg ];!_cdabg {return true ,nil ;};};};return false ,nil ;};func (_dgded *PdfReader )loadAnnotations (_bbbbe _fg .PdfObject )([]*PdfAnnotation ,error ){_aaadd ,_cgegg :=_fg .GetArray (_bbbbe );
|
||
if !_cgegg {return nil ,_d .Errorf ("\u0041\u006e\u006e\u006fts\u0020\u006e\u006f\u0074\u0020\u0061\u006e\u0020\u0061\u0072\u0072\u0061\u0079");};var _ceegc []*PdfAnnotation ;for _ ,_bgfd :=range _aaadd .Elements (){_bgfd =_fg .ResolveReference (_bgfd );
|
||
if _ ,_acega :=_bgfd .(*_fg .PdfObjectNull );_acega {continue ;};_decba ,_bfga :=_bgfd .(*_fg .PdfObjectDictionary );_bfbc ,_cgfcfg :=_bgfd .(*_fg .PdfIndirectObject );if _bfga {_bfbc =&_fg .PdfIndirectObject {};_bfbc .PdfObject =_decba ;}else {if !_cgfcfg {return nil ,_d .Errorf ("\u0061\u006eno\u0074\u0061\u0074i\u006f\u006e\u0020\u006eot \u0069n \u0061\u006e\u0020\u0069\u006e\u0064\u0069re\u0063\u0074\u0020\u006f\u0062\u006a\u0065c\u0074");
|
||
};};_dcadc ,_daadae :=_dgded .newPdfAnnotationFromIndirectObject (_bfbc );if _daadae !=nil {return nil ,_daadae ;};switch _eabaca :=_dcadc .GetContext ().(type ){case *PdfAnnotationWidget :for _ ,_gfdc :=range _dgded .AcroForm .AllFields (){if _gfdc ._daecc ==_eabaca .Parent {_eabaca ._ddcc =_gfdc ;
|
||
break ;};};};if _dcadc !=nil {_ceegc =append (_ceegc ,_dcadc );};};return _ceegc ,nil ;};func (_cfbc *PdfReader )newPdfAnnotationCaretFromDict (_fcg *_fg .PdfObjectDictionary )(*PdfAnnotationCaret ,error ){_bbda :=PdfAnnotationCaret {};_fdag ,_afea :=_cfbc .newPdfAnnotationMarkupFromDict (_fcg );
|
||
if _afea !=nil {return nil ,_afea ;};_bbda .PdfAnnotationMarkup =_fdag ;_bbda .RD =_fcg .Get ("\u0052\u0044");_bbda .Sy =_fcg .Get ("\u0053\u0079");return &_bbda ,nil ;};func _accab (_bcca _fg .PdfObject )(string ,error ){_bcca =_fg .TraceToDirectObject (_bcca );
|
||
switch _efage :=_bcca .(type ){case *_fg .PdfObjectString :return _efage .Str (),nil ;case *_fg .PdfObjectStream :_caddc ,_degd :=_fg .DecodeStream (_efage );if _degd !=nil {return "",_degd ;};return string (_caddc ),nil ;};return "",_d .Errorf ("\u0069\u006e\u0076\u0061\u006ci\u0064\u0020\u0063\u006f\u006e\u0074\u0065\u006e\u0074\u0020\u0073\u0074\u0072e\u0061\u006d\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u0020\u0068\u006f\u006c\u0064\u0065\u0072\u0020\u0028\u0025\u0054\u0029",_bcca );
|
||
};
|
||
|
||
// ToPdfObject recursively builds the Outline tree PDF object.
|
||
func (_dcedd *PdfOutlineItem )ToPdfObject ()_fg .PdfObject {_cfbgd :=_dcedd ._aeadb ;_cadag :=_cfbgd .PdfObject .(*_fg .PdfObjectDictionary );_cadag .Set ("\u0054\u0069\u0074l\u0065",_dcedd .Title );if _dcedd .A !=nil {_cadag .Set ("\u0041",_dcedd .A );
|
||
};if _bgcc :=_cadag .Get ("\u0053\u0045");_bgcc !=nil {_cadag .Remove ("\u0053\u0045");};if _dcedd .C !=nil {_cadag .Set ("\u0043",_dcedd .C );};if _dcedd .Dest !=nil {_cadag .Set ("\u0044\u0065\u0073\u0074",_dcedd .Dest );};if _dcedd .F !=nil {_cadag .Set ("\u0046",_dcedd .F );
|
||
};if _dcedd .Count !=nil {_cadag .Set ("\u0043\u006f\u0075n\u0074",_fg .MakeInteger (*_dcedd .Count ));};if _dcedd .Next !=nil {_cadag .Set ("\u004e\u0065\u0078\u0074",_dcedd .Next .ToPdfObject ());};if _dcedd .First !=nil {_cadag .Set ("\u0046\u0069\u0072s\u0074",_dcedd .First .ToPdfObject ());
|
||
};if _dcedd .Prev !=nil {_cadag .Set ("\u0050\u0072\u0065\u0076",_dcedd .Prev .GetContext ().GetContainingPdfObject ());};if _dcedd .Last !=nil {_cadag .Set ("\u004c\u0061\u0073\u0074",_dcedd .Last .GetContext ().GetContainingPdfObject ());};if _dcedd .Parent !=nil {_cadag .Set ("\u0050\u0061\u0072\u0065\u006e\u0074",_dcedd .Parent .GetContext ().GetContainingPdfObject ());
|
||
};return _cfbgd ;};
|
||
|
||
// Mask returns the uin32 bitmask for the specific flag.
|
||
func (_bagc FieldFlag )Mask ()uint32 {return uint32 (_bagc )};func (_fggf *LTV )getCRLs (_cacfgc []*_ge .Certificate )([][]byte ,error ){_edbcf :=make ([][]byte ,0,len (_cacfgc ));for _ ,_bdfba :=range _cacfgc {for _ ,_geeff :=range _bdfba .CRLDistributionPoints {if _fggf .CertClient .IsCA (_bdfba ){continue ;
|
||
};_baff ,_aedcc :=_fggf .CRLClient .MakeRequest (_geeff ,_bdfba );if _aedcc !=nil {_aa .Log .Debug ("W\u0041\u0052\u004e\u003a\u0020\u0043R\u004c\u0020\u0072\u0065\u0071\u0075\u0065\u0073\u0074 \u0065\u0072\u0072o\u0072:\u0020\u0025\u0076",_aedcc );continue ;
|
||
};_edbcf =append (_edbcf ,_baff );};};return _edbcf ,nil ;};
|
||
|
||
// ParsePdfObject parses input pdf object into given output intent.
|
||
func (_cefe *PdfOutputIntent )ParsePdfObject (object _fg .PdfObject )error {_bcbdg ,_fecdd :=_fg .GetDict (object );if !_fecdd {_aa .Log .Error ("\u0055\u006e\u006bno\u0077\u006e\u0020\u0074\u0079\u0070\u0065\u003a\u0020%\u0054 \u0066o\u0072 \u006f\u0075\u0074\u0070\u0075\u0074\u0020\u0069\u006e\u0074\u0065\u006e\u0074",object );
|
||
return _ce .New ("\u0075\u006e\u006b\u006e\u006fw\u006e\u0020\u0070\u0064\u0066\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u0020t\u0079\u0070\u0065\u0020\u0066\u006f\u0072\u0020\u006f\u0075\u0074\u0070\u0075\u0074\u0020\u0069\u006e\u0074\u0065\u006e\u0074");
|
||
};_cefe ._geaa =_bcbdg ;_cefe .Type ,_ =_bcbdg .GetString ("\u0054\u0079\u0070\u0065");_bacca ,_fecdd :=_bcbdg .GetString ("\u0053");if _fecdd {switch _bacca {case "\u0047T\u0053\u005f\u0050\u0044\u0046\u00411":_cefe .S =PdfOutputIntentTypeA1 ;case "\u0047T\u0053\u005f\u0050\u0044\u0046\u00412":_cefe .S =PdfOutputIntentTypeA2 ;
|
||
case "\u0047T\u0053\u005f\u0050\u0044\u0046\u00413":_cefe .S =PdfOutputIntentTypeA3 ;case "\u0047T\u0053\u005f\u0050\u0044\u0046\u00414":_cefe .S =PdfOutputIntentTypeA4 ;case "\u0047\u0054\u0053\u005f\u0050\u0044\u0046\u0058":_cefe .S =PdfOutputIntentTypeX ;
|
||
};};_cefe .OutputCondition ,_ =_bcbdg .GetString ("\u004fu\u0074p\u0075\u0074\u0043\u006f\u006e\u0064\u0069\u0074\u0069\u006f\u006e");_cefe .OutputConditionIdentifier ,_ =_bcbdg .GetString ("\u004fu\u0074\u0070\u0075\u0074C\u006f\u006e\u0064\u0069\u0074i\u006fn\u0049d\u0065\u006e\u0074\u0069\u0066\u0069\u0065r");
|
||
_cefe .RegistryName ,_ =_bcbdg .GetString ("\u0052\u0065\u0067i\u0073\u0074\u0072\u0079\u004e\u0061\u006d\u0065");_cefe .Info ,_ =_bcbdg .GetString ("\u0049\u006e\u0066\u006f");if _dedg ,_ggcdd :=_fg .GetStream (_bcbdg .Get ("\u0044\u0065\u0073\u0074\u004f\u0075\u0074\u0070\u0075\u0074\u0050\u0072o\u0066\u0069\u006c\u0065"));
|
||
_ggcdd {_cefe .ColorComponents ,_ =_fg .GetIntVal (_dedg .Get ("\u004e"));_bcbee ,_gbcdb :=_fg .DecodeStream (_dedg );if _gbcdb !=nil {return _gbcdb ;};_cefe .DestOutputProfile =_bcbee ;};return nil ;};
|
||
|
||
// Write writes out the PDF.
|
||
func (_cafeb *PdfWriter )Write (writer _ff .Writer )error {_aa .Log .Trace ("\u0057r\u0069\u0074\u0065\u0028\u0029");_abdda :=_cafeb .checkLicense ();if _abdda !=nil {return _abdda ;};if _abdda =_cafeb .writeOutlines ();_abdda !=nil {return _abdda ;};if _abdda =_cafeb .writeAcroFormFields ();
|
||
_abdda !=nil {return _abdda ;};_cafeb .checkPendingObjects ();if _abdda =_cafeb .writeOutputIntents ();_abdda !=nil {return _abdda ;};_cafeb .setCatalogVersion ();_cafeb .copyObjects ();if _abdda =_cafeb .optimize ();_abdda !=nil {return _abdda ;};if _abdda =_cafeb .optimizeDocument ();
|
||
_abdda !=nil {return _abdda ;};var _fabgb _e .Hash ;if _cafeb ._gaaaab {_fabgb =_fd .New ();writer =_ff .MultiWriter (_fabgb ,writer );};_cafeb .setWriter (writer );_gddee :=_cafeb .checkCrossReferenceStream ();_cbfae ,_gddee :=_cafeb .mapObjectStreams (_gddee );
|
||
_cafeb .adjustXRefAffectedVersion (_gddee );_cafeb .writeDocumentVersion ();_cafeb .updateObjectNumbers ();_cafeb .writeObjects ();if _abdda =_cafeb .writeObjectsInStreams (_cbfae );_abdda !=nil {return _abdda ;};_fcccd :=_cafeb ._fcgga ;var _efdae int ;
|
||
for _eccdb :=range _cafeb ._aafgd {if _eccdb > _efdae {_efdae =_eccdb ;};};if _cafeb ._gaaaab {if _abdda =_cafeb .setHashIDs (_fabgb );_abdda !=nil {return _abdda ;};};if _gddee {if _abdda =_cafeb .writeXRefStreams (_efdae ,_fcccd );_abdda !=nil {return _abdda ;
|
||
};}else {_cafeb .writeTrailer (_efdae );};_cafeb .makeOffSetReference (_fcccd );if _abdda =_cafeb .flushWriter ();_abdda !=nil {return _abdda ;};return nil ;};
|
||
|
||
// PdfShadingType4 is a Free-form Gouraud-shaded triangle mesh.
|
||
type PdfShadingType4 struct{*PdfShading ;BitsPerCoordinate *_fg .PdfObjectInteger ;BitsPerComponent *_fg .PdfObjectInteger ;BitsPerFlag *_fg .PdfObjectInteger ;Decode *_fg .PdfObjectArray ;Function []PdfFunction ;};
|
||
|
||
// NewPdfDate returns a new PdfDate object from a PDF date string (see 7.9.4 Dates).
|
||
// format: "D: YYYYMMDDHHmmSSOHH'mm"
|
||
func NewPdfDate (dateStr string )(PdfDate ,error ){_fabda ,_ddgge :=_ag .ParsePdfTime (dateStr );if _ddgge !=nil {return PdfDate {},_ddgge ;};return NewPdfDateFromTime (_fabda );};
|
||
|
||
// SetPdfKeywords sets the Keywords attribute of the output PDF.
|
||
func SetPdfKeywords (keywords string ){_baacg .Lock ();defer _baacg .Unlock ();_fdcca =keywords };
|
||
|
||
// ToPdfObject returns the PDF representation of the shading pattern.
|
||
func (_eeec *PdfShadingPattern )ToPdfObject ()_fg .PdfObject {_eeec .PdfPattern .ToPdfObject ();_dgccb :=_eeec .getDict ();if _eeec .Shading !=nil {_dgccb .Set ("\u0053h\u0061\u0064\u0069\u006e\u0067",_eeec .Shading .ToPdfObject ());};if _eeec .Matrix !=nil {_dgccb .Set ("\u004d\u0061\u0074\u0072\u0069\u0078",_eeec .Matrix );
|
||
};if _eeec .ExtGState !=nil {_dgccb .Set ("\u0045x\u0074\u0047\u0053\u0074\u0061\u0074e",_eeec .ExtGState );};return _eeec ._gaac ;};
|
||
|
||
// PdfColorspaceICCBased format [/ICCBased stream]
|
||
//
|
||
// The stream shall contain the ICC profile.
|
||
// A conforming reader shall support ICC.1:2004:10 as required by PDF 1.7, which will enable it
|
||
// to properly render all embedded ICC profiles regardless of the PDF version
|
||
//
|
||
// In the current implementation, we rely on the alternative colormap provided.
|
||
type PdfColorspaceICCBased struct{N int ;Alternate PdfColorspace ;
|
||
|
||
// If omitted ICC not supported: then use DeviceGray,
|
||
// DeviceRGB or DeviceCMYK for N=1,3,4 respectively.
|
||
Range []float64 ;Metadata *_fg .PdfObjectStream ;Data []byte ;_dgca *_fg .PdfIndirectObject ;_cebf *_fg .PdfObjectStream ;};
|
||
|
||
// AddAnnotation appends `annot` to the list of page annotations.
|
||
func (_ageaa *PdfPage )AddAnnotation (annot *PdfAnnotation ){if _ageaa ._fbbb ==nil {_ageaa .GetAnnotations ();};_ageaa ._fbbb =append (_ageaa ._fbbb ,annot );};
|
||
|
||
// FieldFilterFunc represents a PDF field filtering function. If the function
|
||
// returns true, the PDF field is kept, otherwise it is discarded.
|
||
type FieldFilterFunc func (*PdfField )bool ;
|
||
|
||
// DecodeArray returns the range of color component values in DeviceCMYK colorspace.
|
||
func (_feeee *PdfColorspaceDeviceCMYK )DecodeArray ()[]float64 {return []float64 {0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0};};func (_cff *PdfReader )newPdfAnnotationPopupFromDict (_bgbe *_fg .PdfObjectDictionary )(*PdfAnnotationPopup ,error ){_agaf :=PdfAnnotationPopup {};
|
||
_agaf .Parent =_bgbe .Get ("\u0050\u0061\u0072\u0065\u006e\u0074");_agaf .Open =_bgbe .Get ("\u004f\u0070\u0065\u006e");return &_agaf ,nil ;};
|
||
|
||
// GetXHeight returns the XHeight of the font `descriptor`.
|
||
func (_bbdfb *PdfFontDescriptor )GetXHeight ()(float64 ,error ){return _fg .GetNumberAsFloat (_bbdfb .XHeight );};
|
||
|
||
// HasFontByName checks whether a font is defined by the specified keyName.
|
||
func (_eede *PdfPageResources )HasFontByName (keyName _fg .PdfObjectName )bool {_ ,_bbfbf :=_eede .GetFontByName (keyName );return _bbfbf ;};
|
||
|
||
// Register registers (caches) a model to primitive object relationship.
|
||
func (_dfbaf *modelManager )Register (primitive _fg .PdfObject ,model PdfModel ){_dfbaf ._abga [model ]=primitive ;_dfbaf ._fbbfaf [primitive ]=model ;};func _dadgg (_adfba *_fg .PdfObjectDictionary )(*PdfShadingType7 ,error ){_fgdd :=PdfShadingType7 {};
|
||
_abfed :=_adfba .Get ("\u0042\u0069\u0074\u0073\u0050\u0065\u0072\u0043\u006f\u006f\u0072\u0064i\u006e\u0061\u0074\u0065");if _abfed ==nil {_aa .Log .Debug ("\u0052e\u0071\u0075i\u0072\u0065\u0064 \u0061\u0074\u0074\u0072\u0069\u0062\u0075t\u0065\u0020\u006d\u0069\u0073\u0073i\u006e\u0067\u003a\u0020\u0042\u0069\u0074\u0073\u0050\u0065\u0072C\u006f\u006f\u0072\u0064\u0069\u006e\u0061\u0074\u0065");
|
||
return nil ,ErrRequiredAttributeMissing ;};_acedb ,_gbddc :=_abfed .(*_fg .PdfObjectInteger );if !_gbddc {_aa .Log .Debug ("\u0042\u0069\u0074\u0073\u0050e\u0072\u0043\u006f\u006f\u0072\u0064\u0069\u006e\u0061\u0074\u0065\u0020\u006eo\u0074\u0020\u0061\u006e\u0020\u0069\u006e\u0074\u0065\u0067\u0065\u0072\u0020\u0028\u0067\u006f\u0074\u0020\u0025\u0054\u0029",_abfed );
|
||
return nil ,_fg .ErrTypeError ;};_fgdd .BitsPerCoordinate =_acedb ;_abfed =_adfba .Get ("\u0042\u0069t\u0073\u0050\u0065r\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074");if _abfed ==nil {_aa .Log .Debug ("\u0052e\u0071\u0075i\u0072\u0065\u0064\u0020a\u0074\u0074\u0072i\u0062\u0075\u0074\u0065\u0020\u006d\u0069\u0073\u0073in\u0067\u003a\u0020B\u0069\u0074s\u0050\u0065\u0072\u0043\u006f\u006dp\u006f\u006ee\u006e\u0074");
|
||
return nil ,ErrRequiredAttributeMissing ;};_acedb ,_gbddc =_abfed .(*_fg .PdfObjectInteger );if !_gbddc {_aa .Log .Debug ("B\u0069\u0074\u0073\u0050\u0065\u0072\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074\u0020\u006e\u006ft\u0020\u0061\u006e\u0020\u0069\u006e\u0074\u0065\u0067\u0065r \u0028\u0067\u006ft\u0020%\u0054\u0029",_abfed );
|
||
return nil ,_fg .ErrTypeError ;};_fgdd .BitsPerComponent =_acedb ;_abfed =_adfba .Get ("B\u0069\u0074\u0073\u0050\u0065\u0072\u0046\u006c\u0061\u0067");if _abfed ==nil {_aa .Log .Debug ("\u0052\u0065\u0071\u0075\u0069\u0072\u0065\u0064\u0020\u0061\u0074\u0074\u0072i\u0062\u0075\u0074\u0065\u0020\u006di\u0073\u0073\u0069\u006e\u0067\u003a\u0020\u0042\u0069\u0074\u0073\u0050\u0065r\u0046\u006c\u0061\u0067");
|
||
return nil ,ErrRequiredAttributeMissing ;};_acedb ,_gbddc =_abfed .(*_fg .PdfObjectInteger );if !_gbddc {_aa .Log .Debug ("B\u0069\u0074\u0073\u0050\u0065\u0072F\u006c\u0061\u0067\u0020\u006e\u006ft\u0020\u0061\u006e\u0020\u0069\u006e\u0074e\u0067\u0065\u0072\u0020\u0028\u0067\u006f\u0074\u0020\u0025T\u0029",_abfed );
|
||
return nil ,_fg .ErrTypeError ;};_fgdd .BitsPerComponent =_acedb ;_abfed =_adfba .Get ("\u0044\u0065\u0063\u006f\u0064\u0065");if _abfed ==nil {_aa .Log .Debug ("\u0052\u0065\u0071ui\u0072\u0065\u0064\u0020\u0061\u0074\u0074\u0072\u0069b\u0075t\u0065 \u006di\u0073\u0073\u0069\u006e\u0067\u003a\u0020\u0044\u0065\u0063\u006f\u0064\u0065");
|
||
return nil ,ErrRequiredAttributeMissing ;};_gfff ,_gbddc :=_abfed .(*_fg .PdfObjectArray );if !_gbddc {_aa .Log .Debug ("\u0044\u0065\u0063\u006fd\u0065\u0020\u006e\u006f\u0074\u0020\u0061\u006e\u0020\u0061r\u0072a\u0079\u0020\u0028\u0067\u006f\u0074\u0020%\u0054\u0029",_abfed );
|
||
return nil ,_fg .ErrTypeError ;};_fgdd .Decode =_gfff ;if _ddeea :=_adfba .Get ("\u0046\u0075\u006e\u0063\u0074\u0069\u006f\u006e");_ddeea !=nil {_fgdd .Function =[]PdfFunction {};if _dabde ,_bdffg :=_ddeea .(*_fg .PdfObjectArray );_bdffg {for _ ,_fbgfb :=range _dabde .Elements (){_eaage ,_ecdbef :=_defgb (_fbgfb );
|
||
if _ecdbef !=nil {_aa .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0070\u0061\u0072\u0073\u0069n\u0067\u0020\u0066\u0075\u006e\u0063\u0074\u0069\u006f\u006e:\u0020\u0025\u0076",_ecdbef );return nil ,_ecdbef ;};_fgdd .Function =append (_fgdd .Function ,_eaage );
|
||
};}else {_abde ,_ccbge :=_defgb (_ddeea );if _ccbge !=nil {_aa .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0070\u0061\u0072\u0073\u0069n\u0067\u0020\u0066\u0075\u006e\u0063\u0074\u0069\u006f\u006e:\u0020\u0025\u0076",_ccbge );return nil ,_ccbge ;
|
||
};_fgdd .Function =append (_fgdd .Function ,_abde );};};return &_fgdd ,nil ;};func (_gaga *PdfWriter )writeObjects (){_aa .Log .Trace ("\u0057\u0072\u0069\u0074\u0069\u006e\u0067\u0020\u0025d\u0020\u006f\u0062\u006a",len (_gaga ._bbfd ));_gaga ._aafgd =make (map[int ]crossReference );
|
||
_gaga ._aafgd [0]=crossReference {Type :0,ObjectNumber :0,Generation :0xFFFF};if _gaga ._abeeb .ObjectMap !=nil {for _babcf ,_gdgbf :=range _gaga ._abeeb .ObjectMap {if _babcf ==0{continue ;};if _gdgbf .XType ==_fg .XrefTypeObjectStream {_cffead :=crossReference {Type :2,ObjectNumber :_gdgbf .OsObjNumber ,Index :_gdgbf .OsObjIndex };
|
||
_gaga ._aafgd [_babcf ]=_cffead ;};if _gdgbf .XType ==_fg .XrefTypeTableEntry {_ebfae :=crossReference {Type :1,ObjectNumber :_gdgbf .ObjectNumber ,Offset :_gdgbf .Offset };_gaga ._aafgd [_babcf ]=_ebfae ;};};};};
|
||
|
||
// HasExtGState checks whether a font is defined by the specified keyName.
|
||
func (_agcgf *PdfPageResources )HasExtGState (keyName _fg .PdfObjectName )bool {_ ,_cebad :=_agcgf .GetFontByName (keyName );return _cebad ;};func (_gec *PdfReader )newPdfAnnotationStampFromDict (_fec *_fg .PdfObjectDictionary )(*PdfAnnotationStamp ,error ){_bcgb :=PdfAnnotationStamp {};
|
||
_bbc ,_cbed :=_gec .newPdfAnnotationMarkupFromDict (_fec );if _cbed !=nil {return nil ,_cbed ;};_bcgb .PdfAnnotationMarkup =_bbc ;_bcgb .Name =_fec .Get ("\u004e\u0061\u006d\u0065");return &_bcgb ,nil ;};
|
||
|
||
// Evaluate runs the function on the passed in slice and returns the results.
|
||
func (_efea *PdfFunctionType0 )Evaluate (x []float64 )([]float64 ,error ){if len (x )!=_efea .NumInputs {_aa .Log .Error ("\u004eu\u006d\u0062e\u0072\u0020\u006f\u0066 \u0069\u006e\u0070u\u0074\u0073\u0020\u006e\u006f\u0074\u0020\u006d\u0061tc\u0068\u0069\u006eg\u0020\u0077h\u0061\u0074\u0020\u0069\u0073\u0020n\u0065\u0065d\u0065\u0064");
|
||
return nil ,_ce .New ("\u0072\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b\u0020e\u0072\u0072\u006f\u0072");};if _efea ._fccae ==nil {_fcgac :=_efea .processSamples ();if _fcgac !=nil {return nil ,_fcgac ;};};_ffceg :=_efea .Encode ;if _ffceg ==nil {_ffceg =[]float64 {};
|
||
for _edgd :=0;_edgd < len (_efea .Size );_edgd ++{_ffceg =append (_ffceg ,0);_ffceg =append (_ffceg ,float64 (_efea .Size [_edgd ]-1));};};_fcagg :=_efea .Decode ;if _fcagg ==nil {_fcagg =_efea .Range ;};_abfbe :=make ([]int ,len (x ));for _ceaae :=0;_ceaae < len (x );
|
||
_ceaae ++{_cced :=x [_ceaae ];_eaca :=_ef .Min (_ef .Max (_cced ,_efea .Domain [2*_ceaae ]),_efea .Domain [2*_ceaae +1]);_bcdae :=_cc .LinearInterpolate (_eaca ,_efea .Domain [2*_ceaae ],_efea .Domain [2*_ceaae +1],_ffceg [2*_ceaae ],_ffceg [2*_ceaae +1]);
|
||
_fgaead :=_ef .Min (_ef .Max (_bcdae ,0),float64 (_efea .Size [_ceaae ]-1));_afeg :=int (_ef .Floor (_fgaead +0.5));if _afeg < 0{_afeg =0;}else if _afeg > _efea .Size [_ceaae ]{_afeg =_efea .Size [_ceaae ]-1;};_abfbe [_ceaae ]=_afeg ;};_ecdbfe :=_abfbe [0];
|
||
for _cgdbe :=1;_cgdbe < _efea .NumInputs ;_cgdbe ++{_bgga :=_abfbe [_cgdbe ];for _fcaa :=0;_fcaa < _cgdbe ;_fcaa ++{_bgga *=_efea .Size [_fcaa ];};_ecdbfe +=_bgga ;};_ecdbfe *=_efea .NumOutputs ;var _bfacg []float64 ;for _adcgcg :=0;_adcgcg < _efea .NumOutputs ;
|
||
_adcgcg ++{_eggcc :=_ecdbfe +_adcgcg ;if _eggcc >=len (_efea ._fccae ){_aa .Log .Debug ("\u0057\u0041\u0052\u004e\u003a \u006e\u006ft\u0020\u0065\u006eo\u0075\u0067\u0068\u0020\u0069\u006ep\u0075\u0074\u0020sa\u006dp\u006c\u0065\u0073\u0020\u0074\u006f\u0020d\u0065\u0074\u0065\u0072\u006d\u0069\u006e\u0065\u0020\u006f\u0075\u0074\u0070\u0075\u0074\u0020\u0076\u0061lu\u0065\u0073\u002e\u0020\u004f\u0075\u0074\u0070\u0075\u0074\u0020\u006d\u0061\u0079\u0020\u0062\u0065\u0020\u0069\u006e\u0063\u006f\u0072\u0072\u0065\u0063\u0074\u002e");
|
||
continue ;};_babd :=_efea ._fccae [_eggcc ];_faff :=_cc .LinearInterpolate (float64 (_babd ),0,_ef .Pow (2,float64 (_efea .BitsPerSample )),_fcagg [2*_adcgcg ],_fcagg [2*_adcgcg +1]);_gdeae :=_ef .Min (_ef .Max (_faff ,_efea .Range [2*_adcgcg ]),_efea .Range [2*_adcgcg +1]);
|
||
_bfacg =append (_bfacg ,_gdeae );};return _bfacg ,nil ;};
|
||
|
||
// Duplicate creates a duplicate page based on the current one and returns it.
|
||
func (_ffgfe *PdfPage )Duplicate ()*PdfPage {_daac :=*_ffgfe ;_daac ._eebge =_fg .MakeDict ();_daac ._aebf =_fg .MakeIndirectObject (_daac ._eebge );_daac ._cceb =*_daac ._eebge ;return &_daac ;};
|
||
|
||
// SetPdfAuthor sets the Author attribute of the output PDF.
|
||
func SetPdfAuthor (author string ){_baacg .Lock ();defer _baacg .Unlock ();_dfeegf =author };
|
||
|
||
// ToPdfObject returns a stream object.
|
||
func (_fafba *XObjectImage )ToPdfObject ()_fg .PdfObject {_fdcff :=_fafba ._eafbc ;_egfa :=_fdcff .PdfObjectDictionary ;if _fafba .Filter !=nil {_egfa =_fafba .Filter .MakeStreamDict ();_fdcff .PdfObjectDictionary =_egfa ;};_egfa .Set ("\u0054\u0079\u0070\u0065",_fg .MakeName ("\u0058O\u0062\u006a\u0065\u0063\u0074"));
|
||
_egfa .Set ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u0049\u006d\u0061g\u0065"));_egfa .Set ("\u0057\u0069\u0064t\u0068",_fg .MakeInteger (*(_fafba .Width )));_egfa .Set ("\u0048\u0065\u0069\u0067\u0068\u0074",_fg .MakeInteger (*(_fafba .Height )));
|
||
if _fafba .BitsPerComponent !=nil {_egfa .Set ("\u0042\u0069t\u0073\u0050\u0065r\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074",_fg .MakeInteger (*(_fafba .BitsPerComponent )));};if _fafba .ColorSpace !=nil {_egfa .SetIfNotNil ("\u0043\u006f\u006c\u006f\u0072\u0053\u0070\u0061\u0063\u0065",_fafba .ColorSpace .ToPdfObject ());
|
||
};_egfa .SetIfNotNil ("\u0049\u006e\u0074\u0065\u006e\u0074",_fafba .Intent );_egfa .SetIfNotNil ("\u0049m\u0061\u0067\u0065\u004d\u0061\u0073k",_fafba .ImageMask );_egfa .SetIfNotNil ("\u004d\u0061\u0073\u006b",_fafba .Mask );_bddbd :=_egfa .Get ("\u0044\u0065\u0063\u006f\u0064\u0065")!=nil ;
|
||
if _fafba .Decode ==nil &&_bddbd {_egfa .Remove ("\u0044\u0065\u0063\u006f\u0064\u0065");}else if _fafba .Decode !=nil {_egfa .Set ("\u0044\u0065\u0063\u006f\u0064\u0065",_fafba .Decode );};_egfa .SetIfNotNil ("I\u006e\u0074\u0065\u0072\u0070\u006f\u006c\u0061\u0074\u0065",_fafba .Interpolate );
|
||
_egfa .SetIfNotNil ("\u0041\u006c\u0074e\u0072\u006e\u0061\u0074\u0069\u0076\u0065\u0073",_fafba .Alternatives );_egfa .SetIfNotNil ("\u0053\u004d\u0061s\u006b",_fafba .SMask );_egfa .SetIfNotNil ("S\u004d\u0061\u0073\u006b\u0049\u006e\u0044\u0061\u0074\u0061",_fafba .SMaskInData );
|
||
_egfa .SetIfNotNil ("\u004d\u0061\u0074t\u0065",_fafba .Matte );_egfa .SetIfNotNil ("\u004e\u0061\u006d\u0065",_fafba .Name );_egfa .SetIfNotNil ("\u0053\u0074\u0072u\u0063\u0074\u0050\u0061\u0072\u0065\u006e\u0074",_fafba .StructParent );_egfa .SetIfNotNil ("\u0049\u0044",_fafba .ID );
|
||
_egfa .SetIfNotNil ("\u004f\u0050\u0049",_fafba .OPI );_egfa .SetIfNotNil ("\u004d\u0065\u0074\u0061\u0064\u0061\u0074\u0061",_fafba .Metadata );_egfa .SetIfNotNil ("\u004f\u0043",_fafba .OC );_egfa .Set ("\u004c\u0065\u006e\u0067\u0074\u0068",_fg .MakeInteger (int64 (len (_fafba .Stream ))));
|
||
_fdcff .Stream =_fafba .Stream ;return _fdcff ;};func _bfab (_baaa _fg .PdfObject ,_cggdaa bool )(*PdfFont ,error ){_fbcc ,_gagcd ,_fcagd :=_gafdf (_baaa );if _fbcc !=nil {_gace (_fbcc );};if _fcagd !=nil {if _fcagd ==ErrType1CFontNotSupported {_dcce ,_bceg :=_agccg (_fbcc ,_gagcd ,nil );
|
||
if _bceg !=nil {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0057h\u0069\u006c\u0065 l\u006f\u0061\u0064\u0069\u006e\u0067 \u0073\u0069\u006d\u0070\u006c\u0065\u0020\u0066\u006f\u006e\u0074\u003a\u0020\u0066\u006fn\u0074\u003d\u0025\u0073\u0020\u0065\u0072\u0072=\u0025\u0076",_gagcd ,_bceg );
|
||
return nil ,_fcagd ;};return &PdfFont {_gcaeff :_dcce },_fcagd ;};return nil ,_fcagd ;};_abeea :=&PdfFont {};switch _gagcd ._ggcfc {case "\u0054\u0079\u0070e\u0030":if !_cggdaa {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052:\u0020\u004c\u006f\u0061\u0064\u0069\u006e\u0067\u0020\u0074\u0079\u0070\u00650\u0020\u006e\u006f\u0074\u0020\u0061\u006c\u006c\u006f\u0077\u0065\u0064\u002e\u0020\u0066\u006f\u006e\u0074\u003d\u0025\u0073",_gagcd );
|
||
return nil ,_ce .New ("\u0063\u0079\u0063\u006cic\u0061\u006c\u0020\u0074\u0079\u0070\u0065\u0030\u0020\u006c\u006f\u0061\u0064\u0069n\u0067");};_fdcd ,_bbcf :=_afdf (_fbcc ,_gagcd );if _bbcf !=nil {_aa .Log .Debug ("E\u0052\u0052\u004f\u0052\u003a\u0020\u0057\u0068\u0069l\u0065\u0020\u006c\u006f\u0061\u0064\u0069ng\u0020\u0054\u0079\u0070e\u0030\u0020\u0066\u006f\u006e\u0074\u002e\u0020\u0066on\u0074\u003d%\u0073\u0020\u0065\u0072\u0072\u003d\u0025\u0076",_gagcd ,_bbcf );
|
||
return nil ,_bbcf ;};_abeea ._gcaeff =_fdcd ;case "\u0054\u0079\u0070e\u0031","\u004dM\u0054\u0079\u0070\u0065\u0031","\u0054\u0072\u0075\u0065\u0054\u0079\u0070\u0065":var _bcab *pdfFontSimple ;_accdc ,_bgac :=_eed .NewStdFontByName (_eed .StdFontName (_gagcd ._aefg ));
|
||
if _bgac {_bcfc :=_dfebg (_accdc );_abeea ._gcaeff =&_bcfc ;_ceaf :=_fg .TraceToDirectObject (_bcfc .ToPdfObject ());_ddad ,_cbbe ,_bebf :=_gafdf (_ceaf );if _bebf !=nil {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0042\u0061\u0064\u0020\u0053\u0074a\u006e\u0064\u0061\u0072\u0064\u00314\u000a\u0009\u0066\u006f\u006e\u0074\u003d\u0025\u0073\u000a\u0009\u0073\u0074d\u003d\u0025\u002b\u0076",_gagcd ,_bcfc );
|
||
return nil ,_bebf ;};for _ ,_bcff :=range _fbcc .Keys (){_ddad .Set (_bcff ,_fbcc .Get (_bcff ));};_bcab ,_bebf =_agccg (_ddad ,_cbbe ,_bcfc ._fcad );if _bebf !=nil {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0042\u0061\u0064\u0020\u0053\u0074a\u006e\u0064\u0061\u0072\u0064\u00314\u000a\u0009\u0066\u006f\u006e\u0074\u003d\u0025\u0073\u000a\u0009\u0073\u0074d\u003d\u0025\u002b\u0076",_gagcd ,_bcfc );
|
||
return nil ,_bebf ;};_bcab ._fcgbd =_bcfc ._fcgbd ;_bcab ._dacg =_bcfc ._dacg ;if _bcab ._fdfca ==nil {_bcab ._fdfca =_bcfc ._fdfca ;};}else {_bcab ,_fcagd =_agccg (_fbcc ,_gagcd ,nil );if _fcagd !=nil {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0057h\u0069\u006c\u0065 l\u006f\u0061\u0064\u0069\u006e\u0067 \u0073\u0069\u006d\u0070\u006c\u0065\u0020\u0066\u006f\u006e\u0074\u003a\u0020\u0066\u006fn\u0074\u003d\u0025\u0073\u0020\u0065\u0072\u0072=\u0025\u0076",_gagcd ,_fcagd );
|
||
return nil ,_fcagd ;};};_fcagd =_bcab .addEncoding ();if _fcagd !=nil {return nil ,_fcagd ;};if _bgac {_bcab .updateStandard14Font ();};if _bgac &&_bcab ._bdgda ==nil &&_bcab ._fcad ==nil {_aa .Log .Error ("\u0073\u0069\u006d\u0070\u006c\u0065\u0066\u006f\u006e\u0074\u003d\u0025\u0073",_bcab );
|
||
_aa .Log .Error ("\u0066n\u0074\u003d\u0025\u002b\u0076",_accdc );};if len (_bcab ._fcgbd )==0{_aa .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a \u004e\u006f\u0020\u0077\u0069d\u0074h\u0073.\u0020\u0066\u006f\u006e\u0074\u003d\u0025s",_bcab );};_abeea ._gcaeff =_bcab ;
|
||
case "\u0054\u0079\u0070e\u0033":_aaad ,_aded :=_cebge (_fbcc ,_gagcd );if _aded !=nil {_aa .Log .Debug ("E\u0052\u0052\u004f\u0052\u003a\u0020W\u0068\u0069\u006c\u0065\u0020\u006co\u0061\u0064\u0069\u006e\u0067\u0020\u0074y\u0070\u0065\u0033\u0020\u0066\u006f\u006e\u0074\u003a\u0020%\u0076",_aded );
|
||
return nil ,_aded ;};_abeea ._gcaeff =_aaad ;case "\u0043\u0049\u0044F\u006f\u006e\u0074\u0054\u0079\u0070\u0065\u0030":_abad ,_caag :=_ebff (_fbcc ,_gagcd );if _caag !=nil {_aa .Log .Debug ("\u0045R\u0052\u004fR\u003a\u0020\u0057\u0068i\u006c\u0065\u0020l\u006f\u0061\u0064\u0069\u006e\u0067\u0020\u0063\u0069d \u0066\u006f\u006et\u0020\u0074y\u0070\u0065\u0030\u0020\u0066\u006fn\u0074\u003a \u0025\u0076",_caag );
|
||
return nil ,_caag ;};_abeea ._gcaeff =_abad ;case "\u0043\u0049\u0044F\u006f\u006e\u0074\u0054\u0079\u0070\u0065\u0032":_caec ,_edacc :=_ffcb (_fbcc ,_gagcd );if _edacc !=nil {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a \u0057\u0068\u0069l\u0065\u0020\u006co\u0061\u0064\u0069\u006e\u0067\u0020\u0063\u0069\u0064\u0020f\u006f\u006e\u0074\u0020\u0074yp\u0065\u0032\u0020\u0066\u006f\u006e\u0074\u002e\u0020\u0066\u006f\u006e\u0074\u003d\u0025\u0073\u0020\u0065\u0072\u0072\u003d\u0025\u0076",_gagcd ,_edacc );
|
||
return nil ,_edacc ;};_abeea ._gcaeff =_caec ;default:_aa .Log .Debug ("\u0045\u0052R\u004f\u0052\u003a\u0020U\u006e\u0073u\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u0020f\u006f\u006e\u0074\u0020\u0074\u0079\u0070\u0065\u003a\u0020\u0066\u006fn\u0074\u003d\u0025\u0073",_gagcd );
|
||
return nil ,_d .Errorf ("\u0075\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065d\u0020\u0066\u006f\u006e\u0074\u0020\u0074y\u0070\u0065\u003a\u0020\u0066\u006f\u006e\u0074\u003d\u0025\u0073",_gagcd );};return _abeea ,nil ;};func (_ffce fontCommon )isCIDFont ()bool {if _ffce ._ggcfc ==""{_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052:\u0020\u0069\u0073\u0043\u0049\u0044\u0046\u006f\u006e\u0074\u002e\u0020\u0063o\u006e\u0074\u0065\u0078\u0074\u0020\u0069\u0073\u0020\u006e\u0069\u006c\u002e\u0020\u0066\u006f\u006e\u0074\u003d\u0025\u0073",_ffce );
|
||
};_effd :=false ;switch _ffce ._ggcfc {case "\u0054\u0079\u0070e\u0030","\u0043\u0049\u0044F\u006f\u006e\u0074\u0054\u0079\u0070\u0065\u0030","\u0043\u0049\u0044F\u006f\u006e\u0074\u0054\u0079\u0070\u0065\u0032":_effd =true ;};_aa .Log .Trace ("i\u0073\u0043\u0049\u0044\u0046\u006fn\u0074\u003a\u0020\u0069\u0073\u0043\u0049\u0044\u003d%\u0074\u0020\u0066o\u006et\u003d\u0025\u0073",_effd ,_ffce );
|
||
return _effd ;};func (_ffbba PdfFont )actualFont ()pdfFont {if _ffbba ._gcaeff ==nil {_aa .Log .Debug ("\u0045\u0052\u0052O\u0052\u003a\u0020\u0061\u0063\u0074\u0075\u0061\u006c\u0046\u006f\u006e\u0074\u002e\u0020\u0063\u006f\u006e\u0074\u0065\u0078\u0074\u0020\u0069\u0073\u0020\u006e\u0069\u006c.\u0020\u0066\u006f\u006e\u0074\u003d\u0025\u0073",_ffbba );
|
||
};return _ffbba ._gcaeff ;};func (_dfffa *PdfReader )newPdfPageFromDict (_dcgc *_fg .PdfObjectDictionary )(*PdfPage ,error ){_gcbbf :=NewPdfPage ();_gcbbf ._eebge =_dcgc ;_gcbbf ._cceb =*_dcgc ;_bgcfa :=*_dcgc ;_dbecf ,_daeg :=_bgcfa .Get ("\u0054\u0079\u0070\u0065").(*_fg .PdfObjectName );
|
||
if !_daeg {return nil ,_ce .New ("\u006d\u0069ss\u0069\u006e\u0067/\u0069\u006e\u0076\u0061lid\u0020Pa\u0067\u0065\u0020\u0064\u0069\u0063\u0074io\u006e\u0061\u0072\u0079\u0020\u0054\u0079p\u0065");};if *_dbecf !="\u0050\u0061\u0067\u0065"{return nil ,_ce .New ("\u0070\u0061\u0067\u0065 \u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061\u0072\u0079 \u0054y\u0070\u0065\u0020\u0021\u003d\u0020\u0050a\u0067\u0065");
|
||
};if _dgddc :=_bgcfa .Get ("\u0050\u0061\u0072\u0065\u006e\u0074");_dgddc !=nil {_gcbbf .Parent =_dgddc ;};if _adfeb :=_bgcfa .Get ("\u004c\u0061\u0073t\u004d\u006f\u0064\u0069\u0066\u0069\u0065\u0064");_adfeb !=nil {_faccd ,_fbgc :=_fg .GetString (_adfeb );
|
||
if !_fbgc {return nil ,_ce .New ("\u0070\u0061\u0067\u0065\u0020\u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061\u0072\u0079\u0020\u004c\u0061\u0073\u0074\u004d\u006f\u0064\u0069f\u0069\u0065\u0064\u0020\u0021=\u0020\u0073t\u0072\u0069\u006e\u0067");};
|
||
_bddae ,_cfeag :=NewPdfDate (_faccd .Str ());if _cfeag !=nil {return nil ,_cfeag ;};_gcbbf .LastModified =&_bddae ;};if _egafe :=_bgcfa .Get ("\u0052e\u0073\u006f\u0075\u0072\u0063\u0065s");_egafe !=nil &&!_fg .IsNullObject (_egafe ){_abcgc ,_ecdg :=_fg .GetDict (_egafe );
|
||
if !_ecdg {return nil ,_d .Errorf ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0072\u0065\u0073\u006f\u0075\u0072\u0063e\u0020d\u0069\u0063\u0074\u0069\u006f\u006e\u0061\u0072\u0079\u0020\u0028\u0025\u0054\u0029",_egafe );};var _cggce error ;_gcbbf .Resources ,_cggce =NewPdfPageResourcesFromDict (_abcgc );
|
||
if _cggce !=nil {return nil ,_cggce ;};}else {_efcdd ,_gbcb :=_gcbbf .getParentResources ();if _gbcb !=nil {return nil ,_gbcb ;};if _efcdd ==nil {_efcdd =NewPdfPageResources ();};_gcbbf .Resources =_efcdd ;};if _cecga :=_bgcfa .Get ("\u004d\u0065\u0064\u0069\u0061\u0042\u006f\u0078");
|
||
_cecga !=nil {_babbc ,_fdbff :=_fg .GetArray (_cecga );if !_fdbff {return nil ,_ce .New ("\u0070\u0061\u0067\u0065\u0020\u004d\u0065\u0064\u0069\u0061\u0042o\u0078\u0020\u006e\u006f\u0074\u0020\u0061\u006e\u0020\u0061r\u0072\u0061\u0079");};var _dbab error ;
|
||
_gcbbf .MediaBox ,_dbab =NewPdfRectangle (*_babbc );if _dbab !=nil {return nil ,_dbab ;};};if _eefe :=_bgcfa .Get ("\u0043r\u006f\u0070\u0042\u006f\u0078");_eefe !=nil {_feeegb ,_dcfcc :=_fg .GetArray (_eefe );if !_dcfcc {return nil ,_ce .New ("\u0070a\u0067\u0065\u0020\u0043r\u006f\u0070\u0042\u006f\u0078 \u006eo\u0074 \u0061\u006e\u0020\u0061\u0072\u0072\u0061y");
|
||
};var _ffdfb error ;_gcbbf .CropBox ,_ffdfb =NewPdfRectangle (*_feeegb );if _ffdfb !=nil {return nil ,_ffdfb ;};};if _gefa :=_bgcfa .Get ("\u0042\u006c\u0065\u0065\u0064\u0042\u006f\u0078");_gefa !=nil {_dfgae ,_gcaeg :=_fg .GetArray (_gefa );if !_gcaeg {return nil ,_ce .New ("\u0070\u0061\u0067\u0065\u0020\u0042\u006c\u0065\u0065\u0064\u0042o\u0078\u0020\u006e\u006f\u0074\u0020\u0061\u006e\u0020\u0061r\u0072\u0061\u0079");
|
||
};var _bdbfc error ;_gcbbf .BleedBox ,_bdbfc =NewPdfRectangle (*_dfgae );if _bdbfc !=nil {return nil ,_bdbfc ;};};if _bdff :=_bgcfa .Get ("\u0054r\u0069\u006d\u0042\u006f\u0078");_bdff !=nil {_abdaf ,_cfdg :=_fg .GetArray (_bdff );if !_cfdg {return nil ,_ce .New ("\u0070a\u0067\u0065\u0020\u0054r\u0069\u006d\u0042\u006f\u0078 \u006eo\u0074 \u0061\u006e\u0020\u0061\u0072\u0072\u0061y");
|
||
};var _gbgef error ;_gcbbf .TrimBox ,_gbgef =NewPdfRectangle (*_abdaf );if _gbgef !=nil {return nil ,_gbgef ;};};if _bgdga :=_bgcfa .Get ("\u0041\u0072\u0074\u0042\u006f\u0078");_bgdga !=nil {_efdg ,_gddgg :=_fg .GetArray (_bgdga );if !_gddgg {return nil ,_ce .New ("\u0070a\u0067\u0065\u0020\u0041\u0072\u0074\u0042\u006f\u0078\u0020\u006eo\u0074\u0020\u0061\u006e\u0020\u0061\u0072\u0072\u0061\u0079");
|
||
};var _fbdgd error ;_gcbbf .ArtBox ,_fbdgd =NewPdfRectangle (*_efdg );if _fbdgd !=nil {return nil ,_fbdgd ;};};if _badee :=_bgcfa .Get ("\u0042\u006f\u0078C\u006f\u006c\u006f\u0072\u0049\u006e\u0066\u006f");_badee !=nil {_gcbbf .BoxColorInfo =_badee ;};
|
||
if _dbag :=_bgcfa .Get ("\u0043\u006f\u006e\u0074\u0065\u006e\u0074\u0073");_dbag !=nil {_gcbbf .Contents =_dbag ;};if _befge :=_bgcfa .Get ("\u0052\u006f\u0074\u0061\u0074\u0065");_befge !=nil {_gfacc ,_eccbd :=_fg .GetNumberAsInt64 (_befge );if _eccbd !=nil {return nil ,_ce .New ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0050\u0061\u0067e\u0020\u0052\u006f\u0074\u0061\u0074\u0065\u0020\u006f\u0062j\u0065\u0063\u0074");
|
||
};_gcbbf .Rotate =&_gfacc ;};if _dgdgab :=_bgcfa .Get ("\u0047\u0072\u006fu\u0070");_dgdgab !=nil {_gcbbf .Group =_dgdgab ;};if _bggae :=_bgcfa .Get ("\u0054\u0068\u0075m\u0062");_bggae !=nil {_gcbbf .Thumb =_bggae ;};if _eeebcb :=_bgcfa .Get ("\u0042");
|
||
_eeebcb !=nil {_gcbbf .B =_eeebcb ;};if _fcac :=_bgcfa .Get ("\u0044\u0075\u0072");_fcac !=nil {_gcbbf .Dur =_fcac ;};if _edbaa :=_bgcfa .Get ("\u0054\u0072\u0061n\u0073");_edbaa !=nil {_gcbbf .Trans =_edbaa ;};if _gbag :=_bgcfa .Get ("\u0041\u0041");_gbag !=nil {_gcbbf .AA =_gbag ;
|
||
};if _debde :=_bgcfa .Get ("\u004d\u0065\u0074\u0061\u0064\u0061\u0074\u0061");_debde !=nil {_gcbbf .Metadata =_debde ;};if _eagcd :=_bgcfa .Get ("\u0050i\u0065\u0063\u0065\u0049\u006e\u0066o");_eagcd !=nil {_gcbbf .PieceInfo =_eagcd ;};if _aeac :=_bgcfa .Get ("\u0053\u0074\u0072\u0075\u0063\u0074\u0050\u0061\u0072\u0065\u006e\u0074\u0073");
|
||
_aeac !=nil {_gcbbf .StructParents =_aeac ;};if _bcgdg :=_bgcfa .Get ("\u0049\u0044");_bcgdg !=nil {_gcbbf .ID =_bcgdg ;};if _gaefb :=_bgcfa .Get ("\u0050\u005a");_gaefb !=nil {_gcbbf .PZ =_gaefb ;};if _dcgb :=_bgcfa .Get ("\u0053\u0065\u0070\u0061\u0072\u0061\u0074\u0069\u006fn\u0049\u006e\u0066\u006f");
|
||
_dcgb !=nil {_gcbbf .SeparationInfo =_dcgb ;};if _abega :=_bgcfa .Get ("\u0054\u0061\u0062\u0073");_abega !=nil {_gcbbf .Tabs =_abega ;};if _dfbee :=_bgcfa .Get ("T\u0065m\u0070\u006c\u0061\u0074\u0065\u0049\u006e\u0073t\u0061\u006e\u0074\u0069at\u0065\u0064");
|
||
_dfbee !=nil {_gcbbf .TemplateInstantiated =_dfbee ;};if _cccad :=_bgcfa .Get ("\u0050r\u0065\u0073\u0053\u0074\u0065\u0070s");_cccad !=nil {_gcbbf .PresSteps =_cccad ;};if _dgcf :=_bgcfa .Get ("\u0055\u0073\u0065\u0072\u0055\u006e\u0069\u0074");_dgcf !=nil {_gcbbf .UserUnit =_dgcf ;
|
||
};if _fcdg :=_bgcfa .Get ("\u0056\u0050");_fcdg !=nil {_gcbbf .VP =_fcdg ;};if _fabge :=_bgcfa .Get ("\u0041\u006e\u006e\u006f\u0074\u0073");_fabge !=nil {_gcbbf .Annots =_fabge ;};_gcbbf ._dedef =_dfffa ;return _gcbbf ,nil ;};
|
||
|
||
// GetCapHeight returns the CapHeight of the font `descriptor`.
|
||
func (_gggcd *PdfFontDescriptor )GetCapHeight ()(float64 ,error ){return _fg .GetNumberAsFloat (_gggcd .CapHeight );};type pdfCIDFontType0 struct{fontCommon ;_deadf *_fg .PdfIndirectObject ;_bcbg _dg .TextEncoder ;
|
||
|
||
// Table 117 – Entries in a CIDFont dictionary (page 269)
|
||
// (Required) Dictionary that defines the character collection of the CIDFont.
|
||
// See Table 116.
|
||
CIDSystemInfo *_fg .PdfObjectDictionary ;
|
||
|
||
// Glyph metrics fields (optional).
|
||
DW _fg .PdfObject ;W _fg .PdfObject ;DW2 _fg .PdfObject ;W2 _fg .PdfObject ;_fceed map[_dg .CharCode ]float64 ;_cgda float64 ;};
|
||
|
||
// ReaderOpts defines options for creating PdfReader instances.
|
||
type ReaderOpts struct{
|
||
|
||
// Password password of the PDF file encryption.
|
||
// Default: empty ("").
|
||
Password string ;
|
||
|
||
// LazyLoad set if the PDF file would be loaded using lazy-loading mode.
|
||
// Default: true.
|
||
LazyLoad bool ;
|
||
|
||
// ComplianceMode set if parsed PDF file should contain meta information for the verifiers of the compliance standards like PDF/A.
|
||
ComplianceMode bool ;};
|
||
|
||
// ImageHandler interface implements common image loading and processing tasks.
|
||
// Implementing as an interface allows for the possibility to use non-standard libraries for faster
|
||
// loading and processing of images.
|
||
type ImageHandler interface{
|
||
|
||
// Read any image type and load into a new Image object.
|
||
Read (_aegfd _ff .Reader )(*Image ,error );
|
||
|
||
// NewImageFromGoImage loads a NRGBA32 unidoc Image from a standard Go image structure.
|
||
NewImageFromGoImage (_abdc _ac .Image )(*Image ,error );
|
||
|
||
// NewGrayImageFromGoImage loads a grayscale unidoc Image from a standard Go image structure.
|
||
NewGrayImageFromGoImage (_fagae _ac .Image )(*Image ,error );
|
||
|
||
// Compress an image.
|
||
Compress (_gfab *Image ,_ecfag int64 )(*Image ,error );};
|
||
|
||
// GetContainingPdfObject returns the container of the resources object (indirect object).
|
||
func (_bfeff *PdfPageResources )GetContainingPdfObject ()_fg .PdfObject {return _bfeff ._cgce };func _agcbc (_fgge _fg .PdfObject ,_bdebd *PdfReader )(*OutlineDest ,error ){_efaf ,_aacda :=_fg .GetArray (_fgge );if !_aacda {return nil ,_ce .New ("\u006f\u0075\u0074\u006c\u0069\u006e\u0065 \u0064\u0065\u0073t\u0069\u006e\u0061\u0074i\u006f\u006e\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u0020\u006d\u0075\u0073\u0074\u0020\u0062\u0065\u0020\u0061\u006e\u0020\u0061\u0072\u0072\u0061\u0079");
|
||
};_cafbf :=_efaf .Len ();if _cafbf < 2{return nil ,_d .Errorf ("\u0069n\u0076\u0061l\u0069\u0064\u0020\u006fu\u0074\u006c\u0069n\u0065\u0020\u0064\u0065\u0073\u0074\u0069\u006e\u0061ti\u006f\u006e\u0020a\u0072\u0072a\u0079\u0020\u006c\u0065\u006e\u0067t\u0068\u003a \u0025\u0064",_cafbf );
|
||
};_gdcab :=&OutlineDest {Mode :"\u0046\u0069\u0074"};_cdab :=_efaf .Get (0);if _bfge ,_ecdfe :=_fg .GetIndirect (_cdab );_ecdfe {if _ ,_aegag ,_dgagbb :=_bdebd .PageFromIndirectObject (_bfge );_dgagbb ==nil {_gdcab .Page =int64 (_aegag -1);}else {_aa .Log .Debug ("\u0057\u0041\u0052\u004e\u003a\u0020\u0063o\u0075\u006c\u0064 \u006e\u006f\u0074\u0020g\u0065\u0074\u0020\u0070\u0061\u0067\u0065\u0020\u0069\u006e\u0064\u0065\u0078\u0020\u0066\u006f\u0072\u0020\u0070\u0061\u0067\u0065\u0020\u0025\u002b\u0076",_bfge );
|
||
};_gdcab .PageObj =_bfge ;}else if _baee ,_adgcd :=_fg .GetIntVal (_cdab );_adgcd {if _baee >=0&&_baee < len (_bdebd .PageList ){_gdcab .PageObj =_bdebd .PageList [_baee ].GetPageAsIndirectObject ();}else {_aa .Log .Debug ("\u0057\u0041R\u004e\u003a\u0020\u0063\u006f\u0075\u006c\u0064\u0020\u006e\u006f\u0074\u0020\u0067\u0065\u0074\u0020\u0070\u0061\u0067\u0065\u0020\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0065\u0072\u0020\u0066\u006f\u0072\u0020\u0070\u0061\u0067\u0065\u0020\u0025\u0064",_baee );
|
||
};_gdcab .Page =int64 (_baee );}else {return nil ,_d .Errorf ("\u0069\u006eva\u006c\u0069\u0064 \u006f\u0075\u0074\u006cine\u0020de\u0073\u0074\u0069\u006e\u0061\u0074\u0069on\u0020\u0070\u0061\u0067\u0065\u003a\u0020%\u0054",_cdab );};_gbgde ,_aacda :=_fg .GetNameVal (_efaf .Get (1));
|
||
if !_aacda {_aa .Log .Debug ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u006f\u0075\u0074\u006c\u0069\u006e\u0065\u0020\u0064\u0065s\u0074\u0069\u006e\u0061\u0074\u0069\u006fn\u0020\u006d\u0061\u0067\u006e\u0069\u0066\u0069\u0063\u0061\u0074i\u006f\u006e\u0020\u006d\u006f\u0064\u0065\u003a\u0020\u0025\u0076",_efaf .Get (1));
|
||
return _gdcab ,nil ;};switch _gbgde {case "\u0046\u0069\u0074","\u0046\u0069\u0074\u0042":case "\u0046\u0069\u0074\u0048","\u0046\u0069\u0074B\u0048":if _cafbf > 2{_gdcab .Y ,_ =_fg .GetNumberAsFloat (_fg .TraceToDirectObject (_efaf .Get (2)));};case "\u0046\u0069\u0074\u0056","\u0046\u0069\u0074B\u0056":if _cafbf > 2{_gdcab .X ,_ =_fg .GetNumberAsFloat (_fg .TraceToDirectObject (_efaf .Get (2)));
|
||
};case "\u0058\u0059\u005a":if _cafbf > 4{_gdcab .X ,_ =_fg .GetNumberAsFloat (_fg .TraceToDirectObject (_efaf .Get (2)));_gdcab .Y ,_ =_fg .GetNumberAsFloat (_fg .TraceToDirectObject (_efaf .Get (3)));_gdcab .Zoom ,_ =_fg .GetNumberAsFloat (_fg .TraceToDirectObject (_efaf .Get (4)));
|
||
};default:_gbgde ="\u0046\u0069\u0074";};_gdcab .Mode =_gbgde ;return _gdcab ,nil ;};
|
||
|
||
// NewPdfPage returns a new PDF page.
|
||
func NewPdfPage ()*PdfPage {_dabfg :=PdfPage {};_dabfg ._eebge =_fg .MakeDict ();_dabfg .Resources =NewPdfPageResources ();_gbddd :=_fg .PdfIndirectObject {};_gbddd .PdfObject =_dabfg ._eebge ;_dabfg ._aebf =&_gbddd ;_dabfg ._cceb =*_dabfg ._eebge ;return &_dabfg ;
|
||
};func _ffcb (_cafa *_fg .PdfObjectDictionary ,_aafee *fontCommon )(*pdfCIDFontType2 ,error ){if _aafee ._ggcfc !="\u0043\u0049\u0044F\u006f\u006e\u0074\u0054\u0079\u0070\u0065\u0032"{_aa .Log .Debug ("\u0045R\u0052\u004fR\u003a\u0020\u0046\u006fn\u0074\u0020\u0053u\u0062\u0054\u0079\u0070\u0065\u0020\u0021\u003d\u0020CI\u0044\u0046\u006fn\u0074\u0054y\u0070\u0065\u0032\u002e\u0020\u0066o\u006e\u0074=\u0025\u0073",_aafee );
|
||
return nil ,_fg .ErrRangeError ;};_afgg :=_ffaa (_aafee );_bbdgb ,_ddbdc :=_fg .GetDict (_cafa .Get ("\u0043\u0049\u0044\u0053\u0079\u0073\u0074\u0065\u006d\u0049\u006e\u0066\u006f"));if !_ddbdc {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0043I\u0044\u0053\u0079st\u0065\u006d\u0049\u006e\u0066\u006f \u0028\u0052\u0065\u0071\u0075\u0069\u0072\u0065\u0064\u0029\u0020\u006d\u0069\u0073\u0073i\u006e\u0067\u002e\u0020\u0066\u006f\u006e\u0074=\u0025\u0073",_aafee );
|
||
return nil ,ErrRequiredAttributeMissing ;};_afgg .CIDSystemInfo =_bbdgb ;_afgg .DW =_cafa .Get ("\u0044\u0057");_afgg .W =_cafa .Get ("\u0057");_afgg .DW2 =_cafa .Get ("\u0044\u0057\u0032");_afgg .W2 =_cafa .Get ("\u0057\u0032");_afgg .CIDToGIDMap =_cafa .Get ("C\u0049\u0044\u0054\u006f\u0047\u0049\u0044\u004d\u0061\u0070");
|
||
_afgg ._gagd =1000.0;if _dcab ,_ffadb :=_fg .GetNumberAsFloat (_afgg .DW );_ffadb ==nil {_afgg ._gagd =_dcab ;};_edaff ,_gfde :=_bcabg (_afgg .W );if _gfde !=nil {return nil ,_gfde ;};if _edaff ==nil {_edaff =map[_dg .CharCode ]float64 {};};_afgg ._dbgce =_edaff ;
|
||
return _afgg ,nil ;};func _fgbd (_caac _fg .PdfObject )(*PdfColorspaceSpecialSeparation ,error ){_fgcfg :=NewPdfColorspaceSpecialSeparation ();if _edba ,_gcge :=_caac .(*_fg .PdfIndirectObject );_gcge {_fgcfg ._adacb =_edba ;};_caac =_fg .TraceToDirectObject (_caac );
|
||
_bddeg ,_bffg :=_caac .(*_fg .PdfObjectArray );if !_bffg {return nil ,_d .Errorf ("\u0073\u0065p\u0061\u0072\u0061\u0074\u0069\u006f\u006e\u0020\u0043\u0053\u003a\u0020\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u006f\u0062je\u0063\u0074");};if _bddeg .Len ()!=4{return nil ,_d .Errorf ("\u0073\u0065p\u0061\u0072\u0061\u0074i\u006f\u006e \u0043\u0053\u003a\u0020\u0049\u006e\u0063\u006fr\u0072\u0065\u0063\u0074\u0020\u0061\u0072\u0072\u0061\u0079\u0020\u006ce\u006e\u0067\u0074\u0068");
|
||
};_caac =_bddeg .Get (0);_ecbab ,_bffg :=_caac .(*_fg .PdfObjectName );if !_bffg {return nil ,_d .Errorf ("\u0073\u0065\u0070ar\u0061\u0074\u0069\u006f\u006e\u0020\u0043\u0053\u003a \u0069n\u0076a\u006ci\u0064\u0020\u0066\u0061\u006d\u0069\u006c\u0079\u0020\u006e\u0061\u006d\u0065");
|
||
};if *_ecbab !="\u0053\u0065\u0070\u0061\u0072\u0061\u0074\u0069\u006f\u006e"{return nil ,_d .Errorf ("\u0073\u0065\u0070\u0061\u0072\u0061\u0074\u0069\u006f\u006e\u0020\u0043\u0053\u003a\u0020w\u0072o\u006e\u0067\u0020\u0066\u0061\u006d\u0069\u006c\u0079\u0020\u006e\u0061\u006d\u0065");
|
||
};_caac =_bddeg .Get (1);_ecbab ,_bffg =_caac .(*_fg .PdfObjectName );if !_bffg {return nil ,_d .Errorf ("\u0073\u0065pa\u0072\u0061\u0074i\u006f\u006e\u0020\u0043S: \u0049nv\u0061\u006c\u0069\u0064\u0020\u0063\u006flo\u0072\u0061\u006e\u0074\u0020\u006e\u0061m\u0065");
|
||
};_fgcfg .ColorantName =_ecbab ;_caac =_bddeg .Get (2);_cgfd ,_efcf :=NewPdfColorspaceFromPdfObject (_caac );if _efcf !=nil {return nil ,_efcf ;};_fgcfg .AlternateSpace =_cgfd ;_dfdd ,_efcf :=_defgb (_bddeg .Get (3));if _efcf !=nil {return nil ,_efcf ;
|
||
};_fgcfg .TintTransform =_dfdd ;return _fgcfg ,nil ;};
|
||
|
||
// ToInteger convert to an integer format.
|
||
func (_acab *PdfColorDeviceRGB )ToInteger (bits int )[3]uint32 {_gbae :=_ef .Pow (2,float64 (bits ))-1;return [3]uint32 {uint32 (_gbae *_acab .R ()),uint32 (_gbae *_acab .G ()),uint32 (_gbae *_acab .B ())};};
|
||
|
||
// GetCatalogMarkInfo gets catalog MarkInfo object.
|
||
func (_cedef *PdfReader )GetCatalogMarkInfo ()(_fg .PdfObject ,bool ){if _cedef ._cgegd ==nil {return nil ,false ;};_bgaca :=_cedef ._cgegd .Get ("\u004d\u0061\u0072\u006b\u0049\u006e\u0066\u006f");return _bgaca ,_bgaca !=nil ;};
|
||
|
||
// ToGoTime returns the date in time.Time format.
|
||
func (_aabbf PdfDate )ToGoTime ()_g .Time {_cabbg :=int (_aabbf ._eedgc *60*60+_aabbf ._gfcga *60);switch _aabbf ._ebdc {case '-':_cabbg =-_cabbg ;case 'Z':_cabbg =0;};_badbg :=_d .Sprintf ("\u0055\u0054\u0043\u0025\u0063\u0025\u002e\u0032\u0064\u0025\u002e\u0032\u0064",_aabbf ._ebdc ,_aabbf ._eedgc ,_aabbf ._gfcga );
|
||
_ccgag :=_g .FixedZone (_badbg ,_cabbg );return _g .Date (int (_aabbf ._fddef ),_g .Month (_aabbf ._agbab ),int (_aabbf ._adaba ),int (_aabbf ._bedbf ),int (_aabbf ._fgdec ),int (_aabbf ._cfebe ),0,_ccgag );};func _dfebg (_fdfgff _eed .StdFont )pdfFontSimple {_fecfd :=_fdfgff .Descriptor ();
|
||
return pdfFontSimple {fontCommon :fontCommon {_ggcfc :"\u0054\u0079\u0070e\u0031",_aefg :_fdfgff .Name ()},_dacg :_fdfgff .GetMetricsTable (),_fdfca :&PdfFontDescriptor {FontName :_fg .MakeName (string (_fecfd .Name )),FontFamily :_fg .MakeName (_fecfd .Family ),FontWeight :_fg .MakeFloat (float64 (_fecfd .Weight )),Flags :_fg .MakeInteger (int64 (_fecfd .Flags )),FontBBox :_fg .MakeArrayFromFloats (_fecfd .BBox [:]),ItalicAngle :_fg .MakeFloat (_fecfd .ItalicAngle ),Ascent :_fg .MakeFloat (_fecfd .Ascent ),Descent :_fg .MakeFloat (_fecfd .Descent ),CapHeight :_fg .MakeFloat (_fecfd .CapHeight ),XHeight :_fg .MakeFloat (_fecfd .XHeight ),StemV :_fg .MakeFloat (_fecfd .StemV ),StemH :_fg .MakeFloat (_fecfd .StemH )},_fcad :_fdfgff .Encoder ()};
|
||
};
|
||
|
||
// ToPdfObject returns the PDF representation of the VRI dictionary.
|
||
func (_addbb *VRI )ToPdfObject ()*_fg .PdfObjectDictionary {_begc :=_fg .MakeDict ();_begc .SetIfNotNil (_fg .PdfObjectName ("\u0043\u0065\u0072\u0074"),_aedef (_addbb .Cert ));_begc .SetIfNotNil (_fg .PdfObjectName ("\u004f\u0043\u0053\u0050"),_aedef (_addbb .OCSP ));
|
||
_begc .SetIfNotNil (_fg .PdfObjectName ("\u0043\u0052\u004c"),_aedef (_addbb .CRL ));_begc .SetIfNotNil ("\u0054\u0055",_addbb .TU );_begc .SetIfNotNil ("\u0054\u0053",_addbb .TS );return _begc ;};
|
||
|
||
// NewPdfAcroForm returns a new PdfAcroForm with an intialized container (indirect object).
|
||
func NewPdfAcroForm ()*PdfAcroForm {return &PdfAcroForm {Fields :&[]*PdfField {},_daca :_fg .MakeIndirectObject (_fg .MakeDict ())};};
|
||
|
||
// PdfActionJavaScript represents a javaScript action.
|
||
type PdfActionJavaScript struct{*PdfAction ;JS _fg .PdfObject ;};
|
||
|
||
// Encoder returns the font's text encoder.
|
||
func (_edec pdfCIDFontType2 )Encoder ()_dg .TextEncoder {return _edec ._deecfc };
|
||
|
||
// ReplaceAcroForm replaces the acrobat form. It appends a new form to the Pdf which
|
||
// replaces the original AcroForm.
|
||
func (_fece *PdfAppender )ReplaceAcroForm (acroForm *PdfAcroForm ){if acroForm !=nil {_fece .updateObjectsDeep (acroForm .ToPdfObject (),nil );};_fece ._cacc =acroForm ;};
|
||
|
||
// GetVersion gets the document version.
|
||
func (_aggc *PdfWriter )GetVersion ()_fg .Version {return _aggc ._fbbec };
|
||
|
||
// SetNamedDestinations sets the Dests entry in the PDF catalog.
|
||
// See section 12.3.2.3 "Named Destinations" (p. 367 PDF32000_2008).
|
||
func (_fbbca *PdfWriter )SetNamedDestinations (dests _fg .PdfObject )error {if dests ==nil {return nil ;};_aa .Log .Trace ("\u0053e\u0074\u0074\u0069\u006e\u0067\u0020\u0063\u0061\u0074\u0061\u006co\u0067\u0020\u0044\u0065\u0073\u0074\u0073\u002e\u002e\u002e");
|
||
_fbbca ._cgacf .Set ("\u0044\u0065\u0073t\u0073",dests );return _fbbca .addObjects (dests );};
|
||
|
||
// PdfField contains the common attributes of a form field. The context object contains the specific field data
|
||
// which can represent a button, text, choice or signature.
|
||
// The PdfField is typically not used directly, but is encapsulated by the more specific field types such as
|
||
// PdfFieldButton etc (i.e. the context attribute).
|
||
type PdfField struct{_abcbb PdfModel ;_daecc *_fg .PdfIndirectObject ;Parent *PdfField ;Annotations []*PdfAnnotationWidget ;Kids []*PdfField ;FT *_fg .PdfObjectName ;T *_fg .PdfObjectString ;TU *_fg .PdfObjectString ;TM *_fg .PdfObjectString ;Ff *_fg .PdfObjectInteger ;
|
||
V _fg .PdfObject ;DV _fg .PdfObject ;AA _fg .PdfObject ;VariableText *VariableText ;};
|
||
|
||
// PdfActionRendition represents a Rendition action.
|
||
type PdfActionRendition struct{*PdfAction ;R _fg .PdfObject ;AN _fg .PdfObject ;OP _fg .PdfObject ;JS _fg .PdfObject ;};
|
||
|
||
// ToPdfObject recursively builds the Outline tree PDF object.
|
||
func (_caadb *PdfOutline )ToPdfObject ()_fg .PdfObject {_afgbe :=_caadb ._adece ;_eafdb :=_afgbe .PdfObject .(*_fg .PdfObjectDictionary );_eafdb .Set ("\u0054\u0079\u0070\u0065",_fg .MakeName ("\u004f\u0075\u0074\u006c\u0069\u006e\u0065\u0073"));if _caadb .First !=nil {_eafdb .Set ("\u0046\u0069\u0072s\u0074",_caadb .First .ToPdfObject ());
|
||
};if _caadb .Last !=nil {_eafdb .Set ("\u004c\u0061\u0073\u0074",_caadb .Last .GetContext ().GetContainingPdfObject ());};if _caadb .Parent !=nil {_eafdb .Set ("\u0050\u0061\u0072\u0065\u006e\u0074",_caadb .Parent .GetContext ().GetContainingPdfObject ());
|
||
};if _caadb .Count !=nil {_eafdb .Set ("\u0043\u006f\u0075n\u0074",_fg .MakeInteger (*_caadb .Count ));};return _afgbe ;};
|
||
|
||
// NewPdfFilespecFromObj creates and returns a new PdfFilespec object.
|
||
func NewPdfFilespecFromObj (obj _fg .PdfObject )(*PdfFilespec ,error ){_ccff :=&PdfFilespec {};var _gedcf *_fg .PdfObjectDictionary ;if _abac ,_gada :=_fg .GetIndirect (obj );_gada {_ccff ._ccbdc =_abac ;_fagde ,_bbbf :=_fg .GetDict (_abac .PdfObject );
|
||
if !_bbbf {_aa .Log .Debug ("\u004f\u0062\u006a\u0065c\u0074\u0020\u006e\u006f\u0074\u0020\u0061\u0020\u0064\u0069c\u0074i\u006f\u006e\u0061\u0072\u0079\u0020\u0074y\u0070\u0065");return nil ,_fg .ErrTypeError ;};_gedcf =_fagde ;}else if _bacd ,_fbff :=_fg .GetDict (obj );
|
||
_fbff {_ccff ._ccbdc =_bacd ;_gedcf =_bacd ;}else {_aa .Log .Debug ("O\u0062\u006a\u0065\u0063\u0074\u0020t\u0079\u0070\u0065\u0020\u0075\u006e\u0065\u0078\u0070e\u0063\u0074\u0065d\u0020(\u0025\u0054\u0029",obj );return nil ,_fg .ErrTypeError ;};if _gedcf ==nil {_aa .Log .Debug ("\u0044i\u0063t\u0069\u006f\u006e\u0061\u0072y\u0020\u006di\u0073\u0073\u0069\u006e\u0067");
|
||
return nil ,_ce .New ("\u0064\u0069\u0063t\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067");};if _bbdac :=_gedcf .Get ("\u0054\u0079\u0070\u0065");_bbdac !=nil {_fgbg ,_efgbe :=_bbdac .(*_fg .PdfObjectName );if !_efgbe {_aa .Log .Trace ("\u0049\u006e\u0063\u006f\u006d\u0070\u0061\u0074\u0069\u0062\u0069\u006c\u0069\u0074\u0079\u0021\u0020\u0049\u006e\u0076a\u006c\u0069\u0064\u0020\u0074\u0079\u0070\u0065\u0020\u006f\u0066\u0020\u0054\u0079\u0070\u0065\u0020\u0028\u0025\u0054\u0029\u0020\u002d\u0020\u0073\u0068\u006f\u0075\u006c\u0064 \u0062\u0065\u0020\u004e\u0061m\u0065",_bbdac );
|
||
}else {if *_fgbg !="\u0046\u0069\u006c\u0065\u0073\u0070\u0065\u0063"{_aa .Log .Trace ("\u0055\u006e\u0073\u0075\u0073\u0070e\u0063\u0074\u0065\u0064\u0020\u0054\u0079\u0070\u0065\u0020\u0021\u003d\u0020F\u0069\u006c\u0065\u0073\u0070\u0065\u0063 \u0028\u0025\u0073\u0029",*_fgbg );
|
||
};};};if _gefg :=_gedcf .Get ("\u0046\u0053");_gefg !=nil {_ccff .FS =_gefg ;};if _fgdb :=_gedcf .Get ("\u0046");_fgdb !=nil {_ccff .F =_fgdb ;};if _gbdd :=_gedcf .Get ("\u0055\u0046");_gbdd !=nil {_ccff .UF =_gbdd ;};if _adde :=_gedcf .Get ("\u0044\u004f\u0053");
|
||
_adde !=nil {_ccff .DOS =_adde ;};if _dcfd :=_gedcf .Get ("\u004d\u0061\u0063");_dcfd !=nil {_ccff .Mac =_dcfd ;};if _bdgee :=_gedcf .Get ("\u0055\u006e\u0069\u0078");_bdgee !=nil {_ccff .Unix =_bdgee ;};if _befe :=_gedcf .Get ("\u0049\u0044");_befe !=nil {_ccff .ID =_befe ;
|
||
};if _bcfa :=_gedcf .Get ("\u0056");_bcfa !=nil {_ccff .V =_bcfa ;};if _eggc :=_gedcf .Get ("\u0045\u0046");_eggc !=nil {_ccff .EF =_eggc ;};if _ebfd :=_gedcf .Get ("\u0052\u0046");_ebfd !=nil {_ccff .RF =_ebfd ;};if _cfca :=_gedcf .Get ("\u0044\u0065\u0073\u0063");
|
||
_cfca !=nil {_ccff .Desc =_cfca ;};if _ebaad :=_gedcf .Get ("\u0043\u0049");_ebaad !=nil {_ccff .CI =_ebaad ;};return _ccff ,nil ;};
|
||
|
||
// PdfActionThread represents a thread action.
|
||
type PdfActionThread struct{*PdfAction ;F *PdfFilespec ;D _fg .PdfObject ;B _fg .PdfObject ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_cfc *PdfActionResetForm )ToPdfObject ()_fg .PdfObject {_cfc .PdfAction .ToPdfObject ();_gcb :=_cfc ._bda ;_fada :=_gcb .PdfObject .(*_fg .PdfObjectDictionary );_fada .SetIfNotNil ("\u0053",_fg .MakeName (string (ActionTypeResetForm )));_fada .SetIfNotNil ("\u0046\u0069\u0065\u006c\u0064\u0073",_cfc .Fields );
|
||
_fada .SetIfNotNil ("\u0046\u006c\u0061g\u0073",_cfc .Flags );return _gcb ;};
|
||
|
||
// SetOpenAction sets the OpenAction in the PDF catalog.
|
||
// The value shall be either an array defining a destination (12.3.2 "Destinations" PDF32000_2008),
|
||
// or an action dictionary representing an action (12.6 "Actions" PDF32000_2008).
|
||
func (_dcfdd *PdfWriter )SetOpenAction (dest _fg .PdfObject )error {if dest ==nil ||_fg .IsNullObject (dest ){return nil ;};_dcfdd ._cgacf .Set ("\u004f\u0070\u0065\u006e\u0041\u0063\u0074\u0069\u006f\u006e",dest );return _dcfdd .addObjects (dest );};
|
||
|
||
// DefaultImageHandler is the default implementation of the ImageHandler using the standard go library.
|
||
type DefaultImageHandler struct{};
|
||
|
||
// PdfFieldButton represents a button field which includes push buttons, checkboxes, and radio buttons.
|
||
type PdfFieldButton struct{*PdfField ;Opt *_fg .PdfObjectArray ;_babe *Image ;};
|
||
|
||
// PdfShadingType1 is a Function-based shading.
|
||
type PdfShadingType1 struct{*PdfShading ;Domain *_fg .PdfObjectArray ;Matrix *_fg .PdfObjectArray ;Function []PdfFunction ;};
|
||
|
||
// ToPdfObject converts PdfAcroForm to a PdfObject, i.e. an indirect object containing the
|
||
// AcroForm dictionary.
|
||
func (_aace *PdfAcroForm )ToPdfObject ()_fg .PdfObject {_dfdfe :=_aace ._daca ;_edaga :=_dfdfe .PdfObject .(*_fg .PdfObjectDictionary );if _aace .Fields !=nil {_defag :=_fg .PdfObjectArray {};for _ ,_fgbbd :=range *_aace .Fields {_eabgf :=_fgbbd .GetContext ();
|
||
if _eabgf !=nil {_defag .Append (_eabgf .ToPdfObject ());}else {_defag .Append (_fgbbd .ToPdfObject ());};};_edaga .Set ("\u0046\u0069\u0065\u006c\u0064\u0073",&_defag );};if _aace .NeedAppearances !=nil {_edaga .Set ("\u004ee\u0065d\u0041\u0070\u0070\u0065\u0061\u0072\u0061\u006e\u0063\u0065\u0073",_aace .NeedAppearances );
|
||
}else {if _fbef :=_edaga .Get ("\u004ee\u0065d\u0041\u0070\u0070\u0065\u0061\u0072\u0061\u006e\u0063\u0065\u0073");_fbef !=nil {_edaga .Remove ("\u004ee\u0065d\u0041\u0070\u0070\u0065\u0061\u0072\u0061\u006e\u0063\u0065\u0073");};};if _aace .SigFlags !=nil {_edaga .Set ("\u0053\u0069\u0067\u0046\u006c\u0061\u0067\u0073",_aace .SigFlags );
|
||
};if _aace .CO !=nil {_edaga .Set ("\u0043\u004f",_aace .CO );};if _aace .DR !=nil {_edaga .Set ("\u0044\u0052",_aace .DR .ToPdfObject ());};if _aace .DA !=nil {_edaga .Set ("\u0044\u0041",_aace .DA );};if _aace .Q !=nil {_edaga .Set ("\u0051",_aace .Q );
|
||
};if _aace .XFA !=nil {_edaga .Set ("\u0058\u0046\u0041",_aace .XFA );};if _aace .ADBEEchoSign !=nil {_edaga .Set ("\u0041\u0044\u0042\u0045\u005f\u0045\u0063\u0068\u006f\u0053\u0069\u0067\u006e",_aace .ADBEEchoSign );};return _dfdfe ;};
|
||
|
||
// Height returns the height of `rect`.
|
||
func (_gdfbg *PdfRectangle )Height ()float64 {return _ef .Abs (_gdfbg .Ury -_gdfbg .Lly )};
|
||
|
||
// PdfAnnotationMovie represents Movie annotations.
|
||
// (Section 12.5.6.17).
|
||
type PdfAnnotationMovie struct{*PdfAnnotation ;T _fg .PdfObject ;Movie _fg .PdfObject ;A _fg .PdfObject ;};
|
||
|
||
// A returns the value of the A component of the color.
|
||
func (_cffgd *PdfColorLab )A ()float64 {return _cffgd [1]};
|
||
|
||
// ImageToRGB converts image in CalGray color space to RGB (A, B, C -> X, Y, Z).
|
||
func (_ccda *PdfColorspaceCalGray )ImageToRGB (img Image )(Image ,error ){_fedcg :=_ade .NewReader (img .getBase ());_ecga :=_cc .NewImageBase (int (img .Width ),int (img .Height ),int (img .BitsPerComponent ),3,nil ,nil ,nil );_dfaa :=_ade .NewWriter (_ecga );
|
||
_eafc :=_ef .Pow (2,float64 (img .BitsPerComponent ))-1;_ggcd :=make ([]uint32 ,3);var (_bage uint32 ;ANorm ,X ,Y ,Z ,_eece ,_dge ,_fbca float64 ;_eebb error ;);for {_bage ,_eebb =_fedcg .ReadSample ();if _eebb ==_ff .EOF {break ;}else if _eebb !=nil {return img ,_eebb ;
|
||
};ANorm =float64 (_bage )/_eafc ;X =_ccda .WhitePoint [0]*_ef .Pow (ANorm ,_ccda .Gamma );Y =_ccda .WhitePoint [1]*_ef .Pow (ANorm ,_ccda .Gamma );Z =_ccda .WhitePoint [2]*_ef .Pow (ANorm ,_ccda .Gamma );_eece =3.240479*X +-1.537150*Y +-0.498535*Z ;_dge =-0.969256*X +1.875992*Y +0.041556*Z ;
|
||
_fbca =0.055648*X +-0.204043*Y +1.057311*Z ;_eece =_ef .Min (_ef .Max (_eece ,0),1.0);_dge =_ef .Min (_ef .Max (_dge ,0),1.0);_fbca =_ef .Min (_ef .Max (_fbca ,0),1.0);_ggcd [0]=uint32 (_eece *_eafc );_ggcd [1]=uint32 (_dge *_eafc );_ggcd [2]=uint32 (_fbca *_eafc );
|
||
if _eebb =_dfaa .WriteSamples (_ggcd );_eebb !=nil {return img ,_eebb ;};};return _adad (&_ecga ),nil ;};
|
||
|
||
// SetDocInfo sets the document /Info metadata.
|
||
// This will overwrite any globally declared document info.
|
||
func (_dbbf *PdfAppender )SetDocInfo (info *PdfInfo ){_dbbf ._fadf =info };func (_aaege *Image )samplesAddPadding (_deeb []uint32 )[]uint32 {_eaffe :=_cc .BytesPerLine (int (_aaege .Width ),int (_aaege .BitsPerComponent ),_aaege .ColorComponents )*(8/int (_aaege .BitsPerComponent ));
|
||
_cgdbd :=_eaffe *int (_aaege .Height );if len (_deeb )==_cgdbd {return _deeb ;};_bgdbd :=make ([]uint32 ,_cgdbd );_bede :=int (_aaege .Width )*_aaege .ColorComponents ;for _fbfe :=0;_fbfe < int (_aaege .Height );_fbfe ++{_facdf :=_fbfe *int (_aaege .Width );
|
||
_ggedf :=_fbfe *_eaffe ;for _bgdg :=0;_bgdg < _bede ;_bgdg ++{_bgdbd [_ggedf +_bgdg ]=_deeb [_facdf +_bgdg ];};};return _bgdbd ;};
|
||
|
||
// GetRuneMetrics returns the character metrics for the rune.
|
||
// A bool flag is returned to indicate whether or not the entry was found.
|
||
func (_bgaa pdfFontSimple )GetRuneMetrics (r rune )(_eed .CharMetrics ,bool ){if _bgaa ._dacg !=nil {_cceab ,_dbdbf :=_bgaa ._dacg .Read (r );if _dbdbf {return _cceab ,true ;};};_gcddf :=_bgaa .Encoder ();if _gcddf ==nil {_aa .Log .Debug ("\u004e\u006f\u0020en\u0063\u006f\u0064\u0065\u0072\u0020\u0066\u006f\u0072\u0020\u0066\u006f\u006e\u0074\u0073\u003d\u0025\u0073",_bgaa );
|
||
return _eed .CharMetrics {},false ;};_bcfde ,_fgdf :=_gcddf .RuneToCharcode (r );if !_fgdf {if r !=' '{_aa .Log .Trace ("\u004e\u006f\u0020c\u0068\u0061\u0072\u0063o\u0064\u0065\u0020\u0066\u006f\u0072\u0020r\u0075\u006e\u0065\u003d\u0025\u0076\u0020\u0066\u006f\u006e\u0074\u003d\u0025\u0073",r ,_bgaa );
|
||
};return _eed .CharMetrics {},false ;};_gfga ,_bggda :=_bgaa .GetCharMetrics (_bcfde );return _gfga ,_bggda ;};
|
||
|
||
// ToPdfObject convert PdfInfo to pdf object.
|
||
func (_gedc *PdfInfo )ToPdfObject ()_fg .PdfObject {_fdaf :=_fg .MakeDict ();_fdaf .SetIfNotNil ("\u0054\u0069\u0074l\u0065",_gedc .Title );_fdaf .SetIfNotNil ("\u0041\u0075\u0074\u0068\u006f\u0072",_gedc .Author );_fdaf .SetIfNotNil ("\u0053u\u0062\u006a\u0065\u0063\u0074",_gedc .Subject );
|
||
_fdaf .SetIfNotNil ("\u004b\u0065\u0079\u0077\u006f\u0072\u0064\u0073",_gedc .Keywords );_fdaf .SetIfNotNil ("\u0043r\u0065\u0061\u0074\u006f\u0072",_gedc .Creator );_fdaf .SetIfNotNil ("\u0050\u0072\u006f\u0064\u0075\u0063\u0065\u0072",_gedc .Producer );
|
||
_fdaf .SetIfNotNil ("\u0054r\u0061\u0070\u0070\u0065\u0064",_gedc .Trapped );if _gedc .CreationDate !=nil {_fdaf .SetIfNotNil ("\u0043\u0072\u0065a\u0074\u0069\u006f\u006e\u0044\u0061\u0074\u0065",_gedc .CreationDate .ToPdfObject ());};if _gedc .ModifiedDate !=nil {_fdaf .SetIfNotNil ("\u004do\u0064\u0044\u0061\u0074\u0065",_gedc .ModifiedDate .ToPdfObject ());
|
||
};for _ ,_fdecc :=range _gedc ._aaee .Keys (){_fdaf .SetIfNotNil (_fdecc ,_gedc ._aaee .Get (_fdecc ));};return _fdaf ;};func (_adcg *pdfFontSimple )addEncoding ()error {var (_abffa string ;_deab map[_dg .CharCode ]_dg .GlyphName ;_defee _dg .SimpleEncoder ;
|
||
);if _adcg .Encoder ()!=nil {_facb ,_fffb :=_adcg .Encoder ().(_dg .SimpleEncoder );if _fffb &&_facb !=nil {_abffa =_facb .BaseName ();};};if _adcg .Encoding !=nil {_fffdg ,_beef ,_ffcda :=_adcg .getFontEncoding ();if _ffcda !=nil {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0042\u0061\u0073\u0065F\u006f\u006e\u0074\u003d\u0025\u0071\u0020\u0053u\u0062t\u0079\u0070\u0065\u003d\u0025\u0071\u0020\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067\u003d\u0025\u0073 \u0028\u0025\u0054\u0029\u0020\u0065\u0072\u0072\u003d\u0025\u0076",_adcg ._aefg ,_adcg ._ggcfc ,_adcg .Encoding ,_adcg .Encoding ,_ffcda );
|
||
return _ffcda ;};if _fffdg !=""{_abffa =_fffdg ;};_deab =_beef ;_defee ,_ffcda =_dg .NewSimpleTextEncoder (_abffa ,_deab );if _ffcda !=nil {return _ffcda ;};};if _defee ==nil {_ccddg :=_adcg ._cdgef ;if _ccddg !=nil {switch _adcg ._ggcfc {case "\u0054\u0079\u0070e\u0031":if _ccddg .fontFile !=nil &&_ccddg .fontFile ._ffff !=nil {_aa .Log .Debug ("\u0055\u0073\u0069\u006e\u0067\u0020\u0066\u006f\u006et\u0046\u0069\u006c\u0065");
|
||
_defee =_ccddg .fontFile ._ffff ;};case "\u0054\u0072\u0075\u0065\u0054\u0079\u0070\u0065":if _ccddg ._bbbd !=nil {_aa .Log .Debug ("\u0055s\u0069n\u0067\u0020\u0046\u006f\u006e\u0074\u0046\u0069\u006c\u0065\u0032");_dbaa ,_gadag :=_ccddg ._bbbd .MakeEncoder ();
|
||
if _gadag ==nil {_defee =_dbaa ;};};};};};if _defee !=nil {if _deab !=nil {_aa .Log .Trace ("\u0064\u0069\u0066fe\u0072\u0065\u006e\u0063\u0065\u0073\u003d\u0025\u002b\u0076\u0020\u0066\u006f\u006e\u0074\u003d\u0025\u0073",_deab ,_adcg .baseFields ());
|
||
_defee =_dg .ApplyDifferences (_defee ,_deab );};_adcg .SetEncoder (_defee );};return nil ;};func _eafef ()_g .Time {_baacg .Lock ();defer _baacg .Unlock ();return _dfdeae };
|
||
|
||
// PdfFilespec represents a file specification which can either refer to an external or embedded file.
|
||
type PdfFilespec struct{Type _fg .PdfObject ;FS _fg .PdfObject ;F _fg .PdfObject ;UF _fg .PdfObject ;DOS _fg .PdfObject ;Mac _fg .PdfObject ;Unix _fg .PdfObject ;ID _fg .PdfObject ;V _fg .PdfObject ;EF _fg .PdfObject ;RF _fg .PdfObject ;Desc _fg .PdfObject ;
|
||
CI _fg .PdfObject ;_ccbdc _fg .PdfObject ;};func (_cdge *PdfReader )newPdfActionImportDataFromDict (_gfcf *_fg .PdfObjectDictionary )(*PdfActionImportData ,error ){_agfeb ,_cee :=_ddd (_gfcf .Get ("\u0046"));if _cee !=nil {return nil ,_cee ;};return &PdfActionImportData {F :_agfeb },nil ;
|
||
};func (_fbga *PdfWriter )makeOffSetReference (_gcgea int64 ){_bgeeb :=_d .Sprintf ("\u0073\u0074\u0061\u0072\u0074\u0078\u0072\u0065\u0066\u000a\u0025\u0064\u000a",_gcgea );_fbga .writeString (_bgeeb );_fbga .writeString ("\u0025\u0025\u0045\u004f\u0046\u000a");
|
||
};
|
||
|
||
// PdfAnnotationHighlight represents Highlight annotations.
|
||
// (Section 12.5.6.10).
|
||
type PdfAnnotationHighlight struct{*PdfAnnotation ;*PdfAnnotationMarkup ;QuadPoints _fg .PdfObject ;};func _aegf (_fdbbd []byte )bool {if len (_fdbbd )< 4{return true ;};for _decdd :=range _fdbbd [:4]{_gbbc :=rune (_decdd );if !_dfa .Is (_dfa .ASCII_Hex_Digit ,_gbbc )&&!_dfa .IsSpace (_gbbc ){return true ;
|
||
};};return false ;};func (_cbceb *PdfWriter )getPdfVersion ()string {return _d .Sprintf ("\u0025\u0064\u002e%\u0064",_cbceb ._fbbec .Major ,_cbceb ._fbbec .Minor );};
|
||
|
||
// PdfActionType represents an action type in PDF (section 12.6.4 p. 417).
|
||
type PdfActionType string ;
|
||
|
||
// NewReaderForText makes a new PdfReader for an input PDF content string. For use in testing.
|
||
func NewReaderForText (txt string )*PdfReader {return &PdfReader {_aefbbf :map[_fg .PdfObject ]struct{}{},_edebb :_aafff (),_ccgg :_fg .NewParserFromString (txt )};};
|
||
|
||
// HasPatternByName checks whether a pattern object is defined by the specified keyName.
|
||
func (_fgbfb *PdfPageResources )HasPatternByName (keyName _fg .PdfObjectName )bool {_ ,_fdbeag :=_fgbfb .GetPatternByName (keyName );return _fdbeag ;};func (_gebcb *PdfReader )newPdfSignatureReferenceFromDict (_fegbd *_fg .PdfObjectDictionary )(*PdfSignatureReference ,error ){if _edcba ,_fgbbg :=_gebcb ._edebb .GetModelFromPrimitive (_fegbd ).(*PdfSignatureReference );
|
||
_fgbbg {return _edcba ,nil ;};_bfcb :=&PdfSignatureReference {_gafdc :_fegbd ,Data :_fegbd .Get ("\u0044\u0061\u0074\u0061")};var _cfbcd bool ;_bfcb .Type ,_ =_fg .GetName (_fegbd .Get ("\u0054\u0079\u0070\u0065"));_bfcb .TransformMethod ,_cfbcd =_fg .GetName (_fegbd .Get ("\u0054r\u0061n\u0073\u0066\u006f\u0072\u006d\u004d\u0065\u0074\u0068\u006f\u0064"));
|
||
if !_cfbcd {_aa .Log .Error ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0053\u0069g\u006e\u0061\u0074\u0075\u0072\u0065\u0020\u0052\u0065\u0066\u0065\u0072\u0065\u006e\u0063\u0065\u0020\u0054\u0072\u0061\u006e\u0073\u0066o\u0072\u006dM\u0065\u0074h\u006f\u0064\u0020\u0061\u0074\u0074\u0072\u0069\u0062\u0075\u0074\u0065\u0020in\u0076\u0061\u006c\u0069\u0064\u0020\u006f\u0072\u0020m\u0069\u0073\u0073\u0069\u006e\u0067");
|
||
return nil ,ErrInvalidAttribute ;};_bfcb .TransformParams ,_ =_fg .GetDict (_fegbd .Get ("\u0054r\u0061n\u0073\u0066\u006f\u0072\u006d\u0050\u0061\u0072\u0061\u006d\u0073"));_bfcb .DigestMethod ,_ =_fg .GetName (_fegbd .Get ("\u0044\u0069\u0067e\u0073\u0074\u004d\u0065\u0074\u0068\u006f\u0064"));
|
||
return _bfcb ,nil ;};
|
||
|
||
// GetContainingPdfObject implements interface PdfModel.
|
||
func (_bggcg *PdfSignature )GetContainingPdfObject ()_fg .PdfObject {return _bggcg ._fbbgf };func (_daeccg *PdfWriter )writeBytes (_accef []byte ){if _daeccg ._adgac !=nil {return ;};_ddbaab ,_gabge :=_daeccg ._dbdde .Write (_accef );_daeccg ._fcgga +=int64 (_ddbaab );
|
||
_daeccg ._adgac =_gabge ;};
|
||
|
||
// GetSubFilter returns SubFilter value or empty string.
|
||
func (_eddea *pdfSignDictionary )GetSubFilter ()string {_ebebcg :=_eddea .Get ("\u0053u\u0062\u0046\u0069\u006c\u0074\u0065r");if _ebebcg ==nil {return "";};if _dcfec ,_bggbg :=_fg .GetNameVal (_ebebcg );_bggbg {return _dcfec ;};return "";};
|
||
|
||
// GetSamples converts the raw byte slice into samples which are stored in a uint32 bit array.
|
||
// Each sample is represented by BitsPerComponent consecutive bits in the raw data.
|
||
// NOTE: The method resamples the image byte data before returning the result and
|
||
// this could lead to high memory usage, especially on large images. It should
|
||
// be avoided, when possible. It is recommended to access the Data field of the
|
||
// image directly or use the ColorAt method to extract individual pixels.
|
||
func (_ggbdf *Image )GetSamples ()[]uint32 {_dgcb :=_ade .ResampleBytes (_ggbdf .Data ,int (_ggbdf .BitsPerComponent ));if _ggbdf .BitsPerComponent < 8{_dgcb =_ggbdf .samplesTrimPadding (_dgcb );};_bcecg :=int (_ggbdf .Width )*int (_ggbdf .Height )*_ggbdf .ColorComponents ;
|
||
if len (_dgcb )< _bcecg {_aa .Log .Debug ("\u0045r\u0072\u006fr\u003a\u0020\u0054o\u006f\u0020\u0066\u0065\u0077\u0020\u0073a\u006d\u0070\u006c\u0065\u0073\u0020(\u0067\u006f\u0074\u0020\u0025\u0064\u002c\u0020\u0065\u0078\u0070e\u0063\u0074\u0069\u006e\u0067\u0020\u0025\u0064\u0029",len (_dgcb ),_bcecg );
|
||
return _dgcb ;}else if len (_dgcb )> _bcecg {_aa .Log .Debug ("\u0045r\u0072\u006fr\u003a\u0020\u0054o\u006f\u0020\u006d\u0061\u006e\u0079\u0020s\u0061\u006d\u0070\u006c\u0065\u0073 \u0028\u0067\u006f\u0074\u0020\u0025\u0064\u002c\u0020\u0065\u0078p\u0065\u0063\u0074\u0069\u006e\u0067\u0020\u0025\u0064",len (_dgcb ),_bcecg );
|
||
_dgcb =_dgcb [:_bcecg ];};return _dgcb ;};
|
||
|
||
// NewPdfSignature creates a new PdfSignature object.
|
||
func NewPdfSignature (handler SignatureHandler )*PdfSignature {_gaaea :=&PdfSignature {Type :_fg .MakeName ("\u0053\u0069\u0067"),Handler :handler };_gbgg :=&pdfSignDictionary {PdfObjectDictionary :_fg .MakeDict (),_afcd :&handler ,_cggdd :_gaaea };_gaaea ._fbbgf =_fg .MakeIndirectObject (_gbgg );
|
||
return _gaaea ;};func (_eaee *PdfReader )newPdfFieldFromIndirectObject (_fgbc *_fg .PdfIndirectObject ,_bgfc *PdfField )(*PdfField ,error ){if _fgecb ,_gggcg :=_eaee ._edebb .GetModelFromPrimitive (_fgbc ).(*PdfField );_gggcg {return _fgecb ,nil ;};_caaae ,_bddge :=_fg .GetDict (_fgbc );
|
||
if !_bddge {return nil ,_d .Errorf ("\u0050\u0064f\u0046\u0069\u0065\u006c\u0064 \u0069\u006e\u0064\u0069\u0072e\u0063\u0074\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u0020\u006e\u006f\u0074\u0020\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0069\u006e\u0067\u0020\u0061\u0020\u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061\u0072\u0079");
|
||
};_adbg :=NewPdfField ();_adbg ._daecc =_fgbc ;_adbg ._daecc .PdfObject =_caaae ;if _aebga ,_eebc :=_fg .GetName (_caaae .Get ("\u0046\u0054"));_eebc {_adbg .FT =_aebga ;};if _bgfc !=nil {_adbg .Parent =_bgfc ;};_adbg .T ,_ =_caaae .Get ("\u0054").(*_fg .PdfObjectString );
|
||
_adbg .TU ,_ =_caaae .Get ("\u0054\u0055").(*_fg .PdfObjectString );_adbg .TM ,_ =_caaae .Get ("\u0054\u004d").(*_fg .PdfObjectString );_adbg .Ff ,_ =_caaae .Get ("\u0046\u0066").(*_fg .PdfObjectInteger );_adbg .V =_caaae .Get ("\u0056");_adbg .DV =_caaae .Get ("\u0044\u0056");
|
||
_adbg .AA =_caaae .Get ("\u0041\u0041");if DA :=_caaae .Get ("\u0044\u0041");DA !=nil {DA ,_ :=_fg .GetString (DA );_adbg .VariableText =&VariableText {DA :DA };Q ,_ :=_caaae .Get ("\u0051").(*_fg .PdfObjectInteger );DS ,_ :=_caaae .Get ("\u0044\u0053").(*_fg .PdfObjectString );
|
||
RV :=_caaae .Get ("\u0052\u0056");_adbg .VariableText .Q =Q ;_adbg .VariableText .DS =DS ;_adbg .VariableText .RV =RV ;};_ecae :=_adbg .FT ;if _ecae ==nil &&_bgfc !=nil {_ecae =_bgfc .FT ;};if _ecae !=nil {switch *_ecae {case "\u0054\u0078":_adabeg ,_fbfag :=_cffc (_caaae );
|
||
if _fbfag !=nil {return nil ,_fbfag ;};_adabeg .PdfField =_adbg ;_adbg ._abcbb =_adabeg ;case "\u0043\u0068":_dgde ,_gcaf :=_daeb (_caaae );if _gcaf !=nil {return nil ,_gcaf ;};_dgde .PdfField =_adbg ;_adbg ._abcbb =_dgde ;case "\u0042\u0074\u006e":_cfgba ,_gccb :=_eddb (_caaae );
|
||
if _gccb !=nil {return nil ,_gccb ;};_cfgba .PdfField =_adbg ;_adbg ._abcbb =_cfgba ;case "\u0053\u0069\u0067":_bfba ,_eadg :=_eaee .newPdfFieldSignatureFromDict (_caaae );if _eadg !=nil {return nil ,_eadg ;};_bfba .PdfField =_adbg ;_adbg ._abcbb =_bfba ;
|
||
default:_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0055\u006e\u0073\u0075\u0070\u0070\u006f\u0072t\u0065d\u0020\u0066\u0069\u0065\u006c\u0064\u0020\u0074\u0079\u0070\u0065\u0020\u0025\u0073",*_adbg .FT );return nil ,_ce .New ("\u0075\u006e\u0073\u0075pp\u006f\u0072\u0074\u0065\u0064\u0020\u0066\u0069\u0065\u006c\u0064\u0020\u0074\u0079p\u0065");
|
||
};};if _fcge ,_cbca :=_fg .GetName (_caaae .Get ("\u0053u\u0062\u0074\u0079\u0070\u0065"));_cbca {if *_fcge =="\u0057\u0069\u0064\u0067\u0065\u0074"{_bdbd ,_befa :=_eaee .newPdfAnnotationFromIndirectObject (_fgbc );if _befa !=nil {return nil ,_befa ;};
|
||
_fbba ,_deea :=_bdbd .GetContext ().(*PdfAnnotationWidget );if !_deea {return nil ,_ce .New ("\u0069n\u0076\u0061\u006c\u0069d\u0020\u0077\u0069\u0064\u0067e\u0074 \u0061n\u006e\u006f\u0074\u0061\u0074\u0069\u006fn");};_fbba ._ddcc =_adbg ;_fbba .Parent =_adbg ._daecc ;
|
||
_adbg .Annotations =append (_adbg .Annotations ,_fbba );return _adbg ,nil ;};};_fgcc :=true ;if _fdca ,_aeaeg :=_fg .GetArray (_caaae .Get ("\u004b\u0069\u0064\u0073"));_aeaeg {_fcbec :=make ([]*_fg .PdfIndirectObject ,0,_fdca .Len ());for _ ,_cdcgg :=range _fdca .Elements (){_ffaeb ,_caad :=_fg .GetIndirect (_cdcgg );
|
||
if !_caad {_fcccb ,_cfffe :=_fg .GetStream (_cdcgg );if _cfffe &&_fcccb .PdfObjectDictionary !=nil {_fdfc ,_ddfb :=_fg .GetNameVal (_fcccb .Get ("\u0054\u0079\u0070\u0065"));if _ddfb &&_fdfc =="\u004d\u0065\u0074\u0061\u0064\u0061\u0074\u0061"{_aa .Log .Debug ("E\u0052RO\u0052:\u0020f\u006f\u0072\u006d\u0020\u0066i\u0065\u006c\u0064 \u004b\u0069\u0064\u0073\u0020a\u0072\u0072\u0061y\u0020\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0073\u0020\u0069n\u0076\u0061\u006cid \u004d\u0065\u0074\u0061\u0064\u0061t\u0061\u0020\u0073\u0074\u0072\u0065\u0061\u006d\u002e\u0020\u0053\u006bi\u0070p\u0069\u006e\u0067\u002e");
|
||
continue ;};};return nil ,_ce .New ("n\u006f\u0074\u0020\u0061\u006e\u0020i\u006e\u0064\u0069\u0072\u0065\u0063t\u0020\u006f\u0062\u006a\u0065\u0063\u0074 \u0028\u0066\u006f\u0072\u006d\u0020\u0066\u0069\u0065\u006cd\u0029");};_cefg ,_ededd :=_fg .GetDict (_ffaeb );
|
||
if !_ededd {return nil ,ErrTypeCheck ;};if _fgcc {_fgcc =!_gecd (_cefg );};_fcbec =append (_fcbec ,_ffaeb );};for _ ,_feed :=range _fcbec {if _fgcc {_ggae ,_ggacf :=_eaee .newPdfAnnotationFromIndirectObject (_feed );if _ggacf !=nil {_aa .Log .Debug ("\u0045r\u0072\u006fr\u0020\u006c\u006fa\u0064\u0069\u006e\u0067\u0020\u0077\u0069d\u0067\u0065\u0074\u0020\u0061\u006en\u006f\u0074\u0061\u0074\u0069\u006f\u006e\u0020\u0066\u006f\u0072 \u0066\u0069\u0065\u006c\u0064\u003a\u0020\u0025\u0076",_ggacf );
|
||
return nil ,_ggacf ;};_edcc ,_fegab :=_ggae ._cbea .(*PdfAnnotationWidget );if !_fegab {return nil ,ErrTypeCheck ;};_edcc ._ddcc =_adbg ;_adbg .Annotations =append (_adbg .Annotations ,_edcc );}else {_bbab ,_aafb :=_eaee .newPdfFieldFromIndirectObject (_feed ,_adbg );
|
||
if _aafb !=nil {_aa .Log .Debug ("\u0045\u0072r\u006f\u0072\u0020\u006c\u006f\u0061\u0064\u0069\u006e\u0067\u0020\u0063\u0068\u0069\u006c\u0064\u0020\u0066\u0069\u0065\u006c\u0064: \u0025\u0076",_aafb );return nil ,_aafb ;};_adbg .Kids =append (_adbg .Kids ,_bbab );
|
||
};};};return _adbg ,nil ;};
|
||
|
||
// AppendContentStream adds content stream by string. Appends to the last
|
||
// contentstream instance if many.
|
||
func (_bgbf *PdfPage )AppendContentStream (contentStr string )error {_fbee ,_cabcg :=_bgbf .GetContentStreams ();if _cabcg !=nil {return _cabcg ;};if len (_fbee )==0{_fbee =[]string {contentStr };return _bgbf .SetContentStreams (_fbee ,_fg .NewFlateEncoder ());
|
||
};var _afgef _cb .Buffer ;_afgef .WriteString (_fbee [len (_fbee )-1]);_afgef .WriteString ("\u000a");_afgef .WriteString (contentStr );_fbee [len (_fbee )-1]=_afgef .String ();return _bgbf .SetContentStreams (_fbee ,_fg .NewFlateEncoder ());};func _afga (_bgega _fg .PdfObject )(*PdfPageResourcesColorspaces ,error ){_bacgg :=&PdfPageResourcesColorspaces {};
|
||
if _cffea ,_ebfddd :=_bgega .(*_fg .PdfIndirectObject );_ebfddd {_bacgg ._daff =_cffea ;_bgega =_cffea .PdfObject ;};_gaffd ,_cbebf :=_fg .GetDict (_bgega );if !_cbebf {return nil ,_ce .New ("\u0043\u0053\u0020at\u0074\u0072\u0069\u0062\u0075\u0074\u0065\u0020\u0074\u0079\u0070\u0065\u0020\u0065\u0072\u0072\u006f\u0072");
|
||
};_bacgg .Names =[]string {};_bacgg .Colorspaces =map[string ]PdfColorspace {};for _ ,_aaaa :=range _gaffd .Keys (){_bedef :=_gaffd .Get (_aaaa );_bacgg .Names =append (_bacgg .Names ,string (_aaaa ));_dbbgb ,_afbdg :=NewPdfColorspaceFromPdfObject (_bedef );
|
||
if _afbdg !=nil {return nil ,_afbdg ;};_bacgg .Colorspaces [string (_aaaa )]=_dbbgb ;};return _bacgg ,nil ;};func _dadagc ()string {_baacg .Lock ();defer _baacg .Unlock ();_acabed :=_bec .GetLicenseKey ();if len (_egdda )> 0&&(_acabed .IsLicensed ()||_dbfbeb ){return _egdda ;
|
||
};return _d .Sprintf ("\u0055\u006e\u0069Do\u0063\u0020\u0076\u0025\u0073\u0020\u0028\u0025\u0073)\u0020-\u0020h\u0074t\u0070\u003a\u002f\u002f\u0075\u006e\u0069\u0064\u006f\u0063\u002e\u0069\u006f",_cffgdbb (),_acabed .TypeToString ());};
|
||
|
||
// GetCharMetrics returns the char metrics for character code `code`.
|
||
func (_eeadc pdfFontType3 )GetCharMetrics (code _dg .CharCode )(_eed .CharMetrics ,bool ){if _bbeec ,_gegcc :=_eeadc ._eabbc [code ];_gegcc {return _eed .CharMetrics {Wx :_bbeec },true ;};if _eed .IsStdFont (_eed .StdFontName (_eeadc ._aefg )){return _eed .CharMetrics {Wx :250},true ;
|
||
};return _eed .CharMetrics {},false ;};
|
||
|
||
// NewPdfFontFromTTFFile loads a TTF font file and returns a PdfFont type
|
||
// that can be used in text styling functions.
|
||
// Uses a WinAnsiTextEncoder and loads only character codes 32-255.
|
||
// NOTE: For composite fonts such as used in symbolic languages, use NewCompositePdfFontFromTTFFile.
|
||
func NewPdfFontFromTTFFile (filePath string )(*PdfFont ,error ){_egdfa ,_gdccd :=_c .Open (filePath );if _gdccd !=nil {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0072\u0065\u0061\u0064\u0069\u006e\u0067\u0020T\u0054F\u0020\u0066\u006f\u006e\u0074\u0020\u0066\u0069\u006c\u0065\u003a\u0020\u0025\u0076",_gdccd );
|
||
return nil ,_gdccd ;};defer _egdfa .Close ();return NewPdfFontFromTTF (_egdfa );};
|
||
|
||
// Has checks if flag fl is set in flag and returns true if so, false otherwise.
|
||
func (_dddb FieldFlag )Has (fl FieldFlag )bool {return (_dddb .Mask ()&fl .Mask ())> 0};
|
||
|
||
// NewPdfAnnotationWatermark returns a new watermark annotation.
|
||
func NewPdfAnnotationWatermark ()*PdfAnnotationWatermark {_fedc :=NewPdfAnnotation ();_cdc :=&PdfAnnotationWatermark {};_cdc .PdfAnnotation =_fedc ;_fedc .SetContext (_cdc );return _cdc ;};
|
||
|
||
// GetIndirectObjectByNumber retrieves and returns a specific PdfObject by object number.
|
||
func (_dbfe *PdfReader )GetIndirectObjectByNumber (number int )(_fg .PdfObject ,error ){_debeb ,_abgaf :=_dbfe ._ccgg .LookupByNumber (number );return _debeb ,_abgaf ;};
|
||
|
||
// SignatureHandler interface defines the common functionality for PDF signature handlers, which
|
||
// need to be capable of validating digital signatures and signing PDF documents.
|
||
type SignatureHandler interface{
|
||
|
||
// IsApplicable checks if a given signature dictionary `sig` is applicable for the signature handler.
|
||
// For example a signature of type `adbe.pkcs7.detached` might not fit for a rsa.sha1 handler.
|
||
IsApplicable (_ddgfbg *PdfSignature )bool ;
|
||
|
||
// Validate validates a PDF signature against a given digest (hash) such as that determined
|
||
// for an input file. Returns validation results.
|
||
Validate (_bffbf *PdfSignature ,_ceddf Hasher )(SignatureValidationResult ,error );
|
||
|
||
// InitSignature prepares the signature dictionary for signing. This involves setting all
|
||
// necessary fields, and also allocating sufficient space to the Contents so that the
|
||
// finalized signature can be inserted once the hash is calculated.
|
||
InitSignature (_bafaf *PdfSignature )error ;
|
||
|
||
// NewDigest creates a new digest/hasher based on the signature dictionary and handler.
|
||
NewDigest (_baffd *PdfSignature )(Hasher ,error );
|
||
|
||
// Sign receives the hash `digest` (for example hash of an input file), and signs based
|
||
// on the signature dictionary `sig` and applies the signature data to the signature
|
||
// dictionary Contents field.
|
||
Sign (_addab *PdfSignature ,_gdbgf Hasher )error ;};
|
||
|
||
// ImageToRGB returns an error since an image cannot be defined in a pattern colorspace.
|
||
func (_ebdba *PdfColorspaceSpecialPattern )ImageToRGB (img Image )(Image ,error ){_aa .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u003a\u0020\u0049\u006d\u0061\u0067\u0065\u0020\u0063\u0061n\u006e\u006f\u0074\u0020\u0062\u0065\u0020\u0073\u0070\u0065\u0063\u0069\u0066i\u0065\u0064\u0020\u0069\u006e\u0020\u0050\u0061\u0074\u0074\u0065\u0072n \u0063\u006f\u006c\u006f\u0072\u0073\u0070\u0061\u0063\u0065");
|
||
return img ,_ce .New ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0063\u006f\u006c\u006f\u0072\u0073\u0070\u0061\u0063\u0065\u0020\u0066\u006f\u0072\u0020\u0069m\u0061\u0067\u0065\u0020\u0028p\u0061\u0074t\u0065\u0072\u006e\u0029");};
|
||
|
||
// ColorFromFloats returns a new PdfColor based on input color components.
|
||
func (_ffaed *PdfColorspaceDeviceN )ColorFromFloats (vals []float64 )(PdfColor ,error ){if len (vals )!=_ffaed .GetNumComponents (){return nil ,_ce .New ("r\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b");};_gfaed ,_ecdag :=_ffaed .TintTransform .Evaluate (vals );
|
||
if _ecdag !=nil {return nil ,_ecdag ;};_adabe ,_ecdag :=_ffaed .AlternateSpace .ColorFromFloats (_gfaed );if _ecdag !=nil {return nil ,_ecdag ;};return _adabe ,nil ;};var ImageHandling ImageHandler =DefaultImageHandler {};
|
||
|
||
// ToPdfObject converts the font to a PDF representation.
|
||
func (_dgba *pdfFontType0 )ToPdfObject ()_fg .PdfObject {if _dgba ._cgacd ==nil {_dgba ._cgacd =&_fg .PdfIndirectObject {};};_beee :=_dgba .baseFields ().asPdfObjectDictionary ("\u0054\u0079\u0070e\u0030");_dgba ._cgacd .PdfObject =_beee ;if _dgba .Encoding !=nil {_beee .Set ("\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067",_dgba .Encoding );
|
||
}else if _dgba ._bcacf !=nil {_beee .Set ("\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067",_dgba ._bcacf .ToPdfObject ());};if _dgba .DescendantFont !=nil {_beee .Set ("\u0044e\u0073c\u0065\u006e\u0064\u0061\u006e\u0074\u0046\u006f\u006e\u0074\u0073",_fg .MakeArray (_dgba .DescendantFont .ToPdfObject ()));
|
||
};return _dgba ._cgacd ;};var _cgdb =map[string ]struct{}{"\u0057i\u006eA\u006e\u0073\u0069\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067":{},"\u004d\u0061c\u0052\u006f\u006da\u006e\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067":{},"\u004d\u0061\u0063\u0045\u0078\u0070\u0065\u0072\u0074\u0045\u006e\u0063o\u0064\u0069\u006e\u0067":{},"\u0053\u0074a\u006e\u0064\u0061r\u0064\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067":{}};
|
||
|
||
|
||
// PdfAnnotationProjection represents Projection annotations.
|
||
type PdfAnnotationProjection struct{*PdfAnnotation ;*PdfAnnotationMarkup ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_acba *PdfAnnotationStrikeOut )ToPdfObject ()_fg .PdfObject {_acba .PdfAnnotation .ToPdfObject ();_agba :=_acba ._agb ;_cdad :=_agba .PdfObject .(*_fg .PdfObjectDictionary );_acba .PdfAnnotationMarkup .appendToPdfDictionary (_cdad );_cdad .SetIfNotNil ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u0053t\u0072\u0069\u006b\u0065\u004f\u0075t"));
|
||
_cdad .SetIfNotNil ("\u0051\u0075\u0061\u0064\u0050\u006f\u0069\u006e\u0074\u0073",_acba .QuadPoints );return _agba ;};
|
||
|
||
// SignatureHandlerDocMDPParams describe the specific parameters for the SignatureHandlerEx
|
||
// These parameters describe how to check the difference between revisions.
|
||
// Revisions of the document get from the PdfParser.
|
||
type SignatureHandlerDocMDPParams struct{Parser *_fg .PdfParser ;DiffPolicy _gbb .DiffPolicy ;};const (BorderStyleSolid BorderStyle =iota ;BorderStyleDashed BorderStyle =iota ;BorderStyleBeveled BorderStyle =iota ;BorderStyleInset BorderStyle =iota ;BorderStyleUnderline BorderStyle =iota ;
|
||
);
|
||
|
||
// String returns the name of the colorspace (DeviceN).
|
||
func (_acad *PdfColorspaceDeviceN )String ()string {return "\u0044e\u0076\u0069\u0063\u0065\u004e"};
|
||
|
||
// PdfColorPatternType3 represents a color shading pattern type 3 (Radial).
|
||
type PdfColorPatternType3 struct{Color PdfColor ;PatternName _fg .PdfObjectName ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_bggf *PdfAnnotationSquiggly )ToPdfObject ()_fg .PdfObject {_bggf .PdfAnnotation .ToPdfObject ();_eeae :=_bggf ._agb ;_bdde :=_eeae .PdfObject .(*_fg .PdfObjectDictionary );_bggf .PdfAnnotationMarkup .appendToPdfDictionary (_bdde );_bdde .SetIfNotNil ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u0053\u0071\u0075\u0069\u0067\u0067\u006c\u0079"));
|
||
_bdde .SetIfNotNil ("\u0051\u0075\u0061\u0064\u0050\u006f\u0069\u006e\u0074\u0073",_bggf .QuadPoints );return _eeae ;};
|
||
|
||
// GetColorspaces loads PdfPageResourcesColorspaces from `r.ColorSpace` and returns an error if there
|
||
// is a problem loading. Once loaded, the same object is returned on multiple calls.
|
||
func (_fafbe *PdfPageResources )GetColorspaces ()(*PdfPageResourcesColorspaces ,error ){if _fafbe ._edbg !=nil {return _fafbe ._edbg ,nil ;};if _fafbe .ColorSpace ==nil {return nil ,nil ;};_efec ,_ffeae :=_afga (_fafbe .ColorSpace );if _ffeae !=nil {return nil ,_ffeae ;
|
||
};_fafbe ._edbg =_efec ;return _fafbe ._edbg ,nil ;};
|
||
|
||
// RepairAcroForm attempts to rebuild the AcroForm fields using the widget
|
||
// annotations present in the document pages. Pass nil for the opts parameter
|
||
// in order to use the default options.
|
||
// NOTE: Currently, the opts parameter is declared in order to enable adding
|
||
// future options, but passing nil will always result in the default options
|
||
// being used.
|
||
func (_fbgeb *PdfReader )RepairAcroForm (opts *AcroFormRepairOptions )error {var _gfabe []*PdfField ;_gbgad :=map[*_fg .PdfIndirectObject ]struct{}{};for _ ,_fdgf :=range _fbgeb .PageList {_deace ,_bfbd :=_fdgf .GetAnnotations ();if _bfbd !=nil {return _bfbd ;
|
||
};for _ ,_dgdbg :=range _deace {var _aggfb *PdfField ;switch _bdeeab :=_dgdbg .GetContext ().(type ){case *PdfAnnotationWidget :if _bdeeab ._ddcc !=nil {_aggfb =_bdeeab ._ddcc ;break ;};if _ddbaa ,_cdea :=_fg .GetIndirect (_bdeeab .Parent );_cdea {_aggfb ,_bfbd =_fbgeb .newPdfFieldFromIndirectObject (_ddbaa ,nil );
|
||
if _bfbd ==nil {break ;};_aa .Log .Debug ("W\u0041\u0052\u004e\u003a\u0020\u0063\u006f\u0075\u006c\u0064\u0020\u006e\u006f\u0074\u0020\u0070\u0061\u0072s\u0065\u0020\u0066\u006f\u0072\u006d\u0020\u0066\u0069\u0065ld\u0020\u0025\u002bv\u003a \u0025\u0076",_ddbaa ,_bfbd );
|
||
};if _bdeeab ._agb !=nil {_aggfb ,_bfbd =_fbgeb .newPdfFieldFromIndirectObject (_bdeeab ._agb ,nil );if _bfbd ==nil {break ;};_aa .Log .Debug ("W\u0041\u0052\u004e\u003a\u0020\u0063\u006f\u0075\u006c\u0064\u0020\u006e\u006f\u0074\u0020\u0070\u0061\u0072s\u0065\u0020\u0066\u006f\u0072\u006d\u0020\u0066\u0069\u0065ld\u0020\u0025\u002bv\u003a \u0025\u0076",_bdeeab ._agb ,_bfbd );
|
||
};};if _aggfb ==nil {continue ;};if _ ,_cbeec :=_gbgad [_aggfb ._daecc ];_cbeec {continue ;};_gbgad [_aggfb ._daecc ]=struct{}{};_gfabe =append (_gfabe ,_aggfb );};};if len (_gfabe )==0{return nil ;};if _fbgeb .AcroForm ==nil {_fbgeb .AcroForm =NewPdfAcroForm ();
|
||
};_fbgeb .AcroForm .Fields =&_gfabe ;return nil ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_cdgf *PdfAnnotationProjection )ToPdfObject ()_fg .PdfObject {_cdgf .PdfAnnotation .ToPdfObject ();_bfdb :=_cdgf ._agb ;_eafa :=_bfdb .PdfObject .(*_fg .PdfObjectDictionary );_cdgf .PdfAnnotationMarkup .appendToPdfDictionary (_eafa );return _bfdb ;
|
||
};const (_ PdfOutputIntentType =iota ;PdfOutputIntentTypeA1 ;PdfOutputIntentTypeA2 ;PdfOutputIntentTypeA3 ;PdfOutputIntentTypeA4 ;PdfOutputIntentTypeX ;);func (_bbgge *PdfAcroForm )signatureFields ()[]*PdfFieldSignature {var _cgbgb []*PdfFieldSignature ;
|
||
for _ ,_dgbc :=range _bbgge .AllFields (){switch _befg :=_dgbc .GetContext ().(type ){case *PdfFieldSignature :_cffe :=_befg ;_cgbgb =append (_cgbgb ,_cffe );};};return _cgbgb ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_bfad *PdfActionGoToE )ToPdfObject ()_fg .PdfObject {_bfad .PdfAction .ToPdfObject ();_adeb :=_bfad ._bda ;_fb :=_adeb .PdfObject .(*_fg .PdfObjectDictionary );_fb .SetIfNotNil ("\u0053",_fg .MakeName (string (ActionTypeGoToE )));if _bfad .F !=nil {_fb .Set ("\u0046",_bfad .F .ToPdfObject ());
|
||
};_fb .SetIfNotNil ("\u0044",_bfad .D );_fb .SetIfNotNil ("\u004ee\u0077\u0057\u0069\u006e\u0064\u006fw",_bfad .NewWindow );_fb .SetIfNotNil ("\u0054",_bfad .T );return _adeb ;};
|
||
|
||
// Val returns the value of the color.
|
||
func (_cbeda *PdfColorCalGray )Val ()float64 {return float64 (*_cbeda )};
|
||
|
||
// NewPdfAnnotationRedact returns a new redact annotation.
|
||
func NewPdfAnnotationRedact ()*PdfAnnotationRedact {_baf :=NewPdfAnnotation ();_gbbg :=&PdfAnnotationRedact {};_gbbg .PdfAnnotation =_baf ;_gbbg .PdfAnnotationMarkup =&PdfAnnotationMarkup {};_baf .SetContext (_gbbg );return _gbbg ;};
|
||
|
||
// Field returns the parent form field of the widget annotation, if one exists.
|
||
// NOTE: the method returns nil if the parent form field has not been parsed.
|
||
func (_dcb *PdfAnnotationWidget )Field ()*PdfField {return _dcb ._ddcc };
|
||
|
||
// NewPermissions returns a new permissions object.
|
||
func NewPermissions (docMdp *PdfSignature )*Permissions {_adegb :=Permissions {};_adegb .DocMDP =docMdp ;_gaaggc :=_fg .MakeDict ();_gaaggc .Set ("\u0044\u006f\u0063\u004d\u0044\u0050",docMdp .ToPdfObject ());_adegb ._gdfff =_gaaggc ;return &_adegb ;};
|
||
|
||
|
||
// NewPdfAnnotationPrinterMark returns a new printermark annotation.
|
||
func NewPdfAnnotationPrinterMark ()*PdfAnnotationPrinterMark {_eeff :=NewPdfAnnotation ();_afeb :=&PdfAnnotationPrinterMark {};_afeb .PdfAnnotation =_eeff ;_eeff .SetContext (_afeb );return _afeb ;};
|
||
|
||
// NewCustomPdfOutputIntent creates a new custom PdfOutputIntent.
|
||
func NewCustomPdfOutputIntent (outputCondition ,outputConditionIdentifier ,info string ,destOutputProfile []byte ,colorComponents int )*PdfOutputIntent {return &PdfOutputIntent {Type :"\u004f\u0075\u0074p\u0075\u0074\u0049\u006e\u0074\u0065\u006e\u0074",OutputCondition :outputCondition ,OutputConditionIdentifier :outputConditionIdentifier ,Info :info ,DestOutputProfile :destOutputProfile ,_geaa :_fg .MakeDict (),ColorComponents :colorComponents };
|
||
};
|
||
|
||
// NewCompliancePdfReader creates a PdfReader or an input io.ReadSeeker that during reading will scan the files for the
|
||
// metadata details. It could be used for the PDF standard implementations like PDF/A or PDF/X.
|
||
// NOTE: This implementation is in experimental development state.
|
||
// Keep in mind that it might change in the subsequent minor versions.
|
||
func NewCompliancePdfReader (rs _ff .ReadSeeker )(*CompliancePdfReader ,error ){const _dbce ="\u006d\u006f\u0064\u0065l\u003a\u004e\u0065\u0077\u0043\u006f\u006d\u0070\u006c\u0069a\u006ec\u0065\u0050\u0064\u0066\u0052\u0065\u0061d\u0065\u0072";_cgbb ,_eefb :=_bgdaf (rs ,&ReaderOpts {ComplianceMode :true },false ,_dbce );
|
||
if _eefb !=nil {return nil ,_eefb ;};return &CompliancePdfReader {PdfReader :_cgbb },nil ;};
|
||
|
||
// ImageToRGB converts an image with samples in Separation CS to an image with samples specified in
|
||
// DeviceRGB CS.
|
||
func (_fbfc *PdfColorspaceSpecialSeparation )ImageToRGB (img Image )(Image ,error ){_dfdf :=_ade .NewReader (img .getBase ());_aeba :=_cc .NewImageBase (int (img .Width ),int (img .Height ),int (img .BitsPerComponent ),_fbfc .AlternateSpace .GetNumComponents (),nil ,img ._gccd ,nil );
|
||
_decd :=_ade .NewWriter (_aeba );_egdba :=_ef .Pow (2,float64 (img .BitsPerComponent ))-1;_aa .Log .Trace ("\u0053\u0065\u0070a\u0072\u0061\u0074\u0069\u006f\u006e\u0020\u0063\u006f\u006c\u006f\u0072\u0020\u0073\u0070\u0061\u0063\u0065\u0020\u002d\u003e\u0020\u0054\u006f\u0052\u0047\u0042\u0020\u0063o\u006e\u0076\u0065\u0072\u0073\u0069\u006f\u006e");
|
||
_aa .Log .Trace ("\u0054i\u006et\u0054\u0072\u0061\u006e\u0073f\u006f\u0072m\u003a\u0020\u0025\u002b\u0076",_fbfc .TintTransform );_deadd :=_fbfc .AlternateSpace .DecodeArray ();var (_fegf uint32 ;_gfaf error ;);for {_fegf ,_gfaf =_dfdf .ReadSample ();
|
||
if _gfaf ==_ff .EOF {break ;};if _gfaf !=nil {return img ,_gfaf ;};_bgdbb :=float64 (_fegf )/_egdba ;_fbac ,_eeafb :=_fbfc .TintTransform .Evaluate ([]float64 {_bgdbb });if _eeafb !=nil {return img ,_eeafb ;};for _adgg ,_gbfb :=range _fbac {_aggfe :=_cc .LinearInterpolate (_gbfb ,_deadd [_adgg *2],_deadd [_adgg *2+1],0,1);
|
||
if _eeafb =_decd .WriteSample (uint32 (_aggfe *_egdba ));_eeafb !=nil {return img ,_eeafb ;};};};return _fbfc .AlternateSpace .ImageToRGB (_adad (&_aeba ));};
|
||
|
||
// GetMediaBox gets the inheritable media box value, either from the page
|
||
// or a higher up page/pages struct.
|
||
func (_ceddd *PdfPage )GetMediaBox ()(*PdfRectangle ,error ){if _ceddd .MediaBox !=nil {return _ceddd .MediaBox ,nil ;};_abdcc :=_ceddd .Parent ;for _abdcc !=nil {_cddda ,_aece :=_fg .GetDict (_abdcc );if !_aece {return nil ,_ce .New ("\u0069\u006e\u0076\u0061\u006c\u0069d\u0020\u0070\u0061\u0072\u0065\u006e\u0074\u0020\u006f\u0062\u006a\u0065\u0063t\u0073\u0020\u0064\u0069\u0063\u0074\u0069o\u006e\u0061\u0072\u0079");
|
||
};if _bbbfb :=_cddda .Get ("\u004d\u0065\u0064\u0069\u0061\u0042\u006f\u0078");_bbbfb !=nil {_gbfg ,_gcee :=_fg .GetArray (_bbbfb );if !_gcee {return nil ,_ce .New ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u006d\u0065\u0064\u0069a\u0020\u0062\u006f\u0078");
|
||
};_beaa ,_efdag :=NewPdfRectangle (*_gbfg );if _efdag !=nil {return nil ,_efdag ;};return _beaa ,nil ;};_abdcc =_cddda .Get ("\u0050\u0061\u0072\u0065\u006e\u0074");};return nil ,_ce .New ("m\u0065\u0064\u0069\u0061 b\u006fx\u0020\u006e\u006f\u0074\u0020d\u0065\u0066\u0069\u006e\u0065\u0064");
|
||
};
|
||
|
||
// NewPdfAnnotationFileAttachment returns a new file attachment annotation.
|
||
func NewPdfAnnotationFileAttachment ()*PdfAnnotationFileAttachment {_efb :=NewPdfAnnotation ();_bdge :=&PdfAnnotationFileAttachment {};_bdge .PdfAnnotation =_efb ;_bdge .PdfAnnotationMarkup =&PdfAnnotationMarkup {};_efb .SetContext (_bdge );return _bdge ;
|
||
};func _fcagf (_dbed *XObjectForm )(*PdfRectangle ,error ){if _facd ,_cfaac :=_dbed .BBox .(*_fg .PdfObjectArray );_cfaac {_cdae ,_dbde :=NewPdfRectangle (*_facd );if _dbde !=nil {return nil ,_dbde ;};if _bbbe ,_bcbae :=_dbed .Matrix .(*_fg .PdfObjectArray );
|
||
_bcbae {_beae ,_fegad :=_bbbe .ToFloat64Array ();if _fegad !=nil {return nil ,_fegad ;};_fded :=_gbe .IdentityMatrix ();if len (_beae )==6{_fded =_gbe .NewMatrix (_beae [0],_beae [1],_beae [2],_beae [3],_beae [4],_beae [5]);};_cdae .Transform (_fded );
|
||
return _cdae ,nil ;};};return nil ,_ce .New ("\u0069\u006e\u0076\u0061l\u0069\u0064\u0020\u0061\u0070\u0070\u0065\u0061\u0072\u0061n\u0063e\u0020\u0042\u0042\u006f\u0078\u0020\u0074y\u0070\u0065");};func _bgdaf (_cegcc _ff .ReadSeeker ,_bcge *ReaderOpts ,_dbddd bool ,_ebdbg string )(*PdfReader ,error ){if _bcge ==nil {_bcge =NewReaderOpts ();
|
||
};_aebcd :=*_bcge ;_bdecb :=&PdfReader {_daega :_cegcc ,_aefbbf :map[_fg .PdfObject ]struct{}{},_edebb :_aafff (),_beegg :_bcge .LazyLoad ,_gfdd :_bcge .ComplianceMode ,_ecgf :_dbddd ,_aegc :&_aebcd };_afcg ,_geagc :=_gfacd ("\u0072");if _geagc !=nil {return nil ,_geagc ;
|
||
};_geagc =_bec .Track (_afcg ,_ebdbg );if _geagc !=nil {return nil ,_geagc ;};_bdecb ._cecbe =_afcg ;var _effcc *_fg .PdfParser ;if !_bdecb ._gfdd {_effcc ,_geagc =_fg .NewParser (_cegcc );}else {_effcc ,_geagc =_fg .NewCompliancePdfParser (_cegcc );};
|
||
if _geagc !=nil {return nil ,_geagc ;};_bdecb ._ccgg =_effcc ;_ddfad ,_geagc :=_bdecb .IsEncrypted ();if _geagc !=nil {return nil ,_geagc ;};if !_ddfad {_geagc =_bdecb .loadStructure ();if _geagc !=nil {return nil ,_geagc ;};}else if _dbddd {_bfdfe ,_faggc :=_bdecb .Decrypt ([]byte (_bcge .Password ));
|
||
if _faggc !=nil {return nil ,_faggc ;};if !_bfdfe {return nil ,_ce .New ("\u0055\u006e\u0061\u0062\u006c\u0065\u0020\u0074\u006f \u0064\u0065c\u0072\u0079\u0070\u0074\u0020\u0070\u0061\u0073\u0073w\u006f\u0072\u0064\u0020p\u0072\u006f\u0074\u0065\u0063\u0074\u0065\u0064\u0020\u0066\u0069\u006c\u0065\u0020\u002d\u0020\u006e\u0065\u0065\u0064\u0020\u0074\u006f\u0020\u0073\u0070\u0065\u0063\u0069\u0066y\u0020\u0070\u0061s\u0073\u0020\u0074\u006f\u0020\u0044\u0065\u0063\u0072\u0079\u0070\u0074");
|
||
};};_bdecb ._cdecg =make (map[*PdfReader ]*PdfReader );_bdecb ._fdbdd =make ([]*PdfReader ,_effcc .GetRevisionNumber ());return _bdecb ,nil ;};func (_ccfa *PdfAppender )updateObjectsDeep (_dade _fg .PdfObject ,_afeea map[_fg .PdfObject ]struct{}){if _afeea ==nil {_afeea =map[_fg .PdfObject ]struct{}{};
|
||
};if _ ,_edag :=_afeea [_dade ];_edag ||_dade ==nil {return ;};_afeea [_dade ]=struct{}{};_dcfc :=_fg .ResolveReferencesDeep (_dade ,_ccfa ._fcca );if _dcfc !=nil {_aa .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_dcfc );};switch _abaa :=_dade .(type ){case *_fg .PdfIndirectObject :switch {case _abaa .GetParser ()==_ccfa ._cbb ._ccgg :return ;
|
||
case _abaa .GetParser ()==_ccfa .Reader ._ccgg :_dafg ,_ :=_ccfa ._cbb .GetIndirectObjectByNumber (int (_abaa .ObjectNumber ));_dbd ,_feee :=_dafg .(*_fg .PdfIndirectObject );if _feee &&_dbd !=nil {if _dbd .PdfObject !=_abaa .PdfObject &&_dbd .PdfObject .WriteString ()!=_abaa .PdfObject .WriteString (){_ccfa .addNewObject (_dade );
|
||
_ccfa ._dcbad [_dade ]=_abaa .ObjectNumber ;};};default:_ccfa .addNewObject (_dade );};_ccfa .updateObjectsDeep (_abaa .PdfObject ,_afeea );case *_fg .PdfObjectArray :for _ ,_gaeg :=range _abaa .Elements (){_ccfa .updateObjectsDeep (_gaeg ,_afeea );};case *_fg .PdfObjectDictionary :for _ ,_baa :=range _abaa .Keys (){_ccfa .updateObjectsDeep (_abaa .Get (_baa ),_afeea );
|
||
};case *_fg .PdfObjectStreams :if _abaa .GetParser ()!=_ccfa ._cbb ._ccgg {for _ ,_agce :=range _abaa .Elements (){_ccfa .updateObjectsDeep (_agce ,_afeea );};};case *_fg .PdfObjectStream :switch {case _abaa .GetParser ()==_ccfa ._cbb ._ccgg :return ;case _abaa .GetParser ()==_ccfa .Reader ._ccgg :if _cdgb ,_bab :=_ccfa ._cbb ._ccgg .LookupByReference (_abaa .PdfObjectReference );
|
||
_bab ==nil {var _gea bool ;if _edaa ,_agaa :=_fg .GetStream (_cdgb );_agaa &&_cb .Equal (_edaa .Stream ,_abaa .Stream ){_gea =true ;};if _feadc ,_gfae :=_fg .GetDict (_cdgb );_gea &&_gfae {_gea =_feadc .WriteString ()==_abaa .PdfObjectDictionary .WriteString ();
|
||
};if _gea {return ;};};if _abaa .ObjectNumber !=0{_ccfa ._dcbad [_dade ]=_abaa .ObjectNumber ;};default:if _ ,_fegc :=_ccfa ._aec [_dade ];!_fegc {_ccfa .addNewObject (_dade );};};_ccfa .updateObjectsDeep (_abaa .PdfObjectDictionary ,_afeea );};};
|
||
|
||
// FlattenFields flattens the form fields and annotations for the PDF loaded in `pdf` and makes
|
||
// non-editable.
|
||
// Looks up all widget annotations corresponding to form fields and flattens them by drawing the content
|
||
// through the content stream rather than annotations.
|
||
// References to flattened annotations will be removed from Page Annots array. For fields the AcroForm entry
|
||
// will be emptied.
|
||
// When `allannots` is true, all annotations will be flattened. Keep false if want to keep non-form related
|
||
// annotations intact.
|
||
// When `appgen` is not nil, it will be used to generate appearance streams for the field annotations.
|
||
func (_gabd *PdfReader )FlattenFields (allannots bool ,appgen FieldAppearanceGenerator )error {return _gabd .flattenFieldsWithOpts (allannots ,appgen ,nil );};func _gace (_cbcbg *_fg .PdfObjectDictionary ){_edgc ,_eaaa :=_fg .GetArray (_cbcbg .Get ("\u0057\u0069\u0064\u0074\u0068\u0073"));
|
||
_cbbb ,_effff :=_fg .GetIntVal (_cbcbg .Get ("\u0046i\u0072\u0073\u0074\u0043\u0068\u0061r"));_deee ,_gcabc :=_fg .GetIntVal (_cbcbg .Get ("\u004c\u0061\u0073\u0074\u0043\u0068\u0061\u0072"));if _eaaa &&_effff &&_gcabc {_daebe :=_edgc .Len ();if _daebe !=_deee -_cbbb +1{_aa .Log .Debug ("\u0055\u006e\u0065x\u0070\u0065\u0063\u0074\u0065\u0064\u0020\u0057\u0069\u0064\u0074\u0068\u0073\u0020\u006c\u0065\u006e\u0067\u0074\u0068\u003a\u0020\u0025\u0076\u002c\u0020\u004c\u0061\u0073t\u0043\u0068\u0061\u0072\u003a\u0020\u0025\u0076",_daebe ,_deee );
|
||
_bafd :=_fg .PdfObjectInteger (_cbbb +_daebe -1);_cbcbg .Set ("\u004c\u0061\u0073\u0074\u0043\u0068\u0061\u0072",&_bafd );};};};
|
||
|
||
// NewStandardPdfOutputIntent creates a new standard PdfOutputIntent.
|
||
func NewStandardPdfOutputIntent (outputCondition ,outputConditionIdentifier ,registryName string ,destOutputProfile []byte ,colorComponents int )*PdfOutputIntent {return &PdfOutputIntent {Type :"\u004f\u0075\u0074p\u0075\u0074\u0049\u006e\u0074\u0065\u006e\u0074",OutputCondition :outputCondition ,OutputConditionIdentifier :outputConditionIdentifier ,RegistryName :registryName ,DestOutputProfile :destOutputProfile ,ColorComponents :colorComponents ,_geaa :_fg .MakeDict ()};
|
||
};
|
||
|
||
// ToPdfObject returns the PDF representation of the DSS dictionary.
|
||
func (_gddc *DSS )ToPdfObject ()_fg .PdfObject {_cfgea :=_gddc ._gbaf .PdfObject .(*_fg .PdfObjectDictionary );_cfgea .Clear ();_gega :=_fg .MakeDict ();for _gaff ,_ffdf :=range _gddc .VRI {_gega .Set (*_fg .MakeName (_gaff ),_ffdf .ToPdfObject ());};_cfgea .SetIfNotNil ("\u0043\u0065\u0072t\u0073",_aedef (_gddc .Certs ));
|
||
_cfgea .SetIfNotNil ("\u004f\u0043\u0053P\u0073",_aedef (_gddc .OCSPs ));_cfgea .SetIfNotNil ("\u0043\u0052\u004c\u0073",_aedef (_gddc .CRLs ));_cfgea .Set ("\u0056\u0052\u0049",_gega );return _gddc ._gbaf ;};
|
||
|
||
// NewPdfAnnotationLine returns a new line annotation.
|
||
func NewPdfAnnotationLine ()*PdfAnnotationLine {_ecda :=NewPdfAnnotation ();_cbf :=&PdfAnnotationLine {};_cbf .PdfAnnotation =_ecda ;_cbf .PdfAnnotationMarkup =&PdfAnnotationMarkup {};_ecda .SetContext (_cbf );return _cbf ;};
|
||
|
||
// PdfColorspaceDeviceRGB represents an RGB colorspace.
|
||
type PdfColorspaceDeviceRGB struct{};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_eca *PdfActionLaunch )ToPdfObject ()_fg .PdfObject {_eca .PdfAction .ToPdfObject ();_eeb :=_eca ._bda ;_bbf :=_eeb .PdfObject .(*_fg .PdfObjectDictionary );_bbf .SetIfNotNil ("\u0053",_fg .MakeName (string (ActionTypeLaunch )));if _eca .F !=nil {_bbf .Set ("\u0046",_eca .F .ToPdfObject ());
|
||
};_bbf .SetIfNotNil ("\u0057\u0069\u006e",_eca .Win );_bbf .SetIfNotNil ("\u004d\u0061\u0063",_eca .Mac );_bbf .SetIfNotNil ("\u0055\u006e\u0069\u0078",_eca .Unix );_bbf .SetIfNotNil ("\u004ee\u0077\u0057\u0069\u006e\u0064\u006fw",_eca .NewWindow );return _eeb ;
|
||
};
|
||
|
||
// NewPdfActionMovie returns a new "movie" action.
|
||
func NewPdfActionMovie ()*PdfActionMovie {_gge :=NewPdfAction ();_geec :=&PdfActionMovie {};_geec .PdfAction =_gge ;_gge .SetContext (_geec );return _geec ;};
|
||
|
||
// NewPdfActionJavaScript returns a new "javaScript" action.
|
||
func NewPdfActionJavaScript ()*PdfActionJavaScript {_cdg :=NewPdfAction ();_ae :=&PdfActionJavaScript {};_ae .PdfAction =_cdg ;_cdg .SetContext (_ae );return _ae ;};
|
||
|
||
// GenerateHashMaps generates DSS hashmaps for Certificates, OCSPs and CRLs to make sure they are unique.
|
||
func (_ecegg *DSS )GenerateHashMaps ()error {_ccdfcf ,_eabed :=_ecegg .generateHashMap (_ecegg .Certs );if _eabed !=nil {return _eabed ;};_gfdb ,_eabed :=_ecegg .generateHashMap (_ecegg .OCSPs );if _eabed !=nil {return _eabed ;};_gggeg ,_eabed :=_ecegg .generateHashMap (_ecegg .CRLs );
|
||
if _eabed !=nil {return _eabed ;};_ecegg ._aacde =_ccdfcf ;_ecegg ._cgbbd =_gfdb ;_ecegg ._fdcc =_gggeg ;return nil ;};
|
||
|
||
// IsSimple returns true if `font` is a simple font.
|
||
func (_deecf *PdfFont )IsSimple ()bool {_ ,_aabba :=_deecf ._gcaeff .(*pdfFontSimple );return _aabba };
|
||
|
||
// Items returns all children outline items.
|
||
func (_gadcdd *OutlineItem )Items ()[]*OutlineItem {return _gadcdd .Entries };
|
||
|
||
// AddCerts adds certificates to DSS.
|
||
func (_facc *DSS )AddCerts (certs [][]byte )([]*_fg .PdfObjectStream ,error ){return _facc .add (&_facc .Certs ,_facc ._aacde ,certs );};
|
||
|
||
// PdfShadingType2 is an Axial shading.
|
||
type PdfShadingType2 struct{*PdfShading ;Coords *_fg .PdfObjectArray ;Domain *_fg .PdfObjectArray ;Function []PdfFunction ;Extend *_fg .PdfObjectArray ;};
|
||
|
||
// ColorFromPdfObjects returns a new PdfColor based on the input slice of color
|
||
// components. The slice should contain a single PdfObjectFloat element in
|
||
// range 0-1.
|
||
func (_feeb *PdfColorspaceDeviceGray )ColorFromPdfObjects (objects []_fg .PdfObject )(PdfColor ,error ){if len (objects )!=1{return nil ,_ce .New ("r\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b");};_babb ,_cgaa :=_fg .GetNumbersAsFloat (objects );
|
||
if _cgaa !=nil {return nil ,_cgaa ;};return _feeb .ColorFromFloats (_babb );};
|
||
|
||
// ToPdfObject returns the PDF representation of the shading dictionary.
|
||
func (_dcag *PdfShading )ToPdfObject ()_fg .PdfObject {_aecab :=_dcag ._cbabf ;_geebd ,_cdcad :=_dcag .getShadingDict ();if _cdcad !=nil {_aa .Log .Error ("\u0055\u006ea\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0061\u0063\u0063\u0065\u0073\u0073\u0020\u0073\u0068\u0061\u0064\u0069\u006e\u0067\u0020di\u0063\u0074");
|
||
return nil ;};if _dcag .ShadingType !=nil {_geebd .Set ("S\u0068\u0061\u0064\u0069\u006e\u0067\u0054\u0079\u0070\u0065",_dcag .ShadingType );};if _dcag .ColorSpace !=nil {_geebd .Set ("\u0043\u006f\u006c\u006f\u0072\u0053\u0070\u0061\u0063\u0065",_dcag .ColorSpace .ToPdfObject ());
|
||
};if _dcag .Background !=nil {_geebd .Set ("\u0042\u0061\u0063\u006b\u0067\u0072\u006f\u0075\u006e\u0064",_dcag .Background );};if _dcag .BBox !=nil {_geebd .Set ("\u0042\u0042\u006f\u0078",_dcag .BBox .ToPdfObject ());};if _dcag .AntiAlias !=nil {_geebd .Set ("\u0041n\u0074\u0069\u0041\u006c\u0069\u0061s",_dcag .AntiAlias );
|
||
};return _aecab ;};func (_dfddc SignatureValidationResult )String ()string {var _ceacc _cb .Buffer ;_ceacc .WriteString (_d .Sprintf ("\u004ea\u006d\u0065\u003a\u0020\u0025\u0073\n",_dfddc .Name ));if _dfddc .Date ._fddef > 0{_ceacc .WriteString (_d .Sprintf ("\u0044a\u0074\u0065\u003a\u0020\u0025\u0073\n",_dfddc .Date .ToGoTime ().String ()));
|
||
}else {_ceacc .WriteString ("\u0044\u0061\u0074\u0065 n\u006f\u0074\u0020\u0073\u0070\u0065\u0063\u0069\u0066\u0069\u0065\u0064\u000a");};if len (_dfddc .Reason )> 0{_ceacc .WriteString (_d .Sprintf ("R\u0065\u0061\u0073\u006f\u006e\u003a\u0020\u0025\u0073\u000a",_dfddc .Reason ));
|
||
}else {_ceacc .WriteString ("N\u006f \u0072\u0065\u0061\u0073\u006f\u006e\u0020\u0073p\u0065\u0063\u0069\u0066ie\u0064\u000a");};if len (_dfddc .Location )> 0{_ceacc .WriteString (_d .Sprintf ("\u004c\u006f\u0063\u0061\u0074\u0069\u006f\u006e\u003a\u0020\u0025\u0073\u000a",_dfddc .Location ));
|
||
}else {_ceacc .WriteString ("\u004c\u006f\u0063at\u0069\u006f\u006e\u0020\u006e\u006f\u0074\u0020\u0073\u0070\u0065\u0063\u0069\u0066\u0069\u0065\u0064\u000a");};if len (_dfddc .ContactInfo )> 0{_ceacc .WriteString (_d .Sprintf ("\u0043\u006f\u006e\u0074\u0061\u0063\u0074\u0020\u0049\u006e\u0066\u006f:\u0020\u0025\u0073\u000a",_dfddc .ContactInfo ));
|
||
}else {_ceacc .WriteString ("C\u006f\u006e\u0074\u0061\u0063\u0074 \u0069\u006e\u0066\u006f\u0020\u006e\u006f\u0074\u0020s\u0070\u0065\u0063i\u0066i\u0065\u0064\u000a");};_ceacc .WriteString (_d .Sprintf ("F\u0069\u0065\u006c\u0064\u0073\u003a\u0020\u0025\u0064\u000a",len (_dfddc .Fields )));
|
||
if _dfddc .IsSigned {_ceacc .WriteString ("S\u0069\u0067\u006e\u0065\u0064\u003a \u0044\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u0020i\u0073\u0020\u0073i\u0067n\u0065\u0064\u000a");}else {_ceacc .WriteString ("\u0053\u0069\u0067\u006eed\u003a\u0020\u004e\u006f\u0074\u0020\u0073\u0069\u0067\u006e\u0065\u0064\u000a");
|
||
};if _dfddc .IsVerified {_ceacc .WriteString ("\u0053\u0069\u0067n\u0061\u0074\u0075\u0072e\u0020\u0076\u0061\u006c\u0069\u0064\u0061t\u0069\u006f\u006e\u003a\u0020\u0049\u0073\u0020\u0076\u0061\u006c\u0069\u0064\u000a");}else {_ceacc .WriteString ("\u0053\u0069\u0067\u006e\u0061\u0074u\u0072\u0065\u0020\u0076\u0061\u006c\u0069\u0064\u0061\u0074\u0069\u006f\u006e:\u0020\u0049\u0073\u0020\u0069\u006e\u0076a\u006c\u0069\u0064\u000a");
|
||
};if _dfddc .IsTrusted {_ceacc .WriteString ("\u0054\u0072\u0075\u0073\u0074\u0065\u0064\u003a\u0020\u0043\u0065\u0072\u0074\u0069\u0066i\u0063a\u0074\u0065\u0020\u0069\u0073\u0020\u0074\u0072\u0075\u0073\u0074\u0065\u0064\u000a");}else {_ceacc .WriteString ("\u0054\u0072\u0075s\u0074\u0065\u0064\u003a \u0055\u006e\u0074\u0072\u0075\u0073\u0074e\u0064\u0020\u0063\u0065\u0072\u0074\u0069\u0066\u0069\u0063\u0061\u0074\u0065\u000a");
|
||
};if !_dfddc .GeneralizedTime .IsZero (){_ceacc .WriteString (_d .Sprintf ("G\u0065n\u0065\u0072\u0061\u006c\u0069\u007a\u0065\u0064T\u0069\u006d\u0065\u003a %\u0073\u000a",_dfddc .GeneralizedTime .String ()));};if _dfddc .DiffResults !=nil {_ceacc .WriteString (_d .Sprintf ("\u0064\u0069\u0066\u0066 i\u0073\u0020\u0070\u0065\u0072\u006d\u0069\u0074\u0074\u0065\u0064\u003a\u0020\u0025v\u000a",_dfddc .DiffResults .IsPermitted ()));
|
||
if len (_dfddc .DiffResults .Warnings )> 0{_ceacc .WriteString ("\u004d\u0044\u0050\u0020\u0077\u0061\u0072\u006e\u0069n\u0067\u0073\u003a\u000a");for _ ,_bgefa :=range _dfddc .DiffResults .Warnings {_ceacc .WriteString (_d .Sprintf ("\u0009\u0025\u0073\u000a",_bgefa ));
|
||
};};if len (_dfddc .DiffResults .Errors )> 0{_ceacc .WriteString ("\u004d\u0044\u0050 \u0065\u0072\u0072\u006f\u0072\u0073\u003a\u000a");for _ ,_eedee :=range _dfddc .DiffResults .Errors {_ceacc .WriteString (_d .Sprintf ("\u0009\u0025\u0073\u000a",_eedee ));
|
||
};};};if _dfddc .IsCrlFound {_ceacc .WriteString ("R\u0065\u0076\u006f\u0063\u0061\u0074i\u006f\u006e\u0020\u0064\u0061\u0074\u0061\u003a\u0020C\u0052\u004c\u0020f\u006fu\u006e\u0064\u000a");}else {_ceacc .WriteString ("\u0052\u0065\u0076o\u0063\u0061\u0074\u0069o\u006e\u0020\u0064\u0061\u0074\u0061\u003a \u0043\u0052\u004c\u0020\u006e\u006f\u0074\u0020\u0066\u006f\u0075\u006e\u0064\u000a");
|
||
};if _dfddc .IsOcspFound {_ceacc .WriteString ("\u0052\u0065\u0076\u006fc\u0061\u0074\u0069\u006f\u006e\u0020\u0064\u0061\u0074\u0061:\u0020O\u0043\u0053\u0050\u0020\u0066\u006f\u0075n\u0064\u000a");}else {_ceacc .WriteString ("\u0052\u0065\u0076\u006f\u0063\u0061\u0074\u0069\u006f\u006e\u0020\u0064\u0061\u0074\u0061:\u0020O\u0043\u0053\u0050\u0020\u006e\u006f\u0074\u0020\u0066\u006f\u0075\u006e\u0064\u000a");
|
||
};return _ceacc .String ();};type pdfFontType3 struct{fontCommon ;_bdfc *_fg .PdfIndirectObject ;
|
||
|
||
// These fields are specific to Type 3 fonts.
|
||
CharProcs _fg .PdfObject ;Encoding _fg .PdfObject ;FontBBox _fg .PdfObject ;FontMatrix _fg .PdfObject ;FirstChar _fg .PdfObject ;LastChar _fg .PdfObject ;Widths _fg .PdfObject ;Resources _fg .PdfObject ;_eabbc map[_dg .CharCode ]float64 ;_efad _dg .TextEncoder ;
|
||
};const (ButtonTypeCheckbox ButtonType =iota ;ButtonTypePush ButtonType =iota ;ButtonTypeRadio ButtonType =iota ;);
|
||
|
||
// NewPdfOutline returns an initialized PdfOutline.
|
||
func NewPdfOutline ()*PdfOutline {_egcc :=&PdfOutline {_adece :_fg .MakeIndirectObject (_fg .MakeDict ())};_egcc ._gfcge =_egcc ;return _egcc ;};
|
||
|
||
// GetContainingPdfObject returns the container of the outline (indirect object).
|
||
func (_gdeaec *PdfOutline )GetContainingPdfObject ()_fg .PdfObject {return _gdeaec ._adece };
|
||
|
||
// AcroFormRepairOptions contains options for rebuilding the AcroForm.
|
||
type AcroFormRepairOptions struct{};
|
||
|
||
// GetBorderWidth returns the border style's width.
|
||
func (_fecf *PdfBorderStyle )GetBorderWidth ()float64 {if _fecf .W ==nil {return 1;};return *_fecf .W ;};
|
||
|
||
// ColorFromPdfObjects returns a new PdfColor based on input color components. The input PdfObjects should
|
||
// be numeric.
|
||
func (_dfcb *PdfColorspaceDeviceN )ColorFromPdfObjects (objects []_fg .PdfObject )(PdfColor ,error ){if len (objects )!=_dfcb .GetNumComponents (){return nil ,_ce .New ("r\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b");};_aacc ,_fbcg :=_fg .GetNumbersAsFloat (objects );
|
||
if _fbcg !=nil {return nil ,_fbcg ;};return _dfcb .ColorFromFloats (_aacc );};func (_eccbg fontCommon )fontFlags ()int {if _eccbg ._cdgef ==nil {return 0;};return _eccbg ._cdgef ._gbeff ;};
|
||
|
||
// GetContainingPdfObject returns the container of the outline tree node (indirect object).
|
||
func (_efbc *PdfOutlineTreeNode )GetContainingPdfObject ()_fg .PdfObject {return _efbc .GetContext ().GetContainingPdfObject ();};
|
||
|
||
// NewPdfFilespec returns an initialized generic PDF filespec model.
|
||
func NewPdfFilespec ()*PdfFilespec {_ccaf :=&PdfFilespec {};_ccaf ._ccbdc =_fg .MakeIndirectObject (_fg .MakeDict ());return _ccaf ;};func (_fda *PdfReader )newPdfActionGotoFromDict (_bgfab *_fg .PdfObjectDictionary )(*PdfActionGoTo ,error ){return &PdfActionGoTo {D :_bgfab .Get ("\u0044")},nil ;
|
||
};
|
||
|
||
// PdfAnnotationWidget represents Widget annotations.
|
||
// Note: Widget annotations are used to display form fields.
|
||
// (Section 12.5.6.19).
|
||
type PdfAnnotationWidget struct{*PdfAnnotation ;H _fg .PdfObject ;MK _fg .PdfObject ;A _fg .PdfObject ;AA _fg .PdfObject ;BS _fg .PdfObject ;Parent _fg .PdfObject ;_ddcc *PdfField ;_db bool ;};
|
||
|
||
// DecodeArray returns the range of color component values in the ICCBased colorspace.
|
||
func (_cgec *PdfColorspaceICCBased )DecodeArray ()[]float64 {return _cgec .Range };func _gecd (_cdcc *_fg .PdfObjectDictionary )bool {for _ ,_fgeb :=range _cdcc .Keys (){if _ ,_aefe :=_beab [_fgeb .String ()];_aefe {return true ;};};return false ;};
|
||
|
||
// GetFontByName gets the font specified by keyName. Returns the PdfObject which
|
||
// the entry refers to. Returns a bool value indicating whether or not the entry was found.
|
||
func (_cefef *PdfPageResources )GetFontByName (keyName _fg .PdfObjectName )(_fg .PdfObject ,bool ){if _cefef .Font ==nil {return nil ,false ;};_dfbeb ,_cbfba :=_fg .TraceToDirectObject (_cefef .Font ).(*_fg .PdfObjectDictionary );if !_cbfba {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0046\u006f\u006e\u0074\u0020\u006e\u006f\u0074\u0020\u0061\u0020\u0064\u0069\u0063\u0074\u0069\u006fn\u0061\u0072\u0079\u0021\u0020(\u0067\u006ft\u0020\u0025\u0054\u0029",_fg .TraceToDirectObject (_cefef .Font ));
|
||
return nil ,false ;};if _cbgcg :=_dfbeb .Get (keyName );_cbgcg !=nil {return _cbgcg ,true ;};return nil ,false ;};
|
||
|
||
// ImageToRGB converts ICCBased colorspace image to RGB and returns the result.
|
||
func (_gdddd *PdfColorspaceICCBased )ImageToRGB (img Image )(Image ,error ){if _gdddd .Alternate ==nil {_aa .Log .Debug ("I\u0043\u0043\u0020\u0042\u0061\u0073\u0065\u0064\u0020\u0063\u006f\u006c\u006f\u0072\u0073\u0070\u0061\u0063e\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0061lt\u0065\u0072\u006ea\u0074i\u0076\u0065");
|
||
if _gdddd .N ==1{_aa .Log .Debug ("\u0049\u0043\u0043\u0020\u0042a\u0073\u0065\u0064\u0020\u0063o\u006co\u0072\u0073\u0070\u0061\u0063\u0065\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0061\u006c\u0074\u0065r\u006e\u0061\u0074\u0069\u0076\u0065\u0020\u002d\u0020\u0075\u0073\u0069\u006e\u0067\u0020\u0044\u0065\u0076\u0069\u0063\u0065\u0047\u0072\u0061y\u0020\u0028\u004e\u003d\u0031\u0029");
|
||
_dcegb :=NewPdfColorspaceDeviceGray ();return _dcegb .ImageToRGB (img );}else if _gdddd .N ==3{_aa .Log .Debug ("\u0049\u0043\u0043\u0020\u0042\u0061\u0073\u0065\u0064\u0020\u0063\u006f\u006c\u006f\u0072\u0073\u0070a\u0063\u0065\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067 \u0061\u006c\u0074\u0065\u0072\u006e\u0061\u0074\u0069\u0076\u0065\u0020\u002d\u0020\u0075\u0073\u0069\u006eg\u0020\u0044\u0065\u0076\u0069\u0063e\u0052\u0047B\u0020\u0028N\u003d3\u0029");
|
||
return img ,nil ;}else if _gdddd .N ==4{_aa .Log .Debug ("\u0049\u0043\u0043\u0020\u0042a\u0073\u0065\u0064\u0020\u0063o\u006co\u0072\u0073\u0070\u0061\u0063\u0065\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0061\u006c\u0074\u0065r\u006e\u0061\u0074\u0069\u0076\u0065\u0020\u002d\u0020\u0075\u0073\u0069\u006e\u0067\u0020\u0044\u0065\u0076\u0069\u0063\u0065\u0043\u004d\u0059K\u0020\u0028\u004e\u003d\u0034\u0029");
|
||
_dccgf :=NewPdfColorspaceDeviceCMYK ();return _dccgf .ImageToRGB (img );}else {return img ,_ce .New ("I\u0043\u0043\u0020\u0042\u0061\u0073\u0065\u0064\u0020\u0063\u006f\u006c\u006f\u0072\u0073\u0070\u0061\u0063e\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0061lt\u0065\u0072\u006ea\u0074i\u0076\u0065");
|
||
};};_aa .Log .Trace ("\u0049\u0043\u0043 \u0042\u0061\u0073\u0065\u0064\u0020\u0063\u006f\u006c\u006f\u0072\u0073\u0070\u0061\u0063\u0065\u0020\u0077\u0069\u0074\u0068\u0020\u0061\u006c\u0074\u0065\u0072\u006e\u0061t\u0069\u0076\u0065\u003a\u0020\u0025\u0023\u0076",_gdddd );
|
||
_effe ,_dddce :=_gdddd .Alternate .ImageToRGB (img );_aa .Log .Trace ("I\u0043C\u0020\u0049\u006e\u0070\u0075\u0074\u0020\u0069m\u0061\u0067\u0065\u003a %\u002b\u0076",img );_aa .Log .Trace ("I\u0043\u0043\u0020\u004fut\u0070u\u0074\u0020\u0069\u006d\u0061g\u0065\u003a\u0020\u0025\u002b\u0076",_effe );
|
||
return _effe ,_dddce ;};func (_fgde *PdfReader )newPdfAnnotationPolyLineFromDict (_gdef *_fg .PdfObjectDictionary )(*PdfAnnotationPolyLine ,error ){_aaba :=PdfAnnotationPolyLine {};_egcb ,_ecbb :=_fgde .newPdfAnnotationMarkupFromDict (_gdef );if _ecbb !=nil {return nil ,_ecbb ;
|
||
};_aaba .PdfAnnotationMarkup =_egcb ;_aaba .Vertices =_gdef .Get ("\u0056\u0065\u0072\u0074\u0069\u0063\u0065\u0073");_aaba .LE =_gdef .Get ("\u004c\u0045");_aaba .BS =_gdef .Get ("\u0042\u0053");_aaba .IC =_gdef .Get ("\u0049\u0043");_aaba .BE =_gdef .Get ("\u0042\u0045");
|
||
_aaba .IT =_gdef .Get ("\u0049\u0054");_aaba .Measure =_gdef .Get ("\u004de\u0061\u0073\u0075\u0072\u0065");return &_aaba ,nil ;};func (_dadcg *PdfReader )loadOutlines ()(*PdfOutlineTreeNode ,error ){if _dadcg ._ccgg .GetCrypter ()!=nil &&!_dadcg ._ccgg .IsAuthenticated (){return nil ,_d .Errorf ("\u0066\u0069\u006ce\u0020\u006e\u0065\u0065d\u0020\u0074\u006f\u0020\u0062\u0065\u0020d\u0065\u0063\u0072\u0079\u0070\u0074\u0065\u0064\u0020\u0066\u0069\u0072\u0073\u0074");
|
||
};_ddbcf :=_dadcg ._cgegd ;_gcdfag :=_ddbcf .Get ("\u004f\u0075\u0074\u006c\u0069\u006e\u0065\u0073");if _gcdfag ==nil {return nil ,nil ;};_aa .Log .Trace ("\u002d\u0048\u0061\u0073\u0020\u006f\u0075\u0074\u006c\u0069\u006e\u0065\u0073");_dccac :=_fg .ResolveReference (_gcdfag );
|
||
_aa .Log .Trace ("\u004f\u0075t\u006c\u0069\u006ee\u0020\u0072\u006f\u006f\u0074\u003a\u0020\u0025\u0076",_dccac );if _cddca :=_fg .IsNullObject (_dccac );_cddca {_aa .Log .Trace ("\u004f\u0075\u0074li\u006e\u0065\u0020\u0072\u006f\u006f\u0074\u0020\u0069s\u0020n\u0075l\u006c \u002d\u0020\u006e\u006f\u0020\u006f\u0075\u0074\u006c\u0069\u006e\u0065\u0073");
|
||
return nil ,nil ;};_dffc ,_fgcfcf :=_dccac .(*_fg .PdfIndirectObject );if !_fgcfcf {if _ ,_ffgge :=_fg .GetDict (_dccac );!_ffgge {_aa .Log .Debug ("\u0049\u006e\u0076a\u006c\u0069\u0064\u0020o\u0075\u0074\u006c\u0069\u006e\u0065\u0020r\u006f\u006f\u0074\u0020\u002d\u0020\u0073\u006b\u0069\u0070\u0070\u0069\u006e\u0067");
|
||
return nil ,nil ;};_aa .Log .Debug ("\u004f\u0075t\u006c\u0069\u006e\u0065\u0020r\u006f\u006f\u0074\u0020\u0069s\u0020\u0061\u0020\u0064\u0069\u0063\u0074\u002e\u0020\u0053\u0068\u006f\u0075\u006c\u0064\u0020\u0062\u0065\u0020\u0061\u006e\u0020\u0069\u006e\u0064\u0069\u0072\u0065\u0063\u0074\u0020\u006f\u0062\u006a\u0065\u0063\u0074");
|
||
_dffc =_fg .MakeIndirectObject (_dccac );};_agfea ,_fgcfcf :=_dffc .PdfObject .(*_fg .PdfObjectDictionary );if !_fgcfcf {return nil ,_ce .New ("\u006f\u0075\u0074\u006c\u0069n\u0065\u0020\u0069\u006e\u0064\u0069\u0072\u0065\u0063\u0074\u0020\u006f\u0062j\u0065\u0063\u0074\u0020\u0073\u0068\u006f\u0075\u006c\u0064\u0020\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0020\u0061\u0020\u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061\u0072y");
|
||
};_aa .Log .Trace ("O\u0075\u0074\u006c\u0069ne\u0020r\u006f\u006f\u0074\u0020\u0064i\u0063\u0074\u003a\u0020\u0025\u0076",_agfea );_gdbf ,_ ,_afaf :=_dadcg .buildOutlineTree (_dffc ,nil ,nil ,nil );if _afaf !=nil {return nil ,_afaf ;};_aa .Log .Trace ("\u0052\u0065\u0073\u0075\u006c\u0074\u0069\u006e\u0067\u0020\u006fu\u0074\u006c\u0069\u006e\u0065\u0020\u0074\u0072\u0065\u0065:\u0020\u0025\u0076",_gdbf );
|
||
return _gdbf ,nil ;};func (_cdbae *PdfWriter )checkLicense ()error {_aegfbb :=_bec .GetLicenseKey ();if (_aegfbb ==nil ||!_aegfbb .IsLicensed ())&&!_dbfbeb {_d .Printf ("\u0055\u006e\u006c\u0069\u0063\u0065\u006e\u0073\u0065\u0064\u0020c\u006f\u0070\u0079\u0020\u006f\u0066\u0020\u0055\u006e\u0069P\u0044\u0046\u000a");
|
||
_d .Println ("-\u0020\u0047\u0065\u0074\u0020\u0061\u0020\u0066\u0072e\u0065\u0020\u0074\u0072\u0069\u0061\u006c l\u0069\u0063\u0065\u006es\u0065\u0020\u006f\u006e\u0020\u0068\u0074\u0074\u0070s:\u002f\u002fu\u006e\u0069\u0064\u006f\u0063\u002e\u0069\u006f");
|
||
return _ce .New ("\u0075\u006e\u0069\u0070d\u0066\u0020\u006c\u0069\u0063\u0065\u006e\u0073\u0065\u0020c\u006fd\u0065\u0020\u0072\u0065\u0071\u0075\u0069r\u0065\u0064");};return nil ;};
|
||
|
||
// NewPdfOutputIntentFromPdfObject creates a new PdfOutputIntent from the input core.PdfObject.
|
||
func NewPdfOutputIntentFromPdfObject (object _fg .PdfObject )(*PdfOutputIntent ,error ){_ebbdd :=&PdfOutputIntent {};if _beeg :=_ebbdd .ParsePdfObject (object );_beeg !=nil {return nil ,_beeg ;};return _ebbdd ,nil ;};
|
||
|
||
// GetNumComponents returns the number of color components of the colorspace device.
|
||
// Returns 3 for an RGB device.
|
||
func (_gdcc *PdfColorspaceDeviceRGB )GetNumComponents ()int {return 3};func _fffbg (_cdffb _fg .PdfObject )(*PdfShading ,error ){_cgca :=&PdfShading {};var _cfef *_fg .PdfObjectDictionary ;if _gfgbd ,_eceaa :=_fg .GetIndirect (_cdffb );_eceaa {_cgca ._cbabf =_gfgbd ;
|
||
_fcdc ,_gggbf :=_gfgbd .PdfObject .(*_fg .PdfObjectDictionary );if !_gggbf {_aa .Log .Debug ("\u004f\u0062\u006a\u0065c\u0074\u0020\u006e\u006f\u0074\u0020\u0061\u0020\u0064\u0069c\u0074i\u006f\u006e\u0061\u0072\u0079\u0020\u0074y\u0070\u0065");return nil ,_fg .ErrTypeError ;
|
||
};_cfef =_fcdc ;}else if _cfgdd ,_daae :=_fg .GetStream (_cdffb );_daae {_cgca ._cbabf =_cfgdd ;_cfef =_cfgdd .PdfObjectDictionary ;}else if _edddf ,_gdfc :=_fg .GetDict (_cdffb );_gdfc {_cgca ._cbabf =_edddf ;_cfef =_edddf ;}else {_aa .Log .Debug ("O\u0062\u006a\u0065\u0063\u0074\u0020t\u0079\u0070\u0065\u0020\u0075\u006e\u0065\u0078\u0070e\u0063\u0074\u0065d\u0020(\u0025\u0054\u0029",_cdffb );
|
||
return nil ,_fg .ErrTypeError ;};if _cfef ==nil {_aa .Log .Debug ("\u0044i\u0063t\u0069\u006f\u006e\u0061\u0072y\u0020\u006di\u0073\u0073\u0069\u006e\u0067");return nil ,_ce .New ("\u0064\u0069\u0063t\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067");};
|
||
_cdffb =_cfef .Get ("S\u0068\u0061\u0064\u0069\u006e\u0067\u0054\u0079\u0070\u0065");if _cdffb ==nil {_aa .Log .Debug ("\u0052\u0065q\u0075\u0069\u0072\u0065\u0064\u0020\u0073\u0068\u0061\u0064\u0069\u006e\u0067\u0020\u0074\u0079\u0070\u0065\u0020\u006d\u0069\u0073si\u006e\u0067");
|
||
return nil ,ErrRequiredAttributeMissing ;};_cdffb =_fg .TraceToDirectObject (_cdffb );_gabgd ,_afedc :=_cdffb .(*_fg .PdfObjectInteger );if !_afedc {_aa .Log .Debug ("\u0049\u006e\u0076al\u0069\u0064\u0020\u0074\u0079\u0070\u0065\u0020\u0066o\u0072 \u0073h\u0061d\u0069\u006e\u0067\u0020\u0074\u0079\u0070\u0065\u0020\u0028\u0025\u0054\u0029",_cdffb );
|
||
return nil ,_fg .ErrTypeError ;};if *_gabgd < 1||*_gabgd > 7{_aa .Log .Debug ("\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0073\u0068\u0061\u0064\u0069\u006e\u0067\u0020\u0074\u0079\u0070\u0065\u002c\u0020\u006e\u006ft\u0020\u0031\u002d\u0037\u0020(\u0067\u006ft\u0020\u0025\u0064\u0029",*_gabgd );
|
||
return nil ,_fg .ErrTypeError ;};_cgca .ShadingType =_gabgd ;_cdffb =_cfef .Get ("\u0043\u006f\u006c\u006f\u0072\u0053\u0070\u0061\u0063\u0065");if _cdffb ==nil {_aa .Log .Debug ("\u0052\u0065\u0071\u0075\u0069\u0072e\u0064\u0020\u0043\u006f\u006c\u006f\u0072\u0053\u0070\u0061\u0063\u0065\u0020e\u006e\u0074\u0072\u0079\u0020\u006d\u0069s\u0073\u0069\u006e\u0067");
|
||
return nil ,ErrRequiredAttributeMissing ;};_ggdb ,_ebgad :=NewPdfColorspaceFromPdfObject (_cdffb );if _ebgad !=nil {_aa .Log .Debug ("\u0046\u0061i\u006c\u0065\u0064\u0020\u006c\u006f\u0061\u0064\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072\u0073\u0070\u0061\u0063\u0065: \u0025\u0076",_ebgad );
|
||
return nil ,_ebgad ;};_cgca .ColorSpace =_ggdb ;_cdffb =_cfef .Get ("\u0042\u0061\u0063\u006b\u0067\u0072\u006f\u0075\u006e\u0064");if _cdffb !=nil {_cdffb =_fg .TraceToDirectObject (_cdffb );_dffd ,_cfcae :=_cdffb .(*_fg .PdfObjectArray );if !_cfcae {_aa .Log .Debug ("\u0042\u0061\u0063\u006b\u0067r\u006f\u0075\u006e\u0064\u0020\u0073\u0068\u006f\u0075\u006c\u0064\u0020\u0062e\u0020\u0073\u0070\u0065\u0063\u0069\u0066\u0069\u0065\u0064\u0020\u0062\u0079\u0020\u0061\u006e\u0020\u0061\u0072\u0072\u0061\u0079\u0020\u0028\u0067\u006f\u0074\u0020\u0025\u0054)",_cdffb );
|
||
return nil ,_fg .ErrTypeError ;};_cgca .Background =_dffd ;};_cdffb =_cfef .Get ("\u0042\u0042\u006f\u0078");if _cdffb !=nil {_cdffb =_fg .TraceToDirectObject (_cdffb );_aadd ,_fbdag :=_cdffb .(*_fg .PdfObjectArray );if !_fbdag {_aa .Log .Debug ("\u0042\u0061\u0063\u006b\u0067r\u006f\u0075\u006e\u0064\u0020\u0073\u0068\u006f\u0075\u006c\u0064\u0020\u0062e\u0020\u0073\u0070\u0065\u0063\u0069\u0066\u0069\u0065\u0064\u0020\u0062\u0079\u0020\u0061\u006e\u0020\u0061\u0072\u0072\u0061\u0079\u0020\u0028\u0067\u006f\u0074\u0020\u0025\u0054)",_cdffb );
|
||
return nil ,_fg .ErrTypeError ;};_eccg ,_ffdb :=NewPdfRectangle (*_aadd );if _ffdb !=nil {_aa .Log .Debug ("\u0042\u0042\u006f\u0078\u0020\u0065\u0072\u0072\u006fr\u003a\u0020\u0025\u0076",_ffdb );return nil ,_ffdb ;};_cgca .BBox =_eccg ;};_cdffb =_cfef .Get ("\u0041n\u0074\u0069\u0041\u006c\u0069\u0061s");
|
||
if _cdffb !=nil {_cdffb =_fg .TraceToDirectObject (_cdffb );_bgad ,_decf :=_cdffb .(*_fg .PdfObjectBool );if !_decf {_aa .Log .Debug ("A\u006e\u0074\u0069\u0041\u006c\u0069\u0061\u0073\u0020i\u006e\u0076\u0061\u006c\u0069\u0064\u0020ty\u0070\u0065\u002c\u0020s\u0068\u006f\u0075\u006c\u0064\u0020\u0062\u0065\u0020bo\u006f\u006c \u0028\u0067\u006f\u0074\u0020\u0025\u0054\u0029",_cdffb );
|
||
return nil ,_fg .ErrTypeError ;};_cgca .AntiAlias =_bgad ;};switch *_gabgd {case 1:_adagef ,_dafcb :=_ccde (_cfef );if _dafcb !=nil {return nil ,_dafcb ;};_adagef .PdfShading =_cgca ;_cgca ._bcbef =_adagef ;return _cgca ,nil ;case 2:_cedbf ,_caagc :=_fbcae (_cfef );
|
||
if _caagc !=nil {return nil ,_caagc ;};_cedbf .PdfShading =_cgca ;_cgca ._bcbef =_cedbf ;return _cgca ,nil ;case 3:_dabe ,_edcgbc :=_gaccf (_cfef );if _edcgbc !=nil {return nil ,_edcgbc ;};_dabe .PdfShading =_cgca ;_cgca ._bcbef =_dabe ;return _cgca ,nil ;
|
||
case 4:_befaab ,_ccbeg :=_badcbe (_cfef );if _ccbeg !=nil {return nil ,_ccbeg ;};_befaab .PdfShading =_cgca ;_cgca ._bcbef =_befaab ;return _cgca ,nil ;case 5:_abdcb ,_ebbag :=_cgga (_cfef );if _ebbag !=nil {return nil ,_ebbag ;};_abdcb .PdfShading =_cgca ;
|
||
_cgca ._bcbef =_abdcb ;return _cgca ,nil ;case 6:_dccea ,_aegaf :=_cfedc (_cfef );if _aegaf !=nil {return nil ,_aegaf ;};_dccea .PdfShading =_cgca ;_cgca ._bcbef =_dccea ;return _cgca ,nil ;case 7:_eddf ,_efafb :=_dadgg (_cfef );if _efafb !=nil {return nil ,_efafb ;
|
||
};_eddf .PdfShading =_cgca ;_cgca ._bcbef =_eddf ;return _cgca ,nil ;};return nil ,_ce .New ("u\u006ek\u006e\u006f\u0077\u006e\u0020\u0073\u0068\u0061d\u0069\u006e\u0067\u0020ty\u0070\u0065");};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_bfb *PdfAnnotationTrapNet )ToPdfObject ()_fg .PdfObject {_bfb .PdfAnnotation .ToPdfObject ();_fabd :=_bfb ._agb ;_cbce :=_fabd .PdfObject .(*_fg .PdfObjectDictionary );_cbce .SetIfNotNil ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u0054r\u0061\u0070\u004e\u0065\u0074"));
|
||
return _fabd ;};
|
||
|
||
// HasExtGState checks if ExtGState name is available.
|
||
func (_gfaccd *PdfPage )HasExtGState (name _fg .PdfObjectName )bool {if _gfaccd .Resources ==nil {return false ;};if _gfaccd .Resources .ExtGState ==nil {return false ;};_ggfe ,_faeb :=_fg .TraceToDirectObject (_gfaccd .Resources .ExtGState ).(*_fg .PdfObjectDictionary );
|
||
if !_faeb {_aa .Log .Debug ("\u0045\u0078\u0070\u0065\u0063\u0074\u0065\u0064\u0020\u0045\u0078t\u0047\u0053\u0074\u0061\u0074\u0065\u0020\u0064i\u0063t\u0069\u006f\u006e\u0061\u0072\u0079\u0020\u0069\u0073\u0020\u006e\u006f\u0074\u0020\u0061\u0020\u0064\u0069c\u0074\u0069\u006f\u006e\u0061\u0072\u0079\u003a\u0020\u0025\u0076",_fg .TraceToDirectObject (_gfaccd .Resources .ExtGState ));
|
||
return false ;};_edege :=_ggfe .Get (name );_gdcge :=_edege !=nil ;return _gdcge ;};
|
||
|
||
// NewPdfActionImportData returns a new "import data" action.
|
||
func NewPdfActionImportData ()*PdfActionImportData {_afa :=NewPdfAction ();_fa :=&PdfActionImportData {};_fa .PdfAction =_afa ;_afa .SetContext (_fa );return _fa ;};
|
||
|
||
// NewXObjectImage returns a new XObjectImage.
|
||
func NewXObjectImage ()*XObjectImage {_bgdab :=&XObjectImage {};_dbece :=&_fg .PdfObjectStream {};_dbece .PdfObjectDictionary =_fg .MakeDict ();_bgdab ._eafbc =_dbece ;return _bgdab ;};func (_ddef *PdfPage )setContainer (_abbca *_fg .PdfIndirectObject ){_abbca .PdfObject =_ddef ._eebge ;
|
||
_ddef ._aebf =_abbca ;};func _fffe (_afbf *_fg .PdfObjectDictionary )(*PdfShadingPattern ,error ){_cafgcf :=&PdfShadingPattern {};_beacd :=_afbf .Get ("\u0053h\u0061\u0064\u0069\u006e\u0067");if _beacd ==nil {_aa .Log .Debug ("\u0053h\u0061d\u0069\u006e\u0067\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067");
|
||
return nil ,ErrRequiredAttributeMissing ;};_cfedg ,_eedfe :=_fffbg (_beacd );if _eedfe !=nil {_aa .Log .Debug ("\u0045r\u0072\u006f\u0072\u0020l\u006f\u0061\u0064\u0069\u006eg\u0020s\u0068a\u0064\u0069\u006e\u0067\u003a\u0020\u0025v",_eedfe );return nil ,_eedfe ;
|
||
};_cafgcf .Shading =_cfedg ;if _aeaeb :=_afbf .Get ("\u004d\u0061\u0074\u0072\u0069\u0078");_aeaeb !=nil {_abcaf ,_fgab :=_aeaeb .(*_fg .PdfObjectArray );if !_fgab {_aa .Log .Debug ("\u004d\u0061\u0074\u0072i\u0078\u0020\u006e\u006f\u0074\u0020\u0061\u006e\u0020\u0061r\u0072a\u0079\u0020\u0028\u0067\u006f\u0074\u0020%\u0054\u0029",_aeaeb );
|
||
return nil ,_fg .ErrTypeError ;};_cafgcf .Matrix =_abcaf ;};if _baddf :=_afbf .Get ("\u0045x\u0074\u0047\u0053\u0074\u0061\u0074e");_baddf !=nil {_cafgcf .ExtGState =_baddf ;};return _cafgcf ,nil ;};func (_fbggc *PdfReader )buildOutlineTree (_abafgf _fg .PdfObject ,_ggaded *PdfOutlineTreeNode ,_gbdef *PdfOutlineTreeNode ,_gdbega map[_fg .PdfObject ]struct{})(*PdfOutlineTreeNode ,*PdfOutlineTreeNode ,error ){if _gdbega ==nil {_gdbega =map[_fg .PdfObject ]struct{}{};
|
||
};_gdbega [_abafgf ]=struct{}{};_cebb ,_ccdbg :=_abafgf .(*_fg .PdfIndirectObject );if !_ccdbg {return nil ,nil ,_d .Errorf ("\u006f\u0075\u0074\u006c\u0069\u006e\u0065 \u0063\u006f\u006et\u0061\u0069\u006e\u0065r\u0020\u006e\u006f\u0074\u0020\u0061\u006e\u0020\u0069\u006e\u0064\u0069\u0072\u0065\u0063\u0074\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u0020\u0025\u0054",_abafgf );
|
||
};_bdfbf ,_eedab :=_cebb .PdfObject .(*_fg .PdfObjectDictionary );if !_eedab {return nil ,nil ,_ce .New ("\u006e\u006f\u0074 a\u0020\u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061\u0072\u0079\u0020\u006f\u0062\u006a\u0065\u0063\u0074");};_aa .Log .Trace ("\u0062\u0075\u0069\u006c\u0064\u0020\u006f\u0075\u0074\u006c\u0069\u006e\u0065 \u0074\u0072\u0065\u0065\u003a\u0020d\u0069\u0063\u0074\u003a\u0020\u0025\u0076\u0020\u0028\u0025\u0076\u0029\u0020p\u003a\u0020\u0025\u0070",_bdfbf ,_cebb ,_cebb );
|
||
if _efaac :=_bdfbf .Get ("\u0054\u0069\u0074l\u0065");_efaac !=nil {_ddgd ,_gbagcc :=_fbggc .newPdfOutlineItemFromIndirectObject (_cebb );if _gbagcc !=nil {return nil ,nil ,_gbagcc ;};_ddgd .Parent =_ggaded ;_ddgd .Prev =_gbdef ;_gfaba :=_fg .ResolveReference (_bdfbf .Get ("\u0046\u0069\u0072s\u0074"));
|
||
if _ ,_baaf :=_gdbega [_gfaba ];_gfaba !=nil &&_gfaba !=_cebb &&!_baaf {if !_fg .IsNullObject (_gfaba ){_agcbbf ,_fbed ,_dedcfe :=_fbggc .buildOutlineTree (_gfaba ,&_ddgd .PdfOutlineTreeNode ,nil ,_gdbega );if _dedcfe !=nil {_aa .Log .Debug ("D\u0045\u0042U\u0047\u003a\u0020\u0063\u006f\u0075\u006c\u0064\u0020\u006e\u006f\u0074\u0020\u0062\u0075\u0069\u006c\u0064\u0020\u006fu\u0074\u006c\u0069\u006e\u0065\u0020\u0069\u0074\u0065\u006d\u0020\u0074\u0072\u0065\u0065\u003a \u0025\u0076\u002e\u0020\u0053\u006b\u0069\u0070\u0070\u0069\u006e\u0067\u0020n\u006f\u0064\u0065\u0020\u0063\u0068\u0069\u006c\u0064\u0072\u0065n\u002e",_dedcfe );
|
||
}else {_ddgd .First =_agcbbf ;_ddgd .Last =_fbed ;};};};_dfcbee :=_fg .ResolveReference (_bdfbf .Get ("\u004e\u0065\u0078\u0074"));if _ ,_edbdb :=_gdbega [_dfcbee ];_dfcbee !=nil &&_dfcbee !=_cebb &&!_edbdb {if !_fg .IsNullObject (_dfcbee ){_afced ,_fbcf ,_gdfbb :=_fbggc .buildOutlineTree (_dfcbee ,_ggaded ,&_ddgd .PdfOutlineTreeNode ,_gdbega );
|
||
if _gdfbb !=nil {_aa .Log .Debug ("D\u0045\u0042U\u0047\u003a\u0020\u0063\u006f\u0075\u006c\u0064\u0020\u006e\u006f\u0074\u0020\u0062\u0075\u0069\u006c\u0064\u0020\u006fu\u0074\u006c\u0069\u006e\u0065\u0020\u0074\u0072\u0065\u0065\u0020\u0066\u006f\u0072\u0020\u004ee\u0078\u0074\u0020\u006e\u006f\u0064\u0065\u003a\u0020\u0025\u0076\u002e\u0020S\u006b\u0069\u0070\u0070\u0069\u006e\u0067\u0020\u006e\u006f\u0064e\u002e",_gdfbb );
|
||
}else {_ddgd .Next =_afced ;return &_ddgd .PdfOutlineTreeNode ,_fbcf ,nil ;};};};return &_ddgd .PdfOutlineTreeNode ,&_ddgd .PdfOutlineTreeNode ,nil ;};_cffgde ,_fbae :=_beca (_cebb );if _fbae !=nil {return nil ,nil ,_fbae ;};_cffgde .Parent =_ggaded ;if _beeaa :=_bdfbf .Get ("\u0046\u0069\u0072s\u0074");
|
||
_beeaa !=nil {_beeaa =_fg .ResolveReference (_beeaa );if _ ,_ggadeg :=_gdbega [_beeaa ];_beeaa !=nil &&_beeaa !=_cebb &&!_ggadeg {_ccbdd :=_fg .TraceToDirectObject (_beeaa );if _ ,_ecdeb :=_ccbdd .(*_fg .PdfObjectNull );!_ecdeb &&_ccbdd !=nil {_egcff ,_bbbgc ,_cddfa :=_fbggc .buildOutlineTree (_beeaa ,&_cffgde .PdfOutlineTreeNode ,nil ,_gdbega );
|
||
if _cddfa !=nil {_aa .Log .Debug ("\u0044\u0045\u0042\u0055\u0047\u003a\u0020\u0063\u006f\u0075\u006c\u0064\u0020\u006e\u006f\u0074\u0020b\u0075\u0069\u006c\u0064\u0020\u006f\u0075\u0074\u006c\u0069n\u0065\u0020\u0074\u0072\u0065\u0065\u003a\u0020\u0025\u0076\u002e\u0020\u0053\u006b\u0069\u0070\u0070\u0069n\u0067\u0020\u006e\u006f\u0064\u0065 \u0063\u0068i\u006c\u0064r\u0065n\u002e",_cddfa );
|
||
}else {_cffgde .First =_egcff ;_cffgde .Last =_bbbgc ;};};};};return &_cffgde .PdfOutlineTreeNode ,&_cffgde .PdfOutlineTreeNode ,nil ;};
|
||
|
||
// NewPdfActionSetOCGState returns a new "named" action.
|
||
func NewPdfActionSetOCGState ()*PdfActionSetOCGState {_fgd :=NewPdfAction ();_ega :=&PdfActionSetOCGState {};_ega .PdfAction =_fgd ;_fgd .SetContext (_ega );return _ega ;};func (_cccf *PdfReader )newPdfActionSubmitFormFromDict (_agcb *_fg .PdfObjectDictionary )(*PdfActionSubmitForm ,error ){_aba ,_acb :=_ddd (_agcb .Get ("\u0046"));
|
||
if _acb !=nil {return nil ,_acb ;};return &PdfActionSubmitForm {F :_aba ,Fields :_agcb .Get ("\u0046\u0069\u0065\u006c\u0064\u0073"),Flags :_agcb .Get ("\u0046\u006c\u0061g\u0073")},nil ;};
|
||
|
||
// NewPdfPageResourcesFromDict creates and returns a new PdfPageResources object
|
||
// from the input dictionary.
|
||
func NewPdfPageResourcesFromDict (dict *_fg .PdfObjectDictionary )(*PdfPageResources ,error ){_cagfd :=NewPdfPageResources ();if _edbe :=dict .Get ("\u0045x\u0074\u0047\u0053\u0074\u0061\u0074e");_edbe !=nil {_cagfd .ExtGState =_edbe ;};if _dcdaea :=dict .Get ("\u0043\u006f\u006c\u006f\u0072\u0053\u0070\u0061\u0063\u0065");
|
||
_dcdaea !=nil &&!_fg .IsNullObject (_dcdaea ){_cagfd .ColorSpace =_dcdaea ;};if _ecedg :=dict .Get ("\u0050a\u0074\u0074\u0065\u0072\u006e");_ecedg !=nil {_cagfd .Pattern =_ecedg ;};if _gdcga :=dict .Get ("\u0053h\u0061\u0064\u0069\u006e\u0067");_gdcga !=nil {_cagfd .Shading =_gdcga ;
|
||
};if _fcace :=dict .Get ("\u0058O\u0062\u006a\u0065\u0063\u0074");_fcace !=nil {_cagfd .XObject =_fcace ;};if _ccbc :=_fg .ResolveReference (dict .Get ("\u0046\u006f\u006e\u0074"));_ccbc !=nil {_cagfd .Font =_ccbc ;};if _afcag :=dict .Get ("\u0050r\u006f\u0063\u0053\u0065\u0074");
|
||
_afcag !=nil {_cagfd .ProcSet =_afcag ;};if _cfgad :=dict .Get ("\u0050\u0072\u006f\u0070\u0065\u0072\u0074\u0069\u0065\u0073");_cfgad !=nil {_cagfd .Properties =_cfgad ;};return _cagfd ,nil ;};
|
||
|
||
// L returns the value of the L component of the color.
|
||
func (_bacae *PdfColorLab )L ()float64 {return _bacae [0]};
|
||
|
||
// ColorToRGB converts gray -> rgb for a single color component.
|
||
func (_addb *PdfColorspaceDeviceGray )ColorToRGB (color PdfColor )(PdfColor ,error ){_abbc ,_gefe :=color .(*PdfColorDeviceGray );if !_gefe {_aa .Log .Debug ("\u0049\u006e\u0070\u0075\u0074\u0020\u0063\u006f\u006c\u006fr\u0020\u006e\u006f\u0074\u0020\u0064\u0065v\u0069\u0063\u0065\u0020\u0067\u0072\u0061\u0079\u0020\u0025\u0054",color );
|
||
return nil ,_ce .New ("\u0074\u0079p\u0065\u0020\u0063h\u0065\u0063\u006b\u0020\u0065\u0072\u0072\u006f\u0072");};return NewPdfColorDeviceRGB (float64 (*_abbc ),float64 (*_abbc ),float64 (*_abbc )),nil ;};
|
||
|
||
// GetPreviousRevision returns the previous revision of PdfReader for the Pdf document
|
||
func (_ebdge *PdfReader )GetPreviousRevision ()(*PdfReader ,error ){if _ebdge ._ccgg .GetRevisionNumber ()==0{return nil ,_ce .New ("\u0070\u0072e\u0076\u0069\u006f\u0075\u0073\u0020\u0076\u0065\u0072\u0073\u0069\u006f\u006e\u0020\u0069\u0073\u0020\u006e\u006f\u0074\u0020\u0065xi\u0073\u0074");
|
||
};if _ccbda ,_gbad :=_ebdge ._cdecg [_ebdge ];_gbad {return _ccbda ,nil ;};_cgea ,_fdgeb :=_ebdge ._ccgg .GetPreviousRevisionReadSeeker ();if _fdgeb !=nil {return nil ,_fdgeb ;};_gcebb ,_fdgeb :=_bgdaf (_cgea ,_ebdge ._aegc ,_ebdge ._ecgf ,"\u006do\u0064\u0065\u006c\u003aG\u0065\u0074\u0050\u0072\u0065v\u0069o\u0075s\u0052\u0065\u0076\u0069\u0073\u0069\u006fn");
|
||
if _fdgeb !=nil {return nil ,_fdgeb ;};_ebdge ._fdbdd [_ebdge ._ccgg .GetRevisionNumber ()-1]=_gcebb ;_ebdge ._cdecg [_ebdge ]=_gcebb ;_gcebb ._cdecg =_ebdge ._cdecg ;return _gcebb ,nil ;};
|
||
|
||
// PdfOutlineItem represents an outline item dictionary (Table 153 - pp. 376 - 377).
|
||
type PdfOutlineItem struct{PdfOutlineTreeNode ;Title *_fg .PdfObjectString ;Parent *PdfOutlineTreeNode ;Prev *PdfOutlineTreeNode ;Next *PdfOutlineTreeNode ;Count *int64 ;Dest _fg .PdfObject ;A _fg .PdfObject ;SE _fg .PdfObject ;C _fg .PdfObject ;F _fg .PdfObject ;
|
||
_aeadb *_fg .PdfIndirectObject ;};func (_ecfad *PdfWriter )setDocInfo (_gfcfb _fg .PdfObject ){if _ecfad .hasObject (_ecfad ._deabg ){delete (_ecfad ._gcbec ,_ecfad ._deabg );delete (_ecfad ._acccfc ,_ecfad ._deabg );for _gbdec ,_bbgfg :=range _ecfad ._bbfd {if _bbgfg ==_ecfad ._deabg {copy (_ecfad ._bbfd [_gbdec :],_ecfad ._bbfd [_gbdec +1:]);
|
||
_ecfad ._bbfd [len (_ecfad ._bbfd )-1]=nil ;_ecfad ._bbfd =_ecfad ._bbfd [:len (_ecfad ._bbfd )-1];break ;};};};_gffec :=_fg .PdfIndirectObject {};_gffec .PdfObject =_gfcfb ;_ecfad ._deabg =&_gffec ;_ecfad .addObject (&_gffec );};
|
||
|
||
// PdfAnnotationPolyLine represents PolyLine annotations.
|
||
// (Section 12.5.6.9).
|
||
type PdfAnnotationPolyLine struct{*PdfAnnotation ;*PdfAnnotationMarkup ;Vertices _fg .PdfObject ;LE _fg .PdfObject ;BS _fg .PdfObject ;IC _fg .PdfObject ;BE _fg .PdfObject ;IT _fg .PdfObject ;Measure _fg .PdfObject ;};
|
||
|
||
// GetRevision returns the specific version of the PdfReader for the current Pdf document
|
||
func (_agcfg *PdfReader )GetRevision (revisionNumber int )(*PdfReader ,error ){_ccddb :=_agcfg ._ccgg .GetRevisionNumber ();if revisionNumber < 0||revisionNumber > _ccddb {return nil ,_ce .New ("w\u0072\u006f\u006e\u0067 r\u0065v\u0069\u0073\u0069\u006f\u006e \u006e\u0075\u006d\u0062\u0065\u0072");
|
||
};if revisionNumber ==_ccddb {return _agcfg ,nil ;};if _agcfg ._fdbdd [revisionNumber ]!=nil {return _agcfg ._fdbdd [revisionNumber ],nil ;};_cege :=_agcfg ;for _ggccc :=_ccddb -1;_ggccc >=revisionNumber ;_ggccc --{_cedc ,_gcfc :=_cege .GetPreviousRevision ();
|
||
if _gcfc !=nil {return nil ,_gcfc ;};_agcfg ._fdbdd [_ggccc ]=_cedc ;_cege =_cedc ;};return _cege ,nil ;};
|
||
|
||
// PdfAnnotationPopup represents Popup annotations.
|
||
// (Section 12.5.6.14).
|
||
type PdfAnnotationPopup struct{*PdfAnnotation ;Parent _fg .PdfObject ;Open _fg .PdfObject ;};
|
||
|
||
// NewPdfAnnotationScreen returns a new screen annotation.
|
||
func NewPdfAnnotationScreen ()*PdfAnnotationScreen {_adga :=NewPdfAnnotation ();_dcde :=&PdfAnnotationScreen {};_dcde .PdfAnnotation =_adga ;_adga .SetContext (_dcde );return _dcde ;};
|
||
|
||
// PdfFieldChoice represents a choice field which includes scrollable list boxes and combo boxes.
|
||
type PdfFieldChoice struct{*PdfField ;Opt *_fg .PdfObjectArray ;TI *_fg .PdfObjectInteger ;I *_fg .PdfObjectArray ;};
|
||
|
||
// EnableByName LTV enables the signature dictionary of the PDF AcroForm
|
||
// field identified the specified name. The signing certificate chain is
|
||
// extracted from the signature dictionary. Optionally, additional certificates
|
||
// can be specified through the `extraCerts` parameter. The LTV client attempts
|
||
// to build the certificate chain up to a trusted root by downloading any
|
||
// missing certificates.
|
||
func (_cabc *LTV )EnableByName (name string ,extraCerts []*_ge .Certificate )error {_egbga :=_cabc ._edgba ._cbb .AcroForm ;for _ ,_aegee :=range _egbga .AllFields (){_adcc ,_ :=_aegee .GetContext ().(*PdfFieldSignature );if _adcc ==nil {continue ;};if _edeed :=_adcc .PartialName ();
|
||
_edeed !=name {continue ;};return _cabc .Enable (_adcc .V ,extraCerts );};return nil ;};type pdfSignDictionary struct{*_fg .PdfObjectDictionary ;_afcd *SignatureHandler ;_cggdd *PdfSignature ;_gaage int64 ;_afade int ;_accg int ;_aegfb int ;_ecdgb int ;
|
||
};
|
||
|
||
// ToPdfObject converts the pdfCIDFontType0 to a PDF representation.
|
||
func (_bfeb *pdfCIDFontType0 )ToPdfObject ()_fg .PdfObject {return _fg .MakeNull ()};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_gdcd *PdfAnnotationText )ToPdfObject ()_fg .PdfObject {_gdcd .PdfAnnotation .ToPdfObject ();_acaf :=_gdcd ._agb ;_bcgc :=_acaf .PdfObject .(*_fg .PdfObjectDictionary );if _gdcd .PdfAnnotationMarkup !=nil {_gdcd .PdfAnnotationMarkup .appendToPdfDictionary (_bcgc );
|
||
};_bcgc .SetIfNotNil ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u0054\u0065\u0078\u0074"));_bcgc .SetIfNotNil ("\u004f\u0070\u0065\u006e",_gdcd .Open );_bcgc .SetIfNotNil ("\u004e\u0061\u006d\u0065",_gdcd .Name );_bcgc .SetIfNotNil ("\u0053\u0074\u0061t\u0065",_gdcd .State );
|
||
_bcgc .SetIfNotNil ("\u0053\u0074\u0061\u0074\u0065\u004d\u006f\u0064\u0065\u006c",_gdcd .StateModel );return _acaf ;};
|
||
|
||
// GetRuneMetrics returns the character metrics for the specified rune.
|
||
// A bool flag is returned to indicate whether or not the entry was found.
|
||
func (_decc pdfCIDFontType0 )GetRuneMetrics (r rune )(_eed .CharMetrics ,bool ){return _eed .CharMetrics {Wx :_decc ._cgda },true ;};
|
||
|
||
// FullName returns the full name of the field as in rootname.parentname.partialname.
|
||
func (_gbeeg *PdfField )FullName ()(string ,error ){var _cacfd _cb .Buffer ;_daaaf :=[]string {};if _gbeeg .T !=nil {_daaaf =append (_daaaf ,_gbeeg .T .Decoded ());};_bdab :=map[*PdfField ]bool {};_bdab [_gbeeg ]=true ;_efbf :=_gbeeg .Parent ;for _efbf !=nil {if _ ,_begeb :=_bdab [_efbf ];
|
||
_begeb {return _cacfd .String (),_ce .New ("\u0072\u0065\u0063\u0075rs\u0069\u0076\u0065\u0020\u0074\u0072\u0061\u0076\u0065\u0072\u0073\u0061\u006c");};if _efbf .T ==nil {return _cacfd .String (),_ce .New ("\u0066\u0069el\u0064\u0020\u0070a\u0072\u0074\u0069\u0061l n\u0061me\u0020\u0028\u0054\u0029\u0020\u006e\u006ft \u0073\u0070\u0065\u0063\u0069\u0066\u0069e\u0064");
|
||
};_daaaf =append (_daaaf ,_efbf .T .Decoded ());_bdab [_efbf ]=true ;_efbf =_efbf .Parent ;};for _cgfde :=len (_daaaf )-1;_cgfde >=0;_cgfde --{_cacfd .WriteString (_daaaf [_cgfde ]);if _cgfde > 0{_cacfd .WriteString ("\u002e");};};return _cacfd .String (),nil ;
|
||
};
|
||
|
||
// NewPdfColorspaceDeviceN returns an initialized PdfColorspaceDeviceN.
|
||
func NewPdfColorspaceDeviceN ()*PdfColorspaceDeviceN {_adaf :=&PdfColorspaceDeviceN {};return _adaf };func (_cae *PdfReader )newPdfAnnotationSoundFromDict (_cgcd *_fg .PdfObjectDictionary )(*PdfAnnotationSound ,error ){_fdcf :=PdfAnnotationSound {};_gcag ,_dgb :=_cae .newPdfAnnotationMarkupFromDict (_cgcd );
|
||
if _dgb !=nil {return nil ,_dgb ;};_fdcf .PdfAnnotationMarkup =_gcag ;_fdcf .Name =_cgcd .Get ("\u004e\u0061\u006d\u0065");_fdcf .Sound =_cgcd .Get ("\u0053\u006f\u0075n\u0064");return &_fdcf ,nil ;};
|
||
|
||
// WatermarkImageOptions contains options for configuring the watermark process.
|
||
type WatermarkImageOptions struct{Alpha float64 ;FitToWidth bool ;PreserveAspectRatio bool ;};
|
||
|
||
// NewPdfActionHide returns a new "hide" action.
|
||
func NewPdfActionHide ()*PdfActionHide {_aaa :=NewPdfAction ();_fgf :=&PdfActionHide {};_fgf .PdfAction =_aaa ;_aaa .SetContext (_fgf );return _fgf ;};
|
||
|
||
// SetContentStreams sets the content streams based on a string array. Will make
|
||
// 1 object stream for each string and reference from the page Contents.
|
||
// Each stream will be encoded using the encoding specified by the StreamEncoder,
|
||
// if empty, will use identity encoding (raw data).
|
||
func (_bbgc *PdfPage )SetContentStreams (cStreams []string ,encoder _fg .StreamEncoder )error {if len (cStreams )==0{_bbgc .Contents =nil ;return nil ;};if encoder ==nil {encoder =_fg .NewRawEncoder ();};var _geeed []*_fg .PdfObjectStream ;for _ ,_aaef :=range cStreams {_acdbe :=&_fg .PdfObjectStream {};
|
||
_dcbcd :=encoder .MakeStreamDict ();_addff ,_abafb :=encoder .EncodeBytes ([]byte (_aaef ));if _abafb !=nil {return _abafb ;};_dcbcd .Set ("\u004c\u0065\u006e\u0067\u0074\u0068",_fg .MakeInteger (int64 (len (_addff ))));_acdbe .PdfObjectDictionary =_dcbcd ;
|
||
_acdbe .Stream =_addff ;_geeed =append (_geeed ,_acdbe );};if len (_geeed )==1{_bbgc .Contents =_geeed [0];}else {_degeb :=_fg .MakeArray ();for _ ,_gebcdf :=range _geeed {_degeb .Append (_gebcdf );};_bbgc .Contents =_degeb ;};return nil ;};func (_afee *PdfReader )newPdfAnnotationTextFromDict (_dddc *_fg .PdfObjectDictionary )(*PdfAnnotationText ,error ){_ecfb :=PdfAnnotationText {};
|
||
_edda ,_abdb :=_afee .newPdfAnnotationMarkupFromDict (_dddc );if _abdb !=nil {return nil ,_abdb ;};_ecfb .PdfAnnotationMarkup =_edda ;_ecfb .Open =_dddc .Get ("\u004f\u0070\u0065\u006e");_ecfb .Name =_dddc .Get ("\u004e\u0061\u006d\u0065");_ecfb .State =_dddc .Get ("\u0053\u0074\u0061t\u0065");
|
||
_ecfb .StateModel =_dddc .Get ("\u0053\u0074\u0061\u0074\u0065\u004d\u006f\u0064\u0065\u006c");return &_ecfb ,nil ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_acbaa *Permissions )ToPdfObject ()_fg .PdfObject {return _acbaa ._gdfff };
|
||
|
||
// DecodeArray returns the range of color component values in CalRGB colorspace.
|
||
func (_bbfc *PdfColorspaceCalRGB )DecodeArray ()[]float64 {return []float64 {0.0,1.0,0.0,1.0,0.0,1.0};};
|
||
|
||
// NewPdfActionURI returns a new "Uri" action.
|
||
func NewPdfActionURI ()*PdfActionURI {_eec :=NewPdfAction ();_afd :=&PdfActionURI {};_afd .PdfAction =_eec ;_eec .SetContext (_afd );return _afd ;};
|
||
|
||
// NewStandard14FontWithEncoding returns the standard 14 font named `basefont` as a *PdfFont and
|
||
// a TextEncoder that encodes all the runes in `alphabet`, or an error if this is not possible.
|
||
// An error can occur if `basefont` is not one the standard 14 font names.
|
||
func NewStandard14FontWithEncoding (basefont StdFontName ,alphabet map[rune ]int )(*PdfFont ,_dg .SimpleEncoder ,error ){_bggfa ,_becgg :=_aedae (basefont );if _becgg !=nil {return nil ,nil ,_becgg ;};_ceee ,_ebege :=_bggfa .Encoder ().(_dg .SimpleEncoder );
|
||
if !_ebege {return nil ,nil ,_d .Errorf ("\u006f\u006e\u006c\u0079\u0020s\u0069\u006d\u0070\u006c\u0065\u0020\u0065\u006e\u0063\u006f\u0064\u0069\u006eg\u0020\u0069\u0073\u0020\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u002c\u0020\u0067\u006f\u0074\u0020\u0025\u0054",_bggfa .Encoder ());
|
||
};_ccdd :=make (map[rune ]_dg .GlyphName );for _gfea :=range alphabet {if _ ,_bbgg :=_ceee .RuneToCharcode (_gfea );!_bbgg {_ ,_cega :=_bggfa ._dacg .Read (_gfea );if !_cega {_aa .Log .Trace ("r\u0075\u006e\u0065\u0020\u0025\u0023x\u003d\u0025\u0071\u0020\u006e\u006f\u0074\u0020\u0069n\u0020\u0074\u0068e\u0020f\u006f\u006e\u0074",_gfea ,_gfea );
|
||
continue ;};_agaaf ,_cega :=_dg .RuneToGlyph (_gfea );if !_cega {_aa .Log .Debug ("\u006eo\u0020\u0067\u006c\u0079\u0070\u0068\u0020\u0066\u006f\u0072\u0020r\u0075\u006e\u0065\u0020\u0025\u0023\u0078\u003d\u0025\u0071",_gfea ,_gfea );continue ;};if len (_ccdd )>=255{return nil ,nil ,_ce .New ("\u0074\u006f\u006f\u0020\u006d\u0061\u006e\u0079\u0020\u0063\u0068\u0061\u0072a\u0063\u0074\u0065\u0072\u0073\u0020f\u006f\u0072\u0020\u0073\u0069\u006d\u0070\u006c\u0065\u0020\u0065\u006e\u0063o\u0064\u0069\u006e\u0067");
|
||
};_ccdd [_gfea ]=_agaaf ;};};var (_geaba []_dg .CharCode ;_gcgfa []_dg .CharCode ;);for _fbcb :=_dg .CharCode (1);_fbcb <=0xff;_fbcb ++{_ffbe ,_ccbf :=_ceee .CharcodeToRune (_fbcb );if !_ccbf {_geaba =append (_geaba ,_fbcb );continue ;};if _ ,_ccbf =alphabet [_ffbe ];
|
||
!_ccbf {_gcgfa =append (_gcgfa ,_fbcb );};};_fgaeag :=append (_geaba ,_gcgfa ...);if len (_fgaeag )< len (_ccdd ){return nil ,nil ,_d .Errorf ("n\u0065\u0065\u0064\u0020\u0074\u006f\u0020\u0065\u006ec\u006f\u0064\u0065\u0020\u0025\u0064\u0020ru\u006e\u0065\u0073\u002c \u0062\u0075\u0074\u0020\u0068\u0061\u0076\u0065\u0020on\u006c\u0079 \u0025\u0064\u0020\u0073\u006c\u006f\u0074\u0073",len (_ccdd ),len (_fgaeag ));
|
||
};_gaca :=make ([]rune ,0,len (_ccdd ));for _fegeg :=range _ccdd {_gaca =append (_gaca ,_fegeg );};_ad .Slice (_gaca ,func (_ecbe ,_eedfb int )bool {return _gaca [_ecbe ]< _gaca [_eedfb ]});_cbdd :=make (map[_dg .CharCode ]_dg .GlyphName ,len (_gaca ));
|
||
for _ ,_bbdgc :=range _gaca {_bcac :=_fgaeag [0];_fgaeag =_fgaeag [1:];_cbdd [_bcac ]=_ccdd [_bbdgc ];};_ceee =_dg .ApplyDifferences (_ceee ,_cbdd );_bggfa .SetEncoder (_ceee );return &PdfFont {_gcaeff :&_bggfa },_ceee ,nil ;};
|
||
|
||
// String returns a string representation of the field.
|
||
func (_addg *PdfField )String ()string {if _efgca ,_fccaf :=_addg .ToPdfObject ().(*_fg .PdfIndirectObject );_fccaf {return _d .Sprintf ("\u0025\u0054\u003a\u0020\u0025\u0073",_addg ._abcbb ,_efgca .PdfObject .String ());};return "";};func (_abg *PdfReader )newPdfAnnotationProjectionFromDict (_ebcdb *_fg .PdfObjectDictionary )(*PdfAnnotationProjection ,error ){_eceg :=&PdfAnnotationProjection {};
|
||
_gcbc ,_ceg :=_abg .newPdfAnnotationMarkupFromDict (_ebcdb );if _ceg !=nil {return nil ,_ceg ;};_eceg .PdfAnnotationMarkup =_gcbc ;return _eceg ,nil ;};func _ffeff (_bgff _fg .PdfObject )(*PdfPattern ,error ){_aeffg :=&PdfPattern {};var _ecggca *_fg .PdfObjectDictionary ;
|
||
if _cacdbf ,_cdfdg :=_fg .GetIndirect (_bgff );_cdfdg {_aeffg ._gaac =_cacdbf ;_agee ,_agffg :=_cacdbf .PdfObject .(*_fg .PdfObjectDictionary );if !_agffg {_aa .Log .Debug ("\u0050\u0061\u0074\u0074\u0065\u0072\u006e\u0020\u0069\u006e\u0064\u0069\u0072\u0065\u0063\u0074\u0020\u006f\u0062\u006ae\u0063\u0074\u0020\u006e\u006f\u0074\u0020\u0063\u006fn\u0074\u0061\u0069\u006e\u0069\u006e\u0067\u0020\u0064\u0069\u0063\u0074\u0069o\u006e\u0061\u0072\u0079\u0020\u0028g\u006f\u0074\u0020%\u0054\u0029",_cacdbf .PdfObject );
|
||
return nil ,_fg .ErrTypeError ;};_ecggca =_agee ;}else if _acgag ,_ebaab :=_fg .GetStream (_bgff );_ebaab {_aeffg ._gaac =_acgag ;_ecggca =_acgag .PdfObjectDictionary ;}else {_aa .Log .Debug ("\u0050a\u0074\u0074e\u0072\u006e\u0020\u006eo\u0074\u0020\u0061n\u0020\u0069\u006e\u0064\u0069\u0072\u0065\u0063\u0074 o\u0062\u006a\u0065c\u0074\u0020o\u0072\u0020\u0073\u0074\u0072\u0065a\u006d\u002e \u0025\u0054",_bgff );
|
||
return nil ,_fg .ErrTypeError ;};_cggcc :=_ecggca .Get ("P\u0061\u0074\u0074\u0065\u0072\u006e\u0054\u0079\u0070\u0065");if _cggcc ==nil {_aa .Log .Debug ("\u0050\u0064\u0066\u0020\u0050\u0061\u0074\u0074\u0065\u0072\u006e\u0020\u006e\u006f\u0074\u0020\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0069n\u0067\u0020\u0050\u0061\u0074t\u0065\u0072n\u0054\u0079\u0070\u0065");
|
||
return nil ,ErrRequiredAttributeMissing ;};_cbfca ,_deade :=_cggcc .(*_fg .PdfObjectInteger );if !_deade {_aa .Log .Debug ("\u0050\u0061tt\u0065\u0072\u006e \u0074\u0079\u0070\u0065 no\u0074 a\u006e\u0020\u0069\u006e\u0074\u0065\u0067er\u0020\u0028\u0067\u006f\u0074\u0020\u0025T\u0029",_cggcc );
|
||
return nil ,_fg .ErrTypeError ;};if *_cbfca !=1&&*_cbfca !=2{_aa .Log .Debug ("\u0050\u0061\u0074\u0074e\u0072\u006e\u0020\u0074\u0079\u0070\u0065\u0020\u0021\u003d \u0031/\u0032\u0020\u0028\u0067\u006f\u0074\u0020%\u0064\u0029",*_cbfca );return nil ,_fg .ErrRangeError ;
|
||
};_aeffg .PatternType =int64 (*_cbfca );switch *_cbfca {case 1:_affdb ,_fbeec :=_cecgc (_ecggca );if _fbeec !=nil {return nil ,_fbeec ;};_affdb .PdfPattern =_aeffg ;_aeffg ._ccdc =_affdb ;return _aeffg ,nil ;case 2:_acae ,_gabeg :=_fffe (_ecggca );if _gabeg !=nil {return nil ,_gabeg ;
|
||
};_acae .PdfPattern =_aeffg ;_aeffg ._ccdc =_acae ;return _aeffg ,nil ;};return nil ,_ce .New ("\u0075n\u006bn\u006f\u0077\u006e\u0020\u0070\u0061\u0074\u0074\u0065\u0072\u006e");};func _facaf (_cecb _fg .PdfObject ,_ebfe *fontCommon )(*_fc .CMap ,error ){_dcfga ,_decaa :=_fg .GetStream (_cecb );
|
||
if !_decaa {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052:\u0020\u0074\u006f\u0055\u006e\u0069\u0063\u006f\u0064\u0065\u0054\u006f\u0043m\u0061\u0070\u003a\u0020\u004e\u006f\u0074\u0020\u0061\u0020\u0073\u0074\u0072\u0065\u0061\u006d\u0020\u0028\u0025\u0054\u0029",_cecb );
|
||
return nil ,_fg .ErrTypeError ;};_efde ,_gacf :=_fg .DecodeStream (_dcfga );if _gacf !=nil {return nil ,_gacf ;};_bdcca ,_gacf :=_fc .LoadCmapFromData (_efde ,!_ebfe .isCIDFont ());if _gacf !=nil {_aa .Log .Debug ("\u0045\u0052R\u004f\u0052\u003a\u0020\u004f\u0062\u006a\u0065\u0063\u0074\u004e\u0075\u006d\u0062\u0065\u0072\u003d\u0025\u0064\u0020\u0065\u0072r=\u0025\u0076",_dcfga .ObjectNumber ,_gacf );
|
||
};return _bdcca ,_gacf ;};func (_dfccc *pdfFontType0 )baseFields ()*fontCommon {return &_dfccc .fontCommon };
|
||
|
||
// PdfColorspaceCalGray represents CalGray color space.
|
||
type PdfColorspaceCalGray struct{WhitePoint []float64 ;BlackPoint []float64 ;Gamma float64 ;_ffbdb *_fg .PdfIndirectObject ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_aedf *PdfAnnotationMovie )ToPdfObject ()_fg .PdfObject {_aedf .PdfAnnotation .ToPdfObject ();_abfff :=_aedf ._agb ;_fdbc :=_abfff .PdfObject .(*_fg .PdfObjectDictionary );_fdbc .SetIfNotNil ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u004d\u006f\u0076i\u0065"));
|
||
_fdbc .SetIfNotNil ("\u0054",_aedf .T );_fdbc .SetIfNotNil ("\u004d\u006f\u0076i\u0065",_aedf .Movie );_fdbc .SetIfNotNil ("\u0041",_aedf .A );return _abfff ;};func _agae ()string {_eecga :="\u0051\u0057\u0045\u0052\u0054\u0059\u0055\u0049\u004f\u0050\u0041S\u0044\u0046\u0047\u0048\u004a\u004b\u004c\u005a\u0058\u0043V\u0042\u004e\u004d";
|
||
var _gdbdf _cb .Buffer ;for _gabcb :=0;_gabcb < 6;_gabcb ++{_gdbdf .WriteRune (rune (_eecga [_bf .Intn (len (_eecga ))]));};return _gdbdf .String ();};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_ggccf *PdfAnnotationRichMedia )ToPdfObject ()_fg .PdfObject {_ggccf .PdfAnnotation .ToPdfObject ();_dagb :=_ggccf ._agb ;_acfe :=_dagb .PdfObject .(*_fg .PdfObjectDictionary );_acfe .SetIfNotNil ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u0052i\u0063\u0068\u004d\u0065\u0064\u0069a"));
|
||
_acfe .SetIfNotNil ("\u0052\u0069\u0063\u0068\u004d\u0065\u0064\u0069\u0061\u0053\u0065\u0074t\u0069\u006e\u0067\u0073",_ggccf .RichMediaSettings );_acfe .SetIfNotNil ("\u0052\u0069c\u0068\u004d\u0065d\u0069\u0061\u0043\u006f\u006e\u0074\u0065\u006e\u0074",_ggccf .RichMediaContent );
|
||
return _dagb ;};
|
||
|
||
// PdfShading represents a shading dictionary. There are 7 types of shading,
|
||
// indicatedby the shading type variable:
|
||
// 1: Function-based shading.
|
||
// 2: Axial shading.
|
||
// 3: Radial shading.
|
||
// 4: Free-form Gouraud-shaded triangle mesh.
|
||
// 5: Lattice-form Gouraud-shaded triangle mesh.
|
||
// 6: Coons patch mesh.
|
||
// 7: Tensor-product patch mesh.
|
||
// types 4-7 are contained in a stream object, where the dictionary is given by the stream dictionary.
|
||
type PdfShading struct{ShadingType *_fg .PdfObjectInteger ;ColorSpace PdfColorspace ;Background *_fg .PdfObjectArray ;BBox *PdfRectangle ;AntiAlias *_fg .PdfObjectBool ;_bcbef PdfModel ;_cbabf _fg .PdfObject ;};
|
||
|
||
// GetAscent returns the Ascent of the font `descriptor`.
|
||
func (_dbgda *PdfFontDescriptor )GetAscent ()(float64 ,error ){return _fg .GetNumberAsFloat (_dbgda .Ascent );};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_ccg *PdfActionSubmitForm )ToPdfObject ()_fg .PdfObject {_ccg .PdfAction .ToPdfObject ();_beg :=_ccg ._bda ;_bgge :=_beg .PdfObject .(*_fg .PdfObjectDictionary );_bgge .SetIfNotNil ("\u0053",_fg .MakeName (string (ActionTypeSubmitForm )));if _ccg .F !=nil {_bgge .Set ("\u0046",_ccg .F .ToPdfObject ());
|
||
};_bgge .SetIfNotNil ("\u0046\u0069\u0065\u006c\u0064\u0073",_ccg .Fields );_bgge .SetIfNotNil ("\u0046\u006c\u0061g\u0073",_ccg .Flags );return _beg ;};type crossReference struct{Type int ;
|
||
|
||
// Type 1
|
||
Offset int64 ;Generation int64 ;
|
||
|
||
// Type 2
|
||
ObjectNumber int ;Index int ;};
|
||
|
||
// NewPdfPageResourcesColorspaces returns a new PdfPageResourcesColorspaces object.
|
||
func NewPdfPageResourcesColorspaces ()*PdfPageResourcesColorspaces {_geeeg :=&PdfPageResourcesColorspaces {};_geeeg .Names =[]string {};_geeeg .Colorspaces =map[string ]PdfColorspace {};_geeeg ._daff =&_fg .PdfIndirectObject {};return _geeeg ;};
|
||
|
||
// GetOptimizer returns current PDF optimizer.
|
||
func (_geeeb *PdfWriter )GetOptimizer ()Optimizer {return _geeeb ._fdgfe };
|
||
|
||
// SetFilter sets compression filter. Decodes with current filter sets and
|
||
// encodes the data with the new filter.
|
||
func (_aedab *XObjectImage )SetFilter (encoder _fg .StreamEncoder )error {_cdeag :=_aedab .Stream ;_bebbga ,_daddfd :=_aedab .Filter .DecodeBytes (_cdeag );if _daddfd !=nil {return _daddfd ;};_aedab .Filter =encoder ;encoder .UpdateParams (_aedab .getParamsDict ());
|
||
_cdeag ,_daddfd =encoder .EncodeBytes (_bebbga );if _daddfd !=nil {return _daddfd ;};_aedab .Stream =_cdeag ;return nil ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_cgde *PdfActionGoToR )ToPdfObject ()_fg .PdfObject {_cgde .PdfAction .ToPdfObject ();_gf :=_cgde ._bda ;_aab :=_gf .PdfObject .(*_fg .PdfObjectDictionary );_aab .SetIfNotNil ("\u0053",_fg .MakeName (string (ActionTypeGoToR )));if _cgde .F !=nil {_aab .Set ("\u0046",_cgde .F .ToPdfObject ());
|
||
};_aab .SetIfNotNil ("\u0044",_cgde .D );_aab .SetIfNotNil ("\u004ee\u0077\u0057\u0069\u006e\u0064\u006fw",_cgde .NewWindow );return _gf ;};
|
||
|
||
// GenerateXObjectName generates an unused XObject name that can be used for
|
||
// adding new XObjects. Uses format XObj1, XObj2, ...
|
||
func (_caeef *PdfPageResources )GenerateXObjectName ()_fg .PdfObjectName {_dabaa :=1;for {_egeda :=_fg .MakeName (_d .Sprintf ("\u0058\u004f\u0062\u006a\u0025\u0064",_dabaa ));if !_caeef .HasXObjectByName (*_egeda ){return *_egeda ;};_dabaa ++;};};
|
||
|
||
// BytesToCharcodes converts the bytes in a PDF string to character codes.
|
||
func (_egdeb *PdfFont )BytesToCharcodes (data []byte )[]_dg .CharCode {_aa .Log .Trace ("\u0042\u0079\u0074es\u0054\u006f\u0043\u0068\u0061\u0072\u0063\u006f\u0064e\u0073:\u0020d\u0061t\u0061\u003d\u005b\u0025\u0020\u0030\u0032\u0078\u005d\u003d\u0025\u0023\u0071",data ,data );
|
||
if _efda ,_cedde :=_egdeb ._gcaeff .(*pdfFontType0 );_cedde &&_efda ._abeac !=nil {if _fcagb ,_dccec :=_efda .bytesToCharcodes (data );_dccec {return _fcagb ;};};var (_gacda =make ([]_dg .CharCode ,0,len (data )+len (data )%2);_ccbdf =_egdeb .baseFields ();
|
||
);if _ccbdf ._agab !=nil {if _efcbc ,_bffd :=_ccbdf ._agab .BytesToCharcodes (data );_bffd {for _ ,_ddgb :=range _efcbc {_gacda =append (_gacda ,_dg .CharCode (_ddgb ));};return _gacda ;};};if _ccbdf .isCIDFont (){if len (data )==1{data =[]byte {0,data [0]};
|
||
};if len (data )%2!=0{_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0050\u0061\u0064\u0064\u0069\u006e\u0067\u0020\u0064\u0061\u0074\u0061\u003d\u0025\u002b\u0076\u0020t\u006f\u0020\u0065\u0076\u0065n\u0020\u006ce\u006e\u0067\u0074\u0068",data );
|
||
data =append (data ,0);};for _cbbd :=0;_cbbd < len (data );_cbbd +=2{_feffg :=uint16 (data [_cbbd ])<<8|uint16 (data [_cbbd +1]);_gacda =append (_gacda ,_dg .CharCode (_feffg ));};}else {for _ ,_efbgg :=range data {_gacda =append (_gacda ,_dg .CharCode (_efbgg ));
|
||
};};return _gacda ;};
|
||
|
||
// String returns string value of output intent for given type
|
||
// ISO_19005-2 6.2.3: GTS_PDFA1 value should be used for PDF/A-1, A-2 and A-3 at least
|
||
func (_bfadf PdfOutputIntentType )String ()string {switch _bfadf {case PdfOutputIntentTypeA1 :return "\u0047T\u0053\u005f\u0050\u0044\u0046\u00411";case PdfOutputIntentTypeA2 :return "\u0047T\u0053\u005f\u0050\u0044\u0046\u00411";case PdfOutputIntentTypeA3 :return "\u0047T\u0053\u005f\u0050\u0044\u0046\u00411";
|
||
case PdfOutputIntentTypeA4 :return "\u0047T\u0053\u005f\u0050\u0044\u0046\u00411";case PdfOutputIntentTypeX :return "\u0047\u0054\u0053\u005f\u0050\u0044\u0046\u0058";default:return "\u0055N\u0044\u0045\u0046\u0049\u004e\u0045D";};};
|
||
|
||
// IsColored specifies if the pattern is colored.
|
||
func (_gdffgc *PdfTilingPattern )IsColored ()bool {if _gdffgc .PaintType !=nil &&*_gdffgc .PaintType ==1{return true ;};return false ;};
|
||
|
||
// SetSamples convert samples to byte-data and sets for the image.
|
||
// NOTE: The method resamples the data and this could lead to high memory usage,
|
||
// especially on large images. It should be used only when it is not possible
|
||
// to work with the image byte data directly.
|
||
func (_aeafae *Image )SetSamples (samples []uint32 ){if _aeafae .BitsPerComponent < 8{samples =_aeafae .samplesAddPadding (samples );};_gaeff :=_ade .ResampleUint32 (samples ,int (_aeafae .BitsPerComponent ),8);_fdbd :=make ([]byte ,len (_gaeff ));for _fefge ,_ffece :=range _gaeff {_fdbd [_fefge ]=byte (_ffece );
|
||
};_aeafae .Data =_fdbd ;};const (TrappedUnknown PdfInfoTrapped ="\u0055n\u006b\u006e\u006f\u0077\u006e";TrappedTrue PdfInfoTrapped ="\u0054\u0072\u0075\u0065";TrappedFalse PdfInfoTrapped ="\u0046\u0061\u006cs\u0065";);
|
||
|
||
// ToPdfObject returns the PDF representation of the shading dictionary.
|
||
func (_dgbee *PdfShadingType5 )ToPdfObject ()_fg .PdfObject {_dgbee .PdfShading .ToPdfObject ();_beegd ,_efdef :=_dgbee .getShadingDict ();if _efdef !=nil {_aa .Log .Error ("\u0055\u006ea\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0061\u0063\u0063\u0065\u0073\u0073\u0020\u0073\u0068\u0061\u0064\u0069\u006e\u0067\u0020di\u0063\u0074");
|
||
return nil ;};if _dgbee .BitsPerCoordinate !=nil {_beegd .Set ("\u0042\u0069\u0074\u0073\u0050\u0065\u0072\u0043\u006f\u006f\u0072\u0064i\u006e\u0061\u0074\u0065",_dgbee .BitsPerCoordinate );};if _dgbee .BitsPerComponent !=nil {_beegd .Set ("\u0042\u0069t\u0073\u0050\u0065r\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074",_dgbee .BitsPerComponent );
|
||
};if _dgbee .VerticesPerRow !=nil {_beegd .Set ("\u0056\u0065\u0072\u0074\u0069\u0063\u0065\u0073\u0050e\u0072\u0052\u006f\u0077",_dgbee .VerticesPerRow );};if _dgbee .Decode !=nil {_beegd .Set ("\u0044\u0065\u0063\u006f\u0064\u0065",_dgbee .Decode );};
|
||
if _dgbee .Function !=nil {if len (_dgbee .Function )==1{_beegd .Set ("\u0046\u0075\u006e\u0063\u0074\u0069\u006f\u006e",_dgbee .Function [0].ToPdfObject ());}else {_beabf :=_fg .MakeArray ();for _ ,_aeebc :=range _dgbee .Function {_beabf .Append (_aeebc .ToPdfObject ());
|
||
};_beegd .Set ("\u0046\u0075\u006e\u0063\u0074\u0069\u006f\u006e",_beabf );};};return _dgbee ._cbabf ;};
|
||
|
||
// AllFields returns a flattened list of all fields in the form.
|
||
func (_cffd *PdfAcroForm )AllFields ()[]*PdfField {if _cffd ==nil {return nil ;};var _ecggc []*PdfField ;if _cffd .Fields !=nil {for _ ,_eadge :=range *_cffd .Fields {_ecggc =append (_ecggc ,_affd (_eadge )...);};};return _ecggc ;};
|
||
|
||
// GetContentStream returns the pattern cell's content stream
|
||
func (_dfbgab *PdfTilingPattern )GetContentStream ()([]byte ,error ){_ceede ,_ ,_dagfa :=_dfbgab .GetContentStreamWithEncoder ();return _ceede ,_dagfa ;};
|
||
|
||
// NewPdfActionResetForm returns a new "reset form" action.
|
||
func NewPdfActionResetForm ()*PdfActionResetForm {_bfg :=NewPdfAction ();_abd :=&PdfActionResetForm {};_abd .PdfAction =_bfg ;_bfg .SetContext (_abd );return _abd ;};var (_edegd =_ee .MustCompile ("\u005cd\u002b\u0020\u0064\u0069c\u0074\u005c\u0073\u002b\u0028d\u0075p\u005cs\u002b\u0029\u003f\u0062\u0065\u0067\u0069n");
|
||
_fbegb =_ee .MustCompile ("\u005e\u005cs\u002a\u002f\u0028\u005c\u0053\u002b\u003f\u0029\u005c\u0073\u002b\u0028\u002e\u002b\u003f\u0029\u005c\u0073\u002b\u0064\u0065\u0066\\s\u002a\u0024");_caab =_ee .MustCompile ("\u005e\u005c\u0073*\u0064\u0075\u0070\u005c\u0073\u002b\u0028\u005c\u0064\u002b\u0029\u005c\u0073\u002a\u002f\u0028\u005c\u0077\u002b\u003f\u0029\u0028\u003f\u003a\u005c\u002e\u005c\u0064\u002b)\u003f\u005c\u0073\u002b\u0070\u0075\u0074\u0024");
|
||
_ccce ="\u002f\u0045\u006e\u0063od\u0069\u006e\u0067\u0020\u0032\u0035\u0036\u0020\u0061\u0072\u0072\u0061\u0079";_gfbc ="\u0072\u0065\u0061d\u006f\u006e\u006c\u0079\u0020\u0064\u0065\u0066";_edebd ="\u0063\u0075\u0072\u0072\u0065\u006e\u0074\u0066\u0069\u006c\u0065\u0020e\u0065\u0078\u0065\u0063";
|
||
);func (_ggeg *PdfColorspaceCalRGB )String ()string {return "\u0043\u0061\u006c\u0052\u0047\u0042"};func (_cacec *PdfWriter )optimize ()error {if _cacec ._fdgfe ==nil {return nil ;};var _bgcee error ;_cacec ._bbfd ,_bgcee =_cacec ._fdgfe .Optimize (_cacec ._bbfd );
|
||
if _bgcee !=nil {return _bgcee ;};_aabda :=make (map[_fg .PdfObject ]struct{},len (_cacec ._bbfd ));for _ ,_dbfeb :=range _cacec ._bbfd {_aabda [_dbfeb ]=struct{}{};};_cacec ._gcbec =_aabda ;return nil ;};
|
||
|
||
// PdfActionHide represents a hide action.
|
||
type PdfActionHide struct{*PdfAction ;T _fg .PdfObject ;H _fg .PdfObject ;};
|
||
|
||
// AddContentStreamByString adds content stream by string. Puts the content
|
||
// string into a stream object and points the content stream towards it.
|
||
func (_bgbdd *PdfPage )AddContentStreamByString (contentStr string )error {_agdf ,_dcggd :=_fg .MakeStream ([]byte (contentStr ),_fg .NewFlateEncoder ());if _dcggd !=nil {return _dcggd ;};if _bgbdd .Contents ==nil {_bgbdd .Contents =_agdf ;}else {_aacef :=_fg .TraceToDirectObject (_bgbdd .Contents );
|
||
_aabd ,_faaed :=_aacef .(*_fg .PdfObjectArray );if !_faaed {_aabd =_fg .MakeArray (_aacef );};_aabd .Append (_agdf );_bgbdd .Contents =_aabd ;};return nil ;};
|
||
|
||
// GetPerms returns the Permissions dictionary
|
||
func (_bdeba *PdfReader )GetPerms ()*Permissions {return _bdeba ._eadc };
|
||
|
||
// SetDecode sets the decode image float slice.
|
||
func (_bgegg *Image )SetDecode (decode []float64 ){_bgegg ._dbge =decode };
|
||
|
||
// NewPdfAnnotationText returns a new text annotation.
|
||
func NewPdfAnnotationText ()*PdfAnnotationText {_gaadb :=NewPdfAnnotation ();_ecg :=&PdfAnnotationText {};_ecg .PdfAnnotation =_gaadb ;_ecg .PdfAnnotationMarkup =&PdfAnnotationMarkup {};_gaadb .SetContext (_ecg );return _ecg ;};func (_gfc *PdfReader )newPdfActionSoundFromDict (_ffa *_fg .PdfObjectDictionary )(*PdfActionSound ,error ){return &PdfActionSound {Sound :_ffa .Get ("\u0053\u006f\u0075n\u0064"),Volume :_ffa .Get ("\u0056\u006f\u006c\u0075\u006d\u0065"),Synchronous :_ffa .Get ("S\u0079\u006e\u0063\u0068\u0072\u006f\u006e\u006f\u0075\u0073"),Repeat :_ffa .Get ("\u0052\u0065\u0070\u0065\u0061\u0074"),Mix :_ffa .Get ("\u004d\u0069\u0078")},nil ;
|
||
};func (_dgacf *PdfReader )newPdfAnnotationLineFromDict (_fgcf *_fg .PdfObjectDictionary )(*PdfAnnotationLine ,error ){_eeef :=PdfAnnotationLine {};_fdab ,_bdgd :=_dgacf .newPdfAnnotationMarkupFromDict (_fgcf );if _bdgd !=nil {return nil ,_bdgd ;};_eeef .PdfAnnotationMarkup =_fdab ;
|
||
_eeef .L =_fgcf .Get ("\u004c");_eeef .BS =_fgcf .Get ("\u0042\u0053");_eeef .LE =_fgcf .Get ("\u004c\u0045");_eeef .IC =_fgcf .Get ("\u0049\u0043");_eeef .LL =_fgcf .Get ("\u004c\u004c");_eeef .LLE =_fgcf .Get ("\u004c\u004c\u0045");_eeef .Cap =_fgcf .Get ("\u0043\u0061\u0070");
|
||
_eeef .IT =_fgcf .Get ("\u0049\u0054");_eeef .LLO =_fgcf .Get ("\u004c\u004c\u004f");_eeef .CP =_fgcf .Get ("\u0043\u0050");_eeef .Measure =_fgcf .Get ("\u004de\u0061\u0073\u0075\u0072\u0065");_eeef .CO =_fgcf .Get ("\u0043\u004f");return &_eeef ,nil ;
|
||
};func (_feggd *PdfWriter )hasObject (_edbda _fg .PdfObject )bool {_ ,_degc :=_feggd ._gcbec [_edbda ];return _degc ;};func (_fgad *DSS )generateHashMap (_daagc []*_fg .PdfObjectStream )(map[string ]*_fg .PdfObjectStream ,error ){_gdbc :=map[string ]*_fg .PdfObjectStream {};
|
||
for _ ,_aagg :=range _daagc {_fegg ,_cdcf :=_fg .DecodeStream (_aagg );if _cdcf !=nil {return nil ,_cdcf ;};_fcbad ,_cdcf :=_egbc (_fegg );if _cdcf !=nil {return nil ,_cdcf ;};_gdbc [string (_fcbad )]=_aagg ;};return _gdbc ,nil ;};
|
||
|
||
// ToPdfObject returns the PDF representation of the shading dictionary.
|
||
func (_affa *PdfShadingType1 )ToPdfObject ()_fg .PdfObject {_affa .PdfShading .ToPdfObject ();_bgafd ,_bccgae :=_affa .getShadingDict ();if _bccgae !=nil {_aa .Log .Error ("\u0055\u006ea\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0061\u0063\u0063\u0065\u0073\u0073\u0020\u0073\u0068\u0061\u0064\u0069\u006e\u0067\u0020di\u0063\u0074");
|
||
return nil ;};if _affa .Domain !=nil {_bgafd .Set ("\u0044\u006f\u006d\u0061\u0069\u006e",_affa .Domain );};if _affa .Matrix !=nil {_bgafd .Set ("\u004d\u0061\u0074\u0072\u0069\u0078",_affa .Matrix );};if _affa .Function !=nil {if len (_affa .Function )==1{_bgafd .Set ("\u0046\u0075\u006e\u0063\u0074\u0069\u006f\u006e",_affa .Function [0].ToPdfObject ());
|
||
}else {_ceacd :=_fg .MakeArray ();for _ ,_babg :=range _affa .Function {_ceacd .Append (_babg .ToPdfObject ());};_bgafd .Set ("\u0046\u0075\u006e\u0063\u0074\u0069\u006f\u006e",_ceacd );};};return _affa ._cbabf ;};func (_bfgdfg *PdfWriter )setCatalogVersion (){_bfgdfg ._cgacf .Set ("\u0056e\u0072\u0073\u0069\u006f\u006e",_fg .MakeName (_d .Sprintf ("\u0025\u0064\u002e%\u0064",_bfgdfg ._fbbec .Major ,_bfgdfg ._fbbec .Minor )));
|
||
};
|
||
|
||
// NewPdfAnnotationSound returns a new sound annotation.
|
||
func NewPdfAnnotationSound ()*PdfAnnotationSound {_efbg :=NewPdfAnnotation ();_adebc :=&PdfAnnotationSound {};_adebc .PdfAnnotation =_efbg ;_adebc .PdfAnnotationMarkup =&PdfAnnotationMarkup {};_efbg .SetContext (_adebc );return _adebc ;};func _gceb (_bddb *PdfAnnotation )(*XObjectForm ,*PdfRectangle ,error ){_acfd ,_gfee :=_fg .GetDict (_bddb .AP );
|
||
if !_gfee {return nil ,nil ,_ce .New ("f\u0069\u0065\u006c\u0064\u0020\u006di\u0073\u0073\u0069\u006e\u0067\u0020\u0041\u0050\u0020d\u0069\u0063\u0074i\u006fn\u0061\u0072\u0079");};if _acfd ==nil {return nil ,nil ,nil ;};_aafef ,_gfee :=_fg .GetArray (_bddb .Rect );
|
||
if !_gfee ||_aafef .Len ()!=4{return nil ,nil ,_ce .New ("\u0072\u0065\u0063t\u0020\u0069\u006e\u0076\u0061\u006c\u0069\u0064");};_cecfb ,_bdec :=NewPdfRectangle (*_aafef );if _bdec !=nil {return nil ,nil ,_bdec ;};_bfag :=_fg .TraceToDirectObject (_acfd .Get ("\u004e"));
|
||
switch _cdag :=_bfag .(type ){case *_fg .PdfObjectStream :_efgbg :=_cdag ;_befd ,_gafe :=NewXObjectFormFromStream (_efgbg );return _befd ,_cecfb ,_gafe ;case *_fg .PdfObjectDictionary :_dbfd :=_cdag ;_dccfe ,_afgc :=_fg .GetName (_bddb .AS );if !_afgc {return nil ,nil ,nil ;
|
||
};if _dbfd .Get (*_dccfe )==nil {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052:\u0020\u0041\u0053\u0020\u0073\u0074\u0061\u0074\u0065\u0020\u006e\u006f\u0074 \u0073\u0070\u0065\u0063\u0069\u0066\u0069\u0065\u0064\u0020\u0069\u006e\u0020\u0041\u0050\u0020\u0064\u0069\u0063\u0074\u0020\u002d\u0020\u0069\u0067\u006e\u006f\u0072\u0069\u006eg");
|
||
return nil ,nil ,nil ;};_fdacg ,_afgc :=_fg .GetStream (_dbfd .Get (*_dccfe ));if !_afgc {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0055n\u0061\u0062\u006ce \u0074\u006f\u0020\u0061\u0063\u0063e\u0073\u0073\u0020\u0061\u0070\u0070\u0065\u0061\u0072\u0061\u006e\u0063\u0065\u0020\u0073t\u0072\u0065\u0061\u006d\u0020\u0066\u006f\u0072 \u0025\u0076",_dccfe );
|
||
return nil ,nil ,_ce .New ("\u0073\u0074\u0072\u0065\u0061\u006d\u0020\u006d\u0069s\u0073\u0069\u006e\u0067");};_agfcc ,_ecbge :=NewXObjectFormFromStream (_fdacg );return _agfcc ,_cecfb ,_ecbge ;};_aa .Log .Debug ("\u0049\u006e\u0076\u0061li\u0064\u0020\u0074\u0079\u0070\u0065\u0020\u0066\u006f\u0072\u0020\u004e\u003a\u0020%\u0054",_bfag );
|
||
return nil ,nil ,_ce .New ("\u0074\u0079p\u0065\u0020\u0063h\u0065\u0063\u006b\u0020\u0065\u0072\u0072\u006f\u0072");};
|
||
|
||
// StandardValidator is the interface that is used for the PDF StandardImplementer validation for the PDF document.
|
||
// It is using a CompliancePdfReader which is expected to give more Metadata during reading process.
|
||
// NOTE: This implementation is in experimental development state.
|
||
// Keep in mind that it might change in the subsequent minor versions.
|
||
type StandardValidator interface{
|
||
|
||
// ValidateStandard checks if the input reader
|
||
ValidateStandard (_gggea *CompliancePdfReader )error ;};
|
||
|
||
// CharcodeBytesToUnicode converts PDF character codes `data` to a Go unicode string.
|
||
//
|
||
// 9.10 Extraction of Text Content (page 292)
|
||
// The process of finding glyph descriptions in OpenType fonts by a conforming reader shall be the following:
|
||
// - For Type 1 fonts using “CFF” tables, the process shall be as described in 9.6.6.2, "Encodings
|
||
// for Type 1 Fonts".
|
||
// - For TrueType fonts using “glyf” tables, the process shall be as described in 9.6.6.4,
|
||
// "Encodings for TrueType Fonts". Since this process sometimes produces ambiguous results,
|
||
// conforming writers, instead of using a simple font, shall use a Type 0 font with an Identity-H
|
||
// encoding and use the glyph indices as character codes, as described following Table 118.
|
||
func (_cbacc *PdfFont )CharcodeBytesToUnicode (data []byte )(string ,int ,int ){_adebb ,_ ,_bdca :=_cbacc .CharcodesToUnicodeWithStats (_cbacc .BytesToCharcodes (data ));_ecdf :=_dg .ExpandLigatures (_adebb );return _ecdf ,_bg .RuneCountInString (_ecdf ),_bdca ;
|
||
};
|
||
|
||
// GetAsTilingPattern returns a tiling pattern. Check with IsTiling() prior to using this.
|
||
func (_adgf *PdfPattern )GetAsTilingPattern ()*PdfTilingPattern {return _adgf ._ccdc .(*PdfTilingPattern );};func _badcbe (_bfff *_fg .PdfObjectDictionary )(*PdfShadingType4 ,error ){_gadfa :=PdfShadingType4 {};_aefbc :=_bfff .Get ("\u0042\u0069\u0074\u0073\u0050\u0065\u0072\u0043\u006f\u006f\u0072\u0064i\u006e\u0061\u0074\u0065");
|
||
if _aefbc ==nil {_aa .Log .Debug ("\u0052e\u0071\u0075i\u0072\u0065\u0064 \u0061\u0074\u0074\u0072\u0069\u0062\u0075t\u0065\u0020\u006d\u0069\u0073\u0073i\u006e\u0067\u003a\u0020\u0042\u0069\u0074\u0073\u0050\u0065\u0072C\u006f\u006f\u0072\u0064\u0069\u006e\u0061\u0074\u0065");
|
||
return nil ,ErrRequiredAttributeMissing ;};_gebbf ,_daace :=_aefbc .(*_fg .PdfObjectInteger );if !_daace {_aa .Log .Debug ("\u0042\u0069\u0074\u0073\u0050e\u0072\u0043\u006f\u006f\u0072\u0064\u0069\u006e\u0061\u0074\u0065\u0020\u006eo\u0074\u0020\u0061\u006e\u0020\u0069\u006e\u0074\u0065\u0067\u0065\u0072\u0020\u0028\u0067\u006f\u0074\u0020\u0025\u0054\u0029",_aefbc );
|
||
return nil ,_fg .ErrTypeError ;};_gadfa .BitsPerCoordinate =_gebbf ;_aefbc =_bfff .Get ("\u0042\u0069t\u0073\u0050\u0065r\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074");if _aefbc ==nil {_aa .Log .Debug ("\u0052e\u0071\u0075i\u0072\u0065\u0064\u0020a\u0074\u0074\u0072i\u0062\u0075\u0074\u0065\u0020\u006d\u0069\u0073\u0073in\u0067\u003a\u0020B\u0069\u0074s\u0050\u0065\u0072\u0043\u006f\u006dp\u006f\u006ee\u006e\u0074");
|
||
return nil ,ErrRequiredAttributeMissing ;};_gebbf ,_daace =_aefbc .(*_fg .PdfObjectInteger );if !_daace {_aa .Log .Debug ("B\u0069\u0074\u0073\u0050\u0065\u0072\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074\u0020\u006e\u006ft\u0020\u0061\u006e\u0020\u0069\u006e\u0074\u0065\u0067\u0065r \u0028\u0067\u006ft\u0020%\u0054\u0029",_aefbc );
|
||
return nil ,_fg .ErrTypeError ;};_gadfa .BitsPerComponent =_gebbf ;_aefbc =_bfff .Get ("B\u0069\u0074\u0073\u0050\u0065\u0072\u0046\u006c\u0061\u0067");if _aefbc ==nil {_aa .Log .Debug ("\u0052\u0065\u0071\u0075\u0069\u0072\u0065\u0064\u0020\u0061\u0074\u0074\u0072i\u0062\u0075\u0074\u0065\u0020\u006di\u0073\u0073\u0069\u006e\u0067\u003a\u0020\u0042\u0069\u0074\u0073\u0050\u0065r\u0046\u006c\u0061\u0067");
|
||
return nil ,ErrRequiredAttributeMissing ;};_gebbf ,_daace =_aefbc .(*_fg .PdfObjectInteger );if !_daace {_aa .Log .Debug ("B\u0069\u0074\u0073\u0050\u0065\u0072F\u006c\u0061\u0067\u0020\u006e\u006ft\u0020\u0061\u006e\u0020\u0069\u006e\u0074e\u0067\u0065\u0072\u0020\u0028\u0067\u006f\u0074\u0020\u0025T\u0029",_aefbc );
|
||
return nil ,_fg .ErrTypeError ;};_gadfa .BitsPerComponent =_gebbf ;_aefbc =_bfff .Get ("\u0044\u0065\u0063\u006f\u0064\u0065");if _aefbc ==nil {_aa .Log .Debug ("\u0052\u0065\u0071ui\u0072\u0065\u0064\u0020\u0061\u0074\u0074\u0072\u0069b\u0075t\u0065 \u006di\u0073\u0073\u0069\u006e\u0067\u003a\u0020\u0044\u0065\u0063\u006f\u0064\u0065");
|
||
return nil ,ErrRequiredAttributeMissing ;};_gbaa ,_daace :=_aefbc .(*_fg .PdfObjectArray );if !_daace {_aa .Log .Debug ("\u0044\u0065\u0063\u006fd\u0065\u0020\u006e\u006f\u0074\u0020\u0061\u006e\u0020\u0061r\u0072a\u0079\u0020\u0028\u0067\u006f\u0074\u0020%\u0054\u0029",_aefbc );
|
||
return nil ,_fg .ErrTypeError ;};_gadfa .Decode =_gbaa ;_aefbc =_bfff .Get ("\u0046\u0075\u006e\u0063\u0074\u0069\u006f\u006e");if _aefbc ==nil {_aa .Log .Debug ("\u0052\u0065q\u0075\u0069\u0072\u0065d\u0020\u0061t\u0074\u0072\u0069\u0062\u0075\u0074\u0065\u0020m\u0069\u0073\u0073\u0069\u006e\u0067\u003a\u0020\u0020\u0046\u0075\u006ec\u0074\u0069\u006f\u006e");
|
||
return nil ,ErrRequiredAttributeMissing ;};_gadfa .Function =[]PdfFunction {};if _eecec ,_fcbf :=_aefbc .(*_fg .PdfObjectArray );_fcbf {for _ ,_eeadb :=range _eecec .Elements (){_eebfg ,_ecdab :=_defgb (_eeadb );if _ecdab !=nil {_aa .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0070\u0061\u0072\u0073\u0069n\u0067\u0020\u0066\u0075\u006e\u0063\u0074\u0069\u006f\u006e:\u0020\u0025\u0076",_ecdab );
|
||
return nil ,_ecdab ;};_gadfa .Function =append (_gadfa .Function ,_eebfg );};}else {_cfcbg ,_abdd :=_defgb (_aefbc );if _abdd !=nil {_aa .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0070\u0061\u0072\u0073\u0069n\u0067\u0020\u0066\u0075\u006e\u0063\u0074\u0069\u006f\u006e:\u0020\u0025\u0076",_abdd );
|
||
return nil ,_abdd ;};_gadfa .Function =append (_gadfa .Function ,_cfcbg );};return &_gadfa ,nil ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_cda *PdfActionJavaScript )ToPdfObject ()_fg .PdfObject {_cda .PdfAction .ToPdfObject ();_cea :=_cda ._bda ;_gae :=_cea .PdfObject .(*_fg .PdfObjectDictionary );_gae .SetIfNotNil ("\u0053",_fg .MakeName (string (ActionTypeJavaScript )));_gae .SetIfNotNil ("\u004a\u0053",_cda .JS );
|
||
return _cea ;};
|
||
|
||
// String returns a string representation of PdfTransformParamsDocMDP.
|
||
func (_fafbc *PdfTransformParamsDocMDP )String ()string {return _d .Sprintf ("\u0025\u0073\u0020\u0050\u003a\u0020\u0025\u0073\u0020V\u003a\u0020\u0025\u0073",_fafbc .Type ,_fafbc .P ,_fafbc .V );};func _fbcae (_dffag *_fg .PdfObjectDictionary )(*PdfShadingType2 ,error ){_becdb :=PdfShadingType2 {};
|
||
_fgdc :=_dffag .Get ("\u0043\u006f\u006f\u0072\u0064\u0073");if _fgdc ==nil {_aa .Log .Debug ("R\u0065\u0071\u0075\u0069\u0072\u0065d\u0020\u0061\u0074\u0074\u0072\u0069b\u0075\u0074\u0065\u0020\u006d\u0069\u0073s\u0069\u006e\u0067\u003a\u0020\u0020\u0043\u006f\u006f\u0072d\u0073");
|
||
return nil ,ErrRequiredAttributeMissing ;};_eefg ,_ebfgf :=_fgdc .(*_fg .PdfObjectArray );if !_ebfgf {_aa .Log .Debug ("\u0043\u006f\u006f\u0072d\u0073\u0020\u006e\u006f\u0074\u0020\u0061\u006e\u0020\u0061r\u0072a\u0079\u0020\u0028\u0067\u006f\u0074\u0020%\u0054\u0029",_fgdc );
|
||
return nil ,_ce .New ("\u0074\u0079p\u0065\u0020\u0063h\u0065\u0063\u006b\u0020\u0065\u0072\u0072\u006f\u0072");};if _eefg .Len ()!=4{_aa .Log .Debug ("\u0043\u006f\u006f\u0072d\u0073\u0020\u006c\u0065\u006e\u0067\u0074\u0068\u0020\u006eo\u0074 \u0034\u0020\u0028\u0067\u006f\u0074\u0020%\u0064\u0029",_eefg .Len ());
|
||
return nil ,_ce .New ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0061\u0074\u0074\u0072i\u0062\u0075\u0074\u0065");};_becdb .Coords =_eefg ;if _ccfce :=_dffag .Get ("\u0044\u006f\u006d\u0061\u0069\u006e");_ccfce !=nil {_ccfce =_fg .TraceToDirectObject (_ccfce );
|
||
_aefd ,_acag :=_ccfce .(*_fg .PdfObjectArray );if !_acag {_aa .Log .Debug ("\u0044\u006f\u006d\u0061i\u006e\u0020\u006e\u006f\u0074\u0020\u0061\u006e\u0020\u0061r\u0072a\u0079\u0020\u0028\u0067\u006f\u0074\u0020%\u0054\u0029",_ccfce );return nil ,_ce .New ("\u0074\u0079p\u0065\u0020\u0063h\u0065\u0063\u006b\u0020\u0065\u0072\u0072\u006f\u0072");
|
||
};_becdb .Domain =_aefd ;};_fgdc =_dffag .Get ("\u0046\u0075\u006e\u0063\u0074\u0069\u006f\u006e");if _fgdc ==nil {_aa .Log .Debug ("\u0052\u0065q\u0075\u0069\u0072\u0065d\u0020\u0061t\u0074\u0072\u0069\u0062\u0075\u0074\u0065\u0020m\u0069\u0073\u0073\u0069\u006e\u0067\u003a\u0020\u0020\u0046\u0075\u006ec\u0074\u0069\u006f\u006e");
|
||
return nil ,ErrRequiredAttributeMissing ;};_becdb .Function =[]PdfFunction {};if _edbcd ,_bfcab :=_fgdc .(*_fg .PdfObjectArray );_bfcab {for _ ,_fecaa :=range _edbcd .Elements (){_bbeea ,_badec :=_defgb (_fecaa );if _badec !=nil {_aa .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0070\u0061\u0072\u0073\u0069n\u0067\u0020\u0066\u0075\u006e\u0063\u0074\u0069\u006f\u006e:\u0020\u0025\u0076",_badec );
|
||
return nil ,_badec ;};_becdb .Function =append (_becdb .Function ,_bbeea );};}else {_bbde ,_cfbed :=_defgb (_fgdc );if _cfbed !=nil {_aa .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0070\u0061\u0072\u0073\u0069n\u0067\u0020\u0066\u0075\u006e\u0063\u0074\u0069\u006f\u006e:\u0020\u0025\u0076",_cfbed );
|
||
return nil ,_cfbed ;};_becdb .Function =append (_becdb .Function ,_bbde );};if _ffebc :=_dffag .Get ("\u0045\u0078\u0074\u0065\u006e\u0064");_ffebc !=nil {_ffebc =_fg .TraceToDirectObject (_ffebc );_cbaba ,_eddfg :=_ffebc .(*_fg .PdfObjectArray );if !_eddfg {_aa .Log .Debug ("\u004d\u0061\u0074\u0072i\u0078\u0020\u006e\u006f\u0074\u0020\u0061\u006e\u0020\u0061r\u0072a\u0079\u0020\u0028\u0067\u006f\u0074\u0020%\u0054\u0029",_ffebc );
|
||
return nil ,_fg .ErrTypeError ;};if _cbaba .Len ()!=2{_aa .Log .Debug ("\u0045\u0078\u0074\u0065n\u0064\u0020\u006c\u0065\u006e\u0067\u0074\u0068\u0020\u006eo\u0074 \u0032\u0020\u0028\u0067\u006f\u0074\u0020%\u0064\u0029",_cbaba .Len ());return nil ,ErrInvalidAttribute ;
|
||
};_becdb .Extend =_cbaba ;};return &_becdb ,nil ;};
|
||
|
||
// PdfShadingType7 is a Tensor-product patch mesh.
|
||
type PdfShadingType7 struct{*PdfShading ;BitsPerCoordinate *_fg .PdfObjectInteger ;BitsPerComponent *_fg .PdfObjectInteger ;BitsPerFlag *_fg .PdfObjectInteger ;Decode *_fg .PdfObjectArray ;Function []PdfFunction ;};func _cebge (_dacb *_fg .PdfObjectDictionary ,_cedb *fontCommon )(*pdfFontType3 ,error ){_gdaf :=_fbeg (_cedb );
|
||
_eddef :=_dacb .Get ("\u0046i\u0072\u0073\u0074\u0043\u0068\u0061r");if _eddef ==nil {_eddef =_fg .MakeInteger (0);};_gdaf .FirstChar =_eddef ;_agadc ,_eegd :=_fg .GetIntVal (_eddef );if !_eegd {_aa .Log .Debug ("\u0045\u0052\u0052OR\u003a\u0020\u0049\u006e\u0076\u0061\u006c\u0069\u0064 \u0046i\u0072s\u0074C\u0068\u0061\u0072\u0020\u0074\u0079\u0070\u0065\u0020\u0028\u0025\u0054\u0029",_eddef );
|
||
return nil ,_fg .ErrTypeError ;};_fefb :=_dg .CharCode (_agadc );_eddef =_dacb .Get ("\u004c\u0061\u0073\u0074\u0043\u0068\u0061\u0072");if _eddef ==nil {_eddef =_fg .MakeInteger (255);};_gdaf .LastChar =_eddef ;_agadc ,_eegd =_fg .GetIntVal (_eddef );
|
||
if !_eegd {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a \u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u004c\u0061\u0073\u0074\u0043h\u0061\u0072\u0020\u0074\u0079\u0070\u0065 \u0028\u0025\u0054\u0029",_eddef );return nil ,_fg .ErrTypeError ;
|
||
};_aegbf :=_dg .CharCode (_agadc );_eddef =_dacb .Get ("\u0052e\u0073\u006f\u0075\u0072\u0063\u0065s");if _eddef !=nil {_gdaf .Resources =_eddef ;};_eddef =_dacb .Get ("\u0043h\u0061\u0072\u0050\u0072\u006f\u0063s");if _eddef ==nil {_aa .Log .Debug ("\u0045\u0052R\u004f\u0052\u003a\u0020\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0043\u0068\u0061\u0072\u0050\u0072\u006f\u0063\u0073\u0020(%\u0076\u0029",_eddef );
|
||
return nil ,_fg .ErrNotSupported ;};_gdaf .CharProcs =_eddef ;_eddef =_dacb .Get ("\u0046\u006f\u006e\u0074\u004d\u0061\u0074\u0072\u0069\u0078");if _eddef ==nil {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0049\u006e\u0076a\u006c\u0069\u0064\u0020\u0046\u006f\u006et\u004d\u0061\u0074\u0072\u0069\u0078\u0020\u0028\u0025\u0076\u0029",_eddef );
|
||
return nil ,_fg .ErrNotSupported ;};_gdaf .FontMatrix =_eddef ;_gdaf ._eabbc =make (map[_dg .CharCode ]float64 );_eddef =_dacb .Get ("\u0057\u0069\u0064\u0074\u0068\u0073");if _eddef !=nil {_gdaf .Widths =_eddef ;_agdc ,_aadf :=_fg .GetArray (_eddef );
|
||
if !_aadf {_aa .Log .Debug ("\u0045\u0052R\u004f\u0052\u003a\u0020W\u0069\u0064t\u0068\u0073\u0020\u0061\u0074\u0074\u0072\u0069b\u0075\u0074\u0065\u0020\u0021\u003d\u0020\u0061\u0072\u0072\u0061\u0079 \u0028\u0025\u0054\u0029",_eddef );return nil ,_fg .ErrTypeError ;
|
||
};_cgab ,_cdfaf :=_agdc .ToFloat64Array ();if _cdfaf !=nil {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a \u0063\u006f\u006e\u0076\u0065\u0072\u0074\u0069\u006e\u0067\u0020\u0077\u0069d\u0074\u0068\u0073\u0020\u0074\u006f\u0020a\u0072\u0072\u0061\u0079");
|
||
return nil ,_cdfaf ;};if len (_cgab )!=int (_aegbf -_fefb +1){_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0049\u006e\u0076\u0061\u006c\u0069d\u0020\u0077\u0069\u0064\u0074\u0068s\u0020\u006c\u0065\u006e\u0067\u0074\u0068\u0020\u0021\u003d\u0020\u0025\u0064 \u0028\u0025\u0064\u0029",_aegbf -_fefb +1,len (_cgab ));
|
||
return nil ,_fg .ErrRangeError ;};_ceba ,_aadf :=_fg .GetArray (_gdaf .FontMatrix );if !_aadf {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052:\u0020\u0046\u006f\u006e\u0074\u004d\u0061\u0074\u0072\u0069\u0078\u0020\u0061t\u0074\u0072\u0069\u0062\u0075\u0074\u0065\u0020\u0021\u003d\u0020\u0061\u0072\u0072\u0061\u0079\u0020\u0028\u0025\u0054\u0029",_ceba );
|
||
return nil ,_cdfaf ;};_aaeed ,_cdfaf :=_ceba .ToFloat64Array ();if _cdfaf !=nil {_aa .Log .Debug ("\u0045\u0052R\u004f\u0052\u003a\u0020c\u006f\u006ev\u0065\u0072\u0074\u0069\u006e\u0067\u0020\u0046o\u006e\u0074\u004d\u0061\u0074\u0072\u0069\u0078\u0020\u0074\u006f\u0020a\u0072\u0072\u0061\u0079");
|
||
return nil ,_cdfaf ;};_aadea :=_gbe .NewMatrix (_aaeed [0],_aaeed [1],_aaeed [2],_aaeed [3],_aaeed [4],_aaeed [5]);for _cgdg ,_cbbc :=range _cgab {_caagd ,_ :=_aadea .Transform (_cbbc ,_cbbc );_gdaf ._eabbc [_fefb +_dg .CharCode (_cgdg )]=_caagd ;};};_gdaf .Encoding =_fg .TraceToDirectObject (_dacb .Get ("\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067"));
|
||
_dagc :=_dacb .Get ("\u0054o\u0055\u006e\u0069\u0063\u006f\u0064e");if _dagc !=nil {_gdaf ._eggb =_fg .TraceToDirectObject (_dagc );_edgfb ,_gbefb :=_facaf (_gdaf ._eggb ,&_gdaf .fontCommon );if _gbefb !=nil {return nil ,_gbefb ;};_gdaf ._agab =_edgfb ;
|
||
};if _bfacb :=_gdaf ._agab ;_bfacb !=nil {_gdaf ._efad =_dg .NewCMapEncoder ("",nil ,_bfacb );}else {_gdaf ._efad =_dg .NewPdfDocEncoder ();};return _gdaf ,nil ;};func (_cbd *PdfReader )newPdfAnnotationScreenFromDict (_fcbe *_fg .PdfObjectDictionary )(*PdfAnnotationScreen ,error ){_badfa :=PdfAnnotationScreen {};
|
||
_badfa .T =_fcbe .Get ("\u0054");_badfa .MK =_fcbe .Get ("\u004d\u004b");_badfa .A =_fcbe .Get ("\u0041");_badfa .AA =_fcbe .Get ("\u0041\u0041");return &_badfa ,nil ;};
|
||
|
||
// ColorAt returns the color of the image pixel specified by the x and y coordinates.
|
||
func (_afcb *Image )ColorAt (x ,y int )(_be .Color ,error ){_ggade :=_cc .BytesPerLine (int (_afcb .Width ),int (_afcb .BitsPerComponent ),_afcb .ColorComponents );switch _afcb .ColorComponents {case 1:return _cc .ColorAtGrayscale (x ,y ,int (_afcb .BitsPerComponent ),_ggade ,_afcb .Data ,_afcb ._dbge );
|
||
case 3:return _cc .ColorAtNRGBA (x ,y ,int (_afcb .Width ),_ggade ,int (_afcb .BitsPerComponent ),_afcb .Data ,_afcb ._gccd ,_afcb ._dbge );case 4:return _cc .ColorAtCMYK (x ,y ,int (_afcb .Width ),_afcb .Data ,_afcb ._dbge );};_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0075\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064 i\u006da\u0067\u0065\u002e\u0020\u0025\u0064\u0020\u0063\u006f\u006d\u0070\u006fn\u0065\u006e\u0074\u0073\u002c\u0020\u0025\u0064\u0020\u0062\u0069\u0074\u0073\u0020\u0070\u0065\u0072 \u0063\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074",_afcb .ColorComponents ,_afcb .BitsPerComponent );
|
||
return nil ,_ce .New ("\u0075\u006e\u0073\u0075p\u0070\u006f\u0072\u0074\u0065\u0064\u0020\u0069\u006d\u0061g\u0065 \u0063\u006f\u006c\u006f\u0072\u0073\u0070a\u0063\u0065");};
|
||
|
||
// ToPdfObject returns a PDF object representation of the outline item.
|
||
func (_bccb *OutlineItem )ToPdfObject ()_fg .PdfObject {_dfbec ,_ :=_bccb .ToPdfOutlineItem ();return _dfbec .ToPdfObject ();};
|
||
|
||
// ToPdfOutlineItem returns a low level PdfOutlineItem object,
|
||
// based on the current instance.
|
||
func (_fdbba *OutlineItem )ToPdfOutlineItem ()(*PdfOutlineItem ,int64 ){_cbddd :=NewPdfOutlineItem ();_cbddd .Title =_fg .MakeEncodedString (_fdbba .Title ,true );_cbddd .Dest =_fdbba .Dest .ToPdfObject ();var _cebdg []*PdfOutlineItem ;var _acbgf int64 ;
|
||
var _fbgd *PdfOutlineItem ;for _ ,_gdddgb :=range _fdbba .Entries {_cade ,_ecbc :=_gdddgb .ToPdfOutlineItem ();_cade .Parent =&_cbddd .PdfOutlineTreeNode ;if _fbgd !=nil {_fbgd .Next =&_cade .PdfOutlineTreeNode ;_cade .Prev =&_fbgd .PdfOutlineTreeNode ;
|
||
};_cebdg =append (_cebdg ,_cade );_acbgf +=_ecbc ;_fbgd =_cade ;};_faafb :=len (_cebdg );_acbgf +=int64 (_faafb );if _faafb > 0{_cbddd .First =&_cebdg [0].PdfOutlineTreeNode ;_cbddd .Last =&_cebdg [_faafb -1].PdfOutlineTreeNode ;_cbddd .Count =&_acbgf ;
|
||
};return _cbddd ,_acbgf ;};
|
||
|
||
// NewPdfColorspaceICCBased returns a new ICCBased colorspace object.
|
||
func NewPdfColorspaceICCBased (N int )(*PdfColorspaceICCBased ,error ){_dgdga :=&PdfColorspaceICCBased {};if N !=1&&N !=3&&N !=4{return nil ,_d .Errorf ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u004e\u0020\u0028\u0031/\u0033\u002f\u0034\u0029");
|
||
};_dgdga .N =N ;return _dgdga ,nil ;};const (XObjectTypeUndefined XObjectType =iota ;XObjectTypeImage ;XObjectTypeForm ;XObjectTypePS ;XObjectTypeUnknown ;);
|
||
|
||
// AppendContentBytes creates a PDF stream from `cs` and appends it to the
|
||
// array of streams specified by the pages's Contents entry.
|
||
// If `wrapContents` is true, the content stream of the page is wrapped using
|
||
// a `q/Q` operator pair, so that its state does not affect the appended
|
||
// content stream.
|
||
func (_adafe *PdfPage )AppendContentBytes (cs []byte ,wrapContents bool )error {_adead :=_adafe .GetContentStreamObjs ();wrapContents =wrapContents &&len (_adead )> 0;_cfbgf :=_fg .NewFlateEncoder ();_dbaf :=_fg .MakeArray ();if wrapContents {_bcbea ,_aaae :=_fg .MakeStream ([]byte ("\u0071\u000a"),_cfbgf );
|
||
if _aaae !=nil {return _aaae ;};_dbaf .Append (_bcbea );};_dbaf .Append (_adead ...);if wrapContents {_fgdbg ,_fbag :=_fg .MakeStream ([]byte ("\u000a\u0051\u000a"),_cfbgf );if _fbag !=nil {return _fbag ;};_dbaf .Append (_fgdbg );};_ebgag ,_gbcfc :=_fg .MakeStream (cs ,_cfbgf );
|
||
if _gbcfc !=nil {return _gbcfc ;};_dbaf .Append (_ebgag );_adafe .Contents =_dbaf ;return nil ;};func (_abdbb *PdfReader )lookupPageByObject (_bdbfg _fg .PdfObject )(*PdfPage ,error ){return nil ,_ce .New ("\u0070\u0061\u0067\u0065\u0020\u006e\u006f\u0074\u0020f\u006f\u0075\u006e\u0064");
|
||
};
|
||
|
||
// PdfShadingPattern is a Shading patterns that provide a smooth transition between colors across an area to be painted,
|
||
// i.e. color(x,y) = f(x,y) at each point.
|
||
// It is a type 2 pattern (PatternType = 2).
|
||
type PdfShadingPattern struct{*PdfPattern ;Shading *PdfShading ;Matrix *_fg .PdfObjectArray ;ExtGState _fg .PdfObject ;};
|
||
|
||
// NewPdfAnnotationInk returns a new ink annotation.
|
||
func NewPdfAnnotationInk ()*PdfAnnotationInk {_gbdg :=NewPdfAnnotation ();_aca :=&PdfAnnotationInk {};_aca .PdfAnnotation =_gbdg ;_aca .PdfAnnotationMarkup =&PdfAnnotationMarkup {};_gbdg .SetContext (_aca );return _aca ;};
|
||
|
||
// ToPdfObject returns the PDF representation of the colorspace.
|
||
func (_bgfaa *PdfColorspaceSpecialSeparation )ToPdfObject ()_fg .PdfObject {_cfad :=_fg .MakeArray (_fg .MakeName ("\u0053\u0065\u0070\u0061\u0072\u0061\u0074\u0069\u006f\u006e"));_cfad .Append (_bgfaa .ColorantName );_cfad .Append (_bgfaa .AlternateSpace .ToPdfObject ());
|
||
_cfad .Append (_bgfaa .TintTransform .ToPdfObject ());if _bgfaa ._adacb !=nil {_bgfaa ._adacb .PdfObject =_cfad ;return _bgfaa ._adacb ;};return _cfad ;};
|
||
|
||
// Encoder returns the font's text encoder.
|
||
func (_gfcgd pdfFontType3 )Encoder ()_dg .TextEncoder {return _gfcgd ._efad };func _debe (_gbdee _fg .PdfObject )(*PdfFunctionType2 ,error ){_fgbbc :=&PdfFunctionType2 {};var _ffef *_fg .PdfObjectDictionary ;if _abeaf ,_aebe :=_gbdee .(*_fg .PdfIndirectObject );
|
||
_aebe {_ggega ,_cbgd :=_abeaf .PdfObject .(*_fg .PdfObjectDictionary );if !_cbgd {return nil ,_ce .New ("\u0074\u0079p\u0065\u0020\u0063h\u0065\u0063\u006b\u0020\u0065\u0072\u0072\u006f\u0072");};_fgbbc ._aceef =_abeaf ;_ffef =_ggega ;}else if _dbgae ,_ccbbf :=_gbdee .(*_fg .PdfObjectDictionary );
|
||
_ccbbf {_ffef =_dbgae ;}else {return nil ,_ce .New ("\u0074\u0079p\u0065\u0020\u0063h\u0065\u0063\u006b\u0020\u0065\u0072\u0072\u006f\u0072");};_aa .Log .Trace ("\u0046U\u004e\u0043\u0032\u003a\u0020\u0025s",_ffef .String ());_gggfc ,_fbdg :=_fg .TraceToDirectObject (_ffef .Get ("\u0044\u006f\u006d\u0061\u0069\u006e")).(*_fg .PdfObjectArray );
|
||
if !_fbdg {_aa .Log .Error ("D\u006fm\u0061\u0069\u006e\u0020\u006e\u006f\u0074\u0020s\u0070\u0065\u0063\u0069fi\u0065\u0064");return nil ,_ce .New ("\u0072\u0065q\u0075\u0069\u0072\u0065d\u0020\u0061t\u0074\u0072\u0069\u0062\u0075\u0074\u0065\u0020m\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u006f\u0072\u0020\u0069\u006ev\u0061\u006c\u0069\u0064");
|
||
};if _gggfc .Len ()< 0||_gggfc .Len ()%2!=0{_aa .Log .Error ("D\u006fm\u0061\u0069\u006e\u0020\u0072\u0061\u006e\u0067e\u0020\u0069\u006e\u0076al\u0069\u0064");return nil ,_ce .New ("i\u006ev\u0061\u006c\u0069\u0064\u0020\u0064\u006f\u006da\u0069\u006e\u0020\u0072an\u0067\u0065");
|
||
};_cegc ,_gbcf :=_gggfc .ToFloat64Array ();if _gbcf !=nil {return nil ,_gbcf ;};_fgbbc .Domain =_cegc ;_gggfc ,_fbdg =_fg .TraceToDirectObject (_ffef .Get ("\u0052\u0061\u006eg\u0065")).(*_fg .PdfObjectArray );if _fbdg {if _gggfc .Len ()< 0||_gggfc .Len ()%2!=0{return nil ,_ce .New ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0072\u0061\u006e\u0067\u0065");
|
||
};_ecgge ,_febb :=_gggfc .ToFloat64Array ();if _febb !=nil {return nil ,_febb ;};_fgbbc .Range =_ecgge ;};_gggfc ,_fbdg =_fg .TraceToDirectObject (_ffef .Get ("\u0043\u0030")).(*_fg .PdfObjectArray );if _fbdg {_cbge ,_dece :=_gggfc .ToFloat64Array ();if _dece !=nil {return nil ,_dece ;
|
||
};_fgbbc .C0 =_cbge ;};_gggfc ,_fbdg =_fg .TraceToDirectObject (_ffef .Get ("\u0043\u0031")).(*_fg .PdfObjectArray );if _fbdg {_eage ,_cgfdf :=_gggfc .ToFloat64Array ();if _cgfdf !=nil {return nil ,_cgfdf ;};_fgbbc .C1 =_eage ;};if len (_fgbbc .C0 )!=len (_fgbbc .C1 ){_aa .Log .Error ("\u0043\u0030\u0020\u0061nd\u0020\u0043\u0031\u0020\u006e\u006f\u0074\u0020\u006d\u0061\u0074\u0063\u0068\u0069n\u0067");
|
||
return nil ,_fg .ErrRangeError ;};N ,_gbcf :=_fg .GetNumberAsFloat (_fg .TraceToDirectObject (_ffef .Get ("\u004e")));if _gbcf !=nil {_aa .Log .Error ("\u004e\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020o\u0072\u0020\u0069\u006e\u0076\u0061\u006ci\u0064\u002c\u0020\u0064\u0069\u0063\u0074\u003a\u0020\u0025\u0073",_ffef .String ());
|
||
return nil ,_gbcf ;};_fgbbc .N =N ;return _fgbbc ,nil ;};
|
||
|
||
// FieldAppearanceGenerator generates appearance stream for a given field.
|
||
type FieldAppearanceGenerator interface{ContentStreamWrapper ;GenerateAppearanceDict (_eecdb *PdfAcroForm ,_acgge *PdfField ,_bfbga *PdfAnnotationWidget )(*_fg .PdfObjectDictionary ,error );};
|
||
|
||
// NewLTV returns a new LTV client.
|
||
func NewLTV (appender *PdfAppender )(*LTV ,error ){_bgdgb :=appender .Reader .DSS ;if _bgdgb ==nil {_bgdgb =NewDSS ();};if _bdddb :=_bgdgb .GenerateHashMaps ();_bdddb !=nil {return nil ,_bdddb ;};return <V {CertClient :_af .NewCertClient (),OCSPClient :_af .NewOCSPClient (),CRLClient :_af .NewCRLClient (),SkipExisting :true ,_edgba :appender ,_ebbe :_bgdgb },nil ;
|
||
};func _gaccf (_bgdf *_fg .PdfObjectDictionary )(*PdfShadingType3 ,error ){_ggefca :=PdfShadingType3 {};_aacag :=_bgdf .Get ("\u0043\u006f\u006f\u0072\u0064\u0073");if _aacag ==nil {_aa .Log .Debug ("\u0052\u0065\u0071ui\u0072\u0065\u0064\u0020\u0061\u0074\u0074\u0072\u0069b\u0075t\u0065 \u006di\u0073\u0073\u0069\u006e\u0067\u003a\u0020\u0043\u006f\u006f\u0072\u0064\u0073");
|
||
return nil ,ErrRequiredAttributeMissing ;};_eeggb ,_edcgf :=_aacag .(*_fg .PdfObjectArray );if !_edcgf {_aa .Log .Debug ("\u0043\u006f\u006f\u0072d\u0073\u0020\u006e\u006f\u0074\u0020\u0061\u006e\u0020\u0061r\u0072a\u0079\u0020\u0028\u0067\u006f\u0074\u0020%\u0054\u0029",_aacag );
|
||
return nil ,_fg .ErrTypeError ;};if _eeggb .Len ()!=6{_aa .Log .Debug ("\u0043\u006f\u006f\u0072d\u0073\u0020\u006c\u0065\u006e\u0067\u0074\u0068\u0020\u006eo\u0074 \u0036\u0020\u0028\u0067\u006f\u0074\u0020%\u0064\u0029",_eeggb .Len ());return nil ,ErrInvalidAttribute ;
|
||
};_ggefca .Coords =_eeggb ;if _adbgeg :=_bgdf .Get ("\u0044\u006f\u006d\u0061\u0069\u006e");_adbgeg !=nil {_adbgeg =_fg .TraceToDirectObject (_adbgeg );_gaegc ,_fabdf :=_adbgeg .(*_fg .PdfObjectArray );if !_fabdf {_aa .Log .Debug ("\u0044\u006f\u006d\u0061i\u006e\u0020\u006e\u006f\u0074\u0020\u0061\u006e\u0020\u0061r\u0072a\u0079\u0020\u0028\u0067\u006f\u0074\u0020%\u0054\u0029",_adbgeg );
|
||
return nil ,_fg .ErrTypeError ;};_ggefca .Domain =_gaegc ;};_aacag =_bgdf .Get ("\u0046\u0075\u006e\u0063\u0074\u0069\u006f\u006e");if _aacag ==nil {_aa .Log .Debug ("\u0052\u0065q\u0075\u0069\u0072\u0065d\u0020\u0061t\u0074\u0072\u0069\u0062\u0075\u0074\u0065\u0020m\u0069\u0073\u0073\u0069\u006e\u0067\u003a\u0020\u0020\u0046\u0075\u006ec\u0074\u0069\u006f\u006e");
|
||
return nil ,ErrRequiredAttributeMissing ;};_ggefca .Function =[]PdfFunction {};if _gdcgac ,_baddb :=_aacag .(*_fg .PdfObjectArray );_baddb {for _ ,_gacbf :=range _gdcgac .Elements (){_ceafc ,_ecbdd :=_defgb (_gacbf );if _ecbdd !=nil {_aa .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0070\u0061\u0072\u0073\u0069n\u0067\u0020\u0066\u0075\u006e\u0063\u0074\u0069\u006f\u006e:\u0020\u0025\u0076",_ecbdd );
|
||
return nil ,_ecbdd ;};_ggefca .Function =append (_ggefca .Function ,_ceafc );};}else {_ffffg ,_bgdfg :=_defgb (_aacag );if _bgdfg !=nil {_aa .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0070\u0061\u0072\u0073\u0069n\u0067\u0020\u0066\u0075\u006e\u0063\u0074\u0069\u006f\u006e:\u0020\u0025\u0076",_bgdfg );
|
||
return nil ,_bgdfg ;};_ggefca .Function =append (_ggefca .Function ,_ffffg );};if _bacee :=_bgdf .Get ("\u0045\u0078\u0074\u0065\u006e\u0064");_bacee !=nil {_bacee =_fg .TraceToDirectObject (_bacee );_fgega ,_caeb :=_bacee .(*_fg .PdfObjectArray );if !_caeb {_aa .Log .Debug ("\u004d\u0061\u0074\u0072i\u0078\u0020\u006e\u006f\u0074\u0020\u0061\u006e\u0020\u0061r\u0072a\u0079\u0020\u0028\u0067\u006f\u0074\u0020%\u0054\u0029",_bacee );
|
||
return nil ,_fg .ErrTypeError ;};if _fgega .Len ()!=2{_aa .Log .Debug ("\u0045\u0078\u0074\u0065n\u0064\u0020\u006c\u0065\u006e\u0067\u0074\u0068\u0020\u006eo\u0074 \u0032\u0020\u0028\u0067\u006f\u0074\u0020%\u0064\u0029",_fgega .Len ());return nil ,ErrInvalidAttribute ;
|
||
};_ggefca .Extend =_fgega ;};return &_ggefca ,nil ;};
|
||
|
||
// GetRotate gets the inheritable rotate value, either from the page
|
||
// or a higher up page/pages struct.
|
||
func (_acgaf *PdfPage )GetRotate ()(int64 ,error ){if _acgaf .Rotate !=nil {return *_acgaf .Rotate ,nil ;};_dafd :=_acgaf .Parent ;for _dafd !=nil {_bbcgf ,_ecafc :=_fg .GetDict (_dafd );if !_ecafc {return 0,_ce .New ("\u0069\u006e\u0076\u0061\u006c\u0069d\u0020\u0070\u0061\u0072\u0065\u006e\u0074\u0020\u006f\u0062\u006a\u0065\u0063t\u0073\u0020\u0064\u0069\u0063\u0074\u0069o\u006e\u0061\u0072\u0079");
|
||
};if _ebde :=_bbcgf .Get ("\u0052\u006f\u0074\u0061\u0074\u0065");_ebde !=nil {_geaad ,_feceb :=_fg .GetInt (_ebde );if !_feceb {return 0,_ce .New ("i\u006ev\u0061\u006c\u0069\u0064\u0020\u0072\u006f\u0074a\u0074\u0065\u0020\u0076al\u0075\u0065");};if _geaad !=nil {return int64 (*_geaad ),nil ;
|
||
};return 0,_ce .New ("\u0072\u006f\u0074\u0061te\u0020\u0076\u0061\u006c\u0075\u0065\u0020\u0069\u0073\u0020\u006e\u0069\u006c");};_dafd =_bbcgf .Get ("\u0050\u0061\u0072\u0065\u006e\u0074");};return 0,_ce .New ("\u0072o\u0074a\u0074\u0065\u0020\u006e\u006ft\u0020\u0064e\u0066\u0069\u006e\u0065\u0064");
|
||
};
|
||
|
||
// GetNumComponents returns the number of color components (3 for CalRGB).
|
||
func (_egdcd *PdfColorCalRGB )GetNumComponents ()int {return 3};
|
||
|
||
// MergePageWith appends page content to source Pdf file page content.
|
||
func (_gccf *PdfAppender )MergePageWith (pageNum int ,page *PdfPage )error {_eefd :=pageNum -1;var _bcc *PdfPage ;for _dage ,_fde :=range _gccf ._agbg {if _dage ==_eefd {_bcc =_fde ;};};if _bcc ==nil {return _d .Errorf ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0050\u0061\u0067\u0065\u0020\u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061r\u0079\u0020\u0025\u0064\u0020\u006e\u006f\u0074\u0020f\u006f\u0075\u006e\u0064\u0020\u0069\u006e\u0020\u0074\u0068\u0065\u0020\u0073o\u0075\u0072\u0063\u0065\u0020\u0064o\u0063\u0075\u006de\u006e\u0074",pageNum );
|
||
};if _bcc ._aebf !=nil &&_bcc ._aebf .GetParser ()==_gccf ._cbb ._ccgg {_bcc =_bcc .Duplicate ();_gccf ._agbg [_eefd ]=_bcc ;};page =page .Duplicate ();_dgfg (page );_ecacg :=_egcg (_bcc );_bcbc :=_egcg (page );_gcccd :=make (map[_fg .PdfObjectName ]_fg .PdfObjectName );
|
||
for _eege :=range _bcbc {if _ ,_efaa :=_ecacg [_eege ];_efaa {for _ebab :=1;true ;_ebab ++{_bdeg :=_fg .PdfObjectName (string (_eege )+_bad .Itoa (_ebab ));if _ ,_gbbbc :=_ecacg [_bdeg ];!_gbbbc {_gcccd [_eege ]=_bdeg ;break ;};};};};_deeg ,_fdgd :=page .GetContentStreams ();
|
||
if _fdgd !=nil {return _fdgd ;};_gbeg ,_fdgd :=_bcc .GetContentStreams ();if _fdgd !=nil {return _fdgd ;};for _gbge ,_adage :=range _deeg {for _gdd ,_egff :=range _gcccd {_adage =_dc .Replace (_adage ,"\u002f"+string (_gdd ),"\u002f"+string (_egff ),-1);
|
||
};_deeg [_gbge ]=_adage ;};_gbeg =append (_gbeg ,_deeg ...);if _caeg :=_bcc .SetContentStreams (_gbeg ,_fg .NewFlateEncoder ());_caeg !=nil {return _caeg ;};_bcc ._fbbb =append (_bcc ._fbbb ,page ._fbbb ...);if _bcc .Resources ==nil {_bcc .Resources =NewPdfPageResources ();
|
||
};if page .Resources !=nil {_bcc .Resources .Font =_gccf .mergeResources (_bcc .Resources .Font ,page .Resources .Font ,_gcccd );_bcc .Resources .XObject =_gccf .mergeResources (_bcc .Resources .XObject ,page .Resources .XObject ,_gcccd );_bcc .Resources .Properties =_gccf .mergeResources (_bcc .Resources .Properties ,page .Resources .Properties ,_gcccd );
|
||
if _bcc .Resources .ProcSet ==nil {_bcc .Resources .ProcSet =page .Resources .ProcSet ;};_bcc .Resources .Shading =_gccf .mergeResources (_bcc .Resources .Shading ,page .Resources .Shading ,_gcccd );_bcc .Resources .ExtGState =_gccf .mergeResources (_bcc .Resources .ExtGState ,page .Resources .ExtGState ,_gcccd );
|
||
};_edaf ,_fdgd :=_bcc .GetMediaBox ();if _fdgd !=nil {return _fdgd ;};_fddb ,_fdgd :=page .GetMediaBox ();if _fdgd !=nil {return _fdgd ;};var _bcbb bool ;if _edaf .Llx > _fddb .Llx {_edaf .Llx =_fddb .Llx ;_bcbb =true ;};if _edaf .Lly > _fddb .Lly {_edaf .Lly =_fddb .Lly ;
|
||
_bcbb =true ;};if _edaf .Urx < _fddb .Urx {_edaf .Urx =_fddb .Urx ;_bcbb =true ;};if _edaf .Ury < _fddb .Ury {_edaf .Ury =_fddb .Ury ;_bcbb =true ;};if _bcbb {_bcc .MediaBox =_edaf ;};return nil ;};
|
||
|
||
// GetFontDescriptor returns the font descriptor for `font`.
|
||
func (_abea PdfFont )GetFontDescriptor ()(*PdfFontDescriptor ,error ){return _abea ._gcaeff .getFontDescriptor (),nil ;};
|
||
|
||
// SetOCProperties sets the optional content properties.
|
||
func (_ffgbff *PdfWriter )SetOCProperties (ocProperties _fg .PdfObject )error {_eagce :=_ffgbff ._cgacf ;if ocProperties !=nil {_aa .Log .Trace ("\u0053e\u0074\u0074\u0069\u006e\u0067\u0020\u004f\u0043\u0020\u0050\u0072o\u0070\u0065\u0072\u0074\u0069\u0065\u0073\u002e\u002e\u002e");
|
||
_eagce .Set ("\u004f\u0043\u0050r\u006f\u0070\u0065\u0072\u0074\u0069\u0065\u0073",ocProperties );return _ffgbff .addObjects (ocProperties );};return nil ;};
|
||
|
||
// ToPdfObject returns a PdfObject representation of PdfColorspaceDeviceNAttributes as a PdfObjectDictionary directly
|
||
// or indirectly within an indirect object container.
|
||
func (_geae *PdfColorspaceDeviceNAttributes )ToPdfObject ()_fg .PdfObject {_aeddf :=_fg .MakeDict ();if _geae .Subtype !=nil {_aeddf .Set ("\u0053u\u0062\u0074\u0079\u0070\u0065",_geae .Subtype );};_aeddf .SetIfNotNil ("\u0043o\u006c\u006f\u0072\u0061\u006e\u0074s",_geae .Colorants );
|
||
_aeddf .SetIfNotNil ("\u0050r\u006f\u0063\u0065\u0073\u0073",_geae .Process );_aeddf .SetIfNotNil ("M\u0069\u0078\u0069\u006e\u0067\u0048\u0069\u006e\u0074\u0073",_geae .MixingHints );if _geae ._eagf !=nil {_geae ._eagf .PdfObject =_aeddf ;return _geae ._eagf ;
|
||
};return _aeddf ;};
|
||
|
||
// SetPdfCreator sets the Creator attribute of the output PDF.
|
||
func SetPdfCreator (creator string ){_baacg .Lock ();defer _baacg .Unlock ();_gfebcg =creator };
|
||
|
||
// ColorFromFloats returns a new PdfColor based on the input slice of color
|
||
// components. The slice should contain three elements representing the
|
||
// red, green and blue components of the color. The values of the elements
|
||
// should be between 0 and 1.
|
||
func (_eeeb *PdfColorspaceDeviceRGB )ColorFromFloats (vals []float64 )(PdfColor ,error ){if len (vals )!=3{return nil ,_ce .New ("r\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b");};_geaf :=vals [0];if _geaf < 0.0||_geaf > 1.0{_aa .Log .Debug ("\u0063\u006f\u006cor\u0020\u006f\u0075\u0074\u0020\u006f\u0066\u0020\u0043\u0053\u0020\u0072\u0061\u006e\u0067\u0065\u003a\u0020",_geaf );
|
||
return nil ,ErrColorOutOfRange ;};_bgcg :=vals [1];if _bgcg < 0.0||_bgcg > 1.0{_aa .Log .Debug ("\u0063\u006f\u006cor\u0020\u006f\u0075\u0074\u0020\u006f\u0066\u0020\u0043\u0053\u0020\u0072\u0061\u006e\u0067\u0065\u003a\u0020",_geaf );return nil ,ErrColorOutOfRange ;
|
||
};_bccd :=vals [2];if _bccd < 0.0||_bccd > 1.0{_aa .Log .Debug ("\u0063\u006f\u006cor\u0020\u006f\u0075\u0074\u0020\u006f\u0066\u0020\u0043\u0053\u0020\u0072\u0061\u006e\u0067\u0065\u003a\u0020",_geaf );return nil ,ErrColorOutOfRange ;};_cfaa :=NewPdfColorDeviceRGB (_geaf ,_bgcg ,_bccd );
|
||
return _cfaa ,nil ;};
|
||
|
||
// NewXObjectImageFromImage creates a new XObject Image from an image object
|
||
// with default options. If encoder is nil, uses raw encoding (none).
|
||
func NewXObjectImageFromImage (img *Image ,cs PdfColorspace ,encoder _fg .StreamEncoder )(*XObjectImage ,error ){_agcef :=NewXObjectImage ();return UpdateXObjectImageFromImage (_agcef ,img ,cs ,encoder );};
|
||
|
||
// LTV represents an LTV (Long-Term Validation) client. It is used to LTV
|
||
// enable signatures by adding validation and revocation data (certificate,
|
||
// OCSP and CRL information) to the DSS dictionary of a PDF document.
|
||
//
|
||
// LTV is added through the DSS by:
|
||
// - Adding certificates, OCSP and CRL information in the global scope of the
|
||
// DSS. The global data is used for validating any of the signatures present
|
||
// in the document.
|
||
// - Adding certificates, OCSP and CRL information for a single signature,
|
||
// through an entry in the VRI dictionary of the DSS. The added data is used
|
||
// for validating that particular signature only. This is the recommended
|
||
// method for adding validation data for a signature. However, this is not
|
||
// is not possible in the same revision the signature is applied. Validation
|
||
// data for a signature is added based on the Contents entry of the signature,
|
||
// which is known only after the revision is written. Even if the Contents
|
||
// are known (e.g. when signing externally), updating the DSS at that point
|
||
// would invalidate the calculated signature. As a result, if adding LTV
|
||
// in the same revision is a requirement, use the first method.
|
||
// See LTV.EnableChain.
|
||
// The client applies both methods, when possible.
|
||
//
|
||
// If `LTV.SkipExisting` is set to true (the default), validations are
|
||
// not added for signatures which are already present in the VRI entry of the
|
||
// document's DSS dictionary.
|
||
type LTV struct{
|
||
|
||
// CertClient is the client used to retrieve certificates.
|
||
CertClient *_af .CertClient ;
|
||
|
||
// OCSPClient is the client used to retrieve OCSP validation information.
|
||
OCSPClient *_af .OCSPClient ;
|
||
|
||
// CRLClient is the client used to retrieve CRL validation information.
|
||
CRLClient *_af .CRLClient ;
|
||
|
||
// SkipExisting specifies whether existing signature validations
|
||
// should be skipped.
|
||
SkipExisting bool ;_edgba *PdfAppender ;_ebbe *DSS ;};
|
||
|
||
// Encoder returns the font's text encoder.
|
||
func (_acefc pdfCIDFontType0 )Encoder ()_dg .TextEncoder {return _acefc ._bcbg };
|
||
|
||
// UpdatePage updates the `page` in the new revision if it has changed.
|
||
func (_eaag *PdfAppender )UpdatePage (page *PdfPage ){_eaag .updateObjectsDeep (page .ToPdfObject (),nil )};
|
||
|
||
// SetType sets the field button's type. Can be one of:
|
||
// - PdfFieldButtonPush for push button fields
|
||
// - PdfFieldButtonCheckbox for checkbox fields
|
||
// - PdfFieldButtonRadio for radio button fields
|
||
// This sets the field's flag appropriately.
|
||
func (_cdbcg *PdfFieldButton )SetType (btype ButtonType ){_ecfee :=uint32 (0);if _cdbcg .Ff !=nil {_ecfee =uint32 (*_cdbcg .Ff );};switch btype {case ButtonTypePush :_ecfee |=FieldFlagPushbutton .Mask ();case ButtonTypeRadio :_ecfee |=FieldFlagRadio .Mask ();
|
||
};_cdbcg .Ff =_fg .MakeInteger (int64 (_ecfee ));};func (_aad *PdfReader )newPdfAnnotationSquareFromDict (_eeead *_fg .PdfObjectDictionary )(*PdfAnnotationSquare ,error ){_ada :=PdfAnnotationSquare {};_bdfb ,_afbc :=_aad .newPdfAnnotationMarkupFromDict (_eeead );
|
||
if _afbc !=nil {return nil ,_afbc ;};_ada .PdfAnnotationMarkup =_bdfb ;_ada .BS =_eeead .Get ("\u0042\u0053");_ada .IC =_eeead .Get ("\u0049\u0043");_ada .BE =_eeead .Get ("\u0042\u0045");_ada .RD =_eeead .Get ("\u0052\u0044");return &_ada ,nil ;};func (_bge *PdfAnnotationMarkup )appendToPdfDictionary (_ecfd *_fg .PdfObjectDictionary ){_ecfd .SetIfNotNil ("\u0054",_bge .T );
|
||
if _bge .Popup !=nil {_ecfd .Set ("\u0050\u006f\u0070u\u0070",_bge .Popup .ToPdfObject ());};_ecfd .SetIfNotNil ("\u0043\u0041",_bge .CA );_ecfd .SetIfNotNil ("\u0052\u0043",_bge .RC );_ecfd .SetIfNotNil ("\u0043\u0072\u0065a\u0074\u0069\u006f\u006e\u0044\u0061\u0074\u0065",_bge .CreationDate );
|
||
_ecfd .SetIfNotNil ("\u0049\u0052\u0054",_bge .IRT );_ecfd .SetIfNotNil ("\u0053\u0075\u0062\u006a",_bge .Subj );_ecfd .SetIfNotNil ("\u0052\u0054",_bge .RT );_ecfd .SetIfNotNil ("\u0049\u0054",_bge .IT );_ecfd .SetIfNotNil ("\u0045\u0078\u0044\u0061\u0074\u0061",_bge .ExData );
|
||
};
|
||
|
||
// NewPdfActionGoTo returns a new "go to" action.
|
||
func NewPdfActionGoTo ()*PdfActionGoTo {_cd :=NewPdfAction ();_cba :=&PdfActionGoTo {};_cba .PdfAction =_cd ;_cd .SetContext (_cba );return _cba ;};
|
||
|
||
// NewOutlineBookmark returns an initialized PdfOutlineItem for a given bookmark title and page.
|
||
func NewOutlineBookmark (title string ,page *_fg .PdfIndirectObject )*PdfOutlineItem {_egga :=PdfOutlineItem {};_egga ._gfcge =&_egga ;_egga .Title =_fg .MakeString (title );_fdee :=_fg .MakeArray ();_fdee .Append (page );_fdee .Append (_fg .MakeName ("\u0046\u0069\u0074"));
|
||
_egga .Dest =_fdee ;return &_egga ;};func _egbc (_dfedd []byte )([]byte ,error ){_cdaef :=_gee .New ();if _ ,_ceag :=_ff .Copy (_cdaef ,_cb .NewReader (_dfedd ));_ceag !=nil {return nil ,_ceag ;};return _cdaef .Sum (nil ),nil ;};func (_aafed *PdfFilespec )getDict ()*_fg .PdfObjectDictionary {if _gacd ,_adbb :=_aafed ._ccbdc .(*_fg .PdfIndirectObject );
|
||
_adbb {_debad ,_ffddg :=_gacd .PdfObject .(*_fg .PdfObjectDictionary );if !_ffddg {return nil ;};return _debad ;}else if _ggbabd ,_abcfe :=_aafed ._ccbdc .(*_fg .PdfObjectDictionary );_abcfe {return _ggbabd ;}else {_aa .Log .Debug ("\u0054\u0072\u0079\u0069\u006e\u0067\u0020\u0074\u006f\u0020\u0061\u0063\u0063\u0065\u0073\u0073\u0020F\u0069\u006c\u0065\u0073\u0070\u0065\u0063\u0020\u0064\u0069c\u0074\u0069\u006f\u006e\u0061\u0072\u0079\u0020\u006f\u0066\u0020\u0069\u006e\u0076\u0061\u006c\u0069\u0064 \u006f\u0062\u006a\u0065\u0063\u0074 \u0074\u0079p\u0065\u0020(\u0025T\u0029",_aafed ._ccbdc );
|
||
return nil ;};};
|
||
|
||
// NewPdfAnnotationLink returns a new link annotation.
|
||
func NewPdfAnnotationLink ()*PdfAnnotationLink {_gbg :=NewPdfAnnotation ();_fge :=&PdfAnnotationLink {};_fge .PdfAnnotation =_gbg ;_gbg .SetContext (_fge );return _fge ;};func _dcfa (_geeab *XObjectImage )error {if _geeab .SMask ==nil {return nil ;};_fbcce ,_dbbfef :=_geeab .SMask .(*_fg .PdfObjectStream );
|
||
if !_dbbfef {_aa .Log .Debug ("\u0053\u004da\u0073\u006b\u0020\u0069\u0073\u0020\u006e\u006f\u0074\u0020\u002a\u0050\u0064\u0066\u004f\u0062\u006a\u0065\u0063\u0074\u0053\u0074re\u0061\u006d");return _fg .ErrTypeError ;};_efabag :=_fbcce .PdfObjectDictionary ;
|
||
_gacag :=_efabag .Get ("\u004d\u0061\u0074t\u0065");if _gacag ==nil {return nil ;};_dfdc ,_bfaf :=_ggdd (_gacag .(*_fg .PdfObjectArray ));if _bfaf !=nil {return _bfaf ;};_cfccad :=_fg .MakeArrayFromFloats ([]float64 {_dfdc });_efabag .SetIfNotNil ("\u004d\u0061\u0074t\u0065",_cfccad );
|
||
return nil ;};func (_ggce *PdfReader )newPdfAnnotationPolygonFromDict (_ffec *_fg .PdfObjectDictionary )(*PdfAnnotationPolygon ,error ){_agea :=PdfAnnotationPolygon {};_bed ,_deec :=_ggce .newPdfAnnotationMarkupFromDict (_ffec );if _deec !=nil {return nil ,_deec ;
|
||
};_agea .PdfAnnotationMarkup =_bed ;_agea .Vertices =_ffec .Get ("\u0056\u0065\u0072\u0074\u0069\u0063\u0065\u0073");_agea .LE =_ffec .Get ("\u004c\u0045");_agea .BS =_ffec .Get ("\u0042\u0053");_agea .IC =_ffec .Get ("\u0049\u0043");_agea .BE =_ffec .Get ("\u0042\u0045");
|
||
_agea .IT =_ffec .Get ("\u0049\u0054");_agea .Measure =_ffec .Get ("\u004de\u0061\u0073\u0075\u0072\u0065");return &_agea ,nil ;};
|
||
|
||
// PdfAnnotationFreeText represents FreeText annotations.
|
||
// (Section 12.5.6.6).
|
||
type PdfAnnotationFreeText struct{*PdfAnnotation ;*PdfAnnotationMarkup ;DA _fg .PdfObject ;Q _fg .PdfObject ;RC _fg .PdfObject ;DS _fg .PdfObject ;CL _fg .PdfObject ;IT _fg .PdfObject ;BE _fg .PdfObject ;RD _fg .PdfObject ;BS _fg .PdfObject ;LE _fg .PdfObject ;
|
||
};
|
||
|
||
// DecodeArray returns the component range values for the Indexed colorspace.
|
||
func (_feb *PdfColorspaceSpecialIndexed )DecodeArray ()[]float64 {return []float64 {0,float64 (_feb .HiVal )};};func _cdaad (_dfcbg *PdfField ,_bcbda _fg .PdfObject ){for _ ,_fafa :=range _dfcbg .Annotations {_fafa .AS =_bcbda ;_fafa .ToPdfObject ();};
|
||
};func (_gfbb *PdfReader )newPdfAnnotationMarkupFromDict (_dfc *_fg .PdfObjectDictionary )(*PdfAnnotationMarkup ,error ){_ffbc :=&PdfAnnotationMarkup {};if _dfga :=_dfc .Get ("\u0054");_dfga !=nil {_ffbc .T =_dfga ;};if _ebc :=_dfc .Get ("\u0050\u006f\u0070u\u0070");
|
||
_ebc !=nil {_fff ,_bdb :=_ebc .(*_fg .PdfIndirectObject );if !_bdb {if _ ,_afb :=_ebc .(*_fg .PdfObjectNull );!_afb {return nil ,_ce .New ("p\u006f\u0070\u0075\u0070\u0020\u0073\u0068\u006f\u0075\u006c\u0064\u0020\u0070\u006f\u0069\u006e\u0074\u0020t\u006f\u0020\u0061\u006e\u0020\u0069\u006e\u0064\u0069\u0072ec\u0074\u0020\u006fb\u006ae\u0063\u0074");
|
||
};}else {_cgf ,_ace :=_gfbb .newPdfAnnotationFromIndirectObject (_fff );if _ace !=nil {return nil ,_ace ;};if _cgf !=nil {_gde ,_cacg :=_cgf ._cbea .(*PdfAnnotationPopup );if !_cacg {return nil ,_ce .New ("\u006f\u0062\u006ae\u0063\u0074\u0020\u006e\u006f\u0074\u0020\u0072\u0065\u0066\u0065\u0072\u0072\u0069\u006e\u0067\u0020\u0074\u006f\u0020\u0061\u0020\u0070\u006f\u0070\u0075\u0070\u0020\u0061n\u006e\u006f\u0074\u0061\u0074\u0069\u006f\u006e");
|
||
};_ffbc .Popup =_gde ;};};};if _ece :=_dfc .Get ("\u0043\u0041");_ece !=nil {_ffbc .CA =_ece ;};if _cfgg :=_dfc .Get ("\u0052\u0043");_cfgg !=nil {_ffbc .RC =_cfgg ;};if _cfce :=_dfc .Get ("\u0043\u0072\u0065a\u0074\u0069\u006f\u006e\u0044\u0061\u0074\u0065");
|
||
_cfce !=nil {_ffbc .CreationDate =_cfce ;};if _ebb :=_dfc .Get ("\u0049\u0052\u0054");_ebb !=nil {_ffbc .IRT =_ebb ;};if _fcbb :=_dfc .Get ("\u0053\u0075\u0062\u006a");_fcbb !=nil {_ffbc .Subj =_fcbb ;};if _bdc :=_dfc .Get ("\u0052\u0054");_bdc !=nil {_ffbc .RT =_bdc ;
|
||
};if _ddac :=_dfc .Get ("\u0049\u0054");_ddac !=nil {_ffbc .IT =_ddac ;};if _ecce :=_dfc .Get ("\u0045\u0078\u0044\u0061\u0074\u0061");_ecce !=nil {_ffbc .ExData =_ecce ;};return _ffbc ,nil ;};func (_eeeggf *PdfReader )resolveReference (_ffcbg *_fg .PdfObjectReference )(_fg .PdfObject ,bool ,error ){_ffag ,_dfef :=_eeeggf ._ccgg .ObjCache [int (_ffcbg .ObjectNumber )];
|
||
if !_dfef {_aa .Log .Trace ("R\u0065\u0061\u0064\u0065r \u004co\u006f\u006b\u0075\u0070\u0020r\u0065\u0066\u003a\u0020\u0025\u0073",_ffcbg );_geabc ,_ggeeg :=_eeeggf ._ccgg .LookupByReference (*_ffcbg );if _ggeeg !=nil {return nil ,false ,_ggeeg ;};_eeeggf ._ccgg .ObjCache [int (_ffcbg .ObjectNumber )]=_geabc ;
|
||
return _geabc ,false ,nil ;};return _ffag ,true ,nil ;};
|
||
|
||
// PdfColorspaceSpecialPattern is a Pattern colorspace.
|
||
// Can be defined either as /Pattern or with an underlying colorspace [/Pattern cs].
|
||
type PdfColorspaceSpecialPattern struct{UnderlyingCS PdfColorspace ;_agcec *_fg .PdfIndirectObject ;};type pdfFont interface{_eed .Font ;
|
||
|
||
// ToPdfObject returns a PDF representation of the font and implements interface Model.
|
||
ToPdfObject ()_fg .PdfObject ;getFontDescriptor ()*PdfFontDescriptor ;baseFields ()*fontCommon ;};
|
||
|
||
// GetRuneMetrics returns the character metrics for the specified rune.
|
||
// A bool flag is returned to indicate whether or not the entry was found.
|
||
func (_fgce pdfFontType3 )GetRuneMetrics (r rune )(_eed .CharMetrics ,bool ){_dbdg :=_fgce .Encoder ();if _dbdg ==nil {_aa .Log .Debug ("\u004e\u006f\u0020en\u0063\u006f\u0064\u0065\u0072\u0020\u0066\u006f\u0072\u0020\u0066\u006f\u006e\u0074\u0073\u003d\u0025\u0073",_fgce );
|
||
return _eed .CharMetrics {},false ;};_degbd ,_degg :=_dbdg .RuneToCharcode (r );if !_degg {if r !=' '{_aa .Log .Trace ("\u004e\u006f\u0020c\u0068\u0061\u0072\u0063o\u0064\u0065\u0020\u0066\u006f\u0072\u0020r\u0075\u006e\u0065\u003d\u0025\u0076\u0020\u0066\u006f\u006e\u0074\u003d\u0025\u0073",r ,_fgce );
|
||
};return _eed .CharMetrics {},false ;};_ddccb ,_gbeec :=_fgce .GetCharMetrics (_degbd );return _ddccb ,_gbeec ;};
|
||
|
||
// ToPdfObject returns the PDF representation of the colorspace.
|
||
func (_fffc *PdfColorspaceDeviceRGB )ToPdfObject ()_fg .PdfObject {return _fg .MakeName ("\u0044e\u0076\u0069\u0063\u0065\u0052\u0047B");};
|
||
|
||
// GetContext returns a reference to the subshading entry as represented by PdfShadingType1-7.
|
||
func (_eeagf *PdfShading )GetContext ()PdfModel {return _eeagf ._bcbef };
|
||
|
||
// PdfOutlineTreeNode contains common fields used by the outline and outline
|
||
// item objects.
|
||
type PdfOutlineTreeNode struct{_gfcge interface{};First *PdfOutlineTreeNode ;Last *PdfOutlineTreeNode ;};
|
||
|
||
// Outline represents a PDF outline dictionary (Table 152 - p. 376).
|
||
// Currently, the Outline object can only be used to construct PDF outlines.
|
||
type Outline struct{Entries []*OutlineItem `json:"entries,omitempty"`;};func (_bbgcg *PdfWriter )writeXRefStreams (_dfffe int ,_cegaa int64 )error {_faccg :=_dfffe +1;_bbgcg ._aafgd [_faccg ]=crossReference {Type :1,ObjectNumber :_faccg ,Offset :_cegaa };
|
||
_dfgef :=_cb .NewBuffer (nil );_fgfg :=_fg .MakeArray ();for _dgcbe :=0;_dgcbe <=_dfffe ;{for ;_dgcbe <=_dfffe ;_dgcbe ++{_dfbgdc ,_bacf :=_bbgcg ._aafgd [_dgcbe ];if _bacf &&(!_bbgcg ._cdafg ||_bbgcg ._cdafg &&(_dfbgdc .Type ==1&&_dfbgdc .Offset >=_bbgcg ._cecef ||_dfbgdc .Type ==0)){break ;
|
||
};};var _ebdbc int ;for _ebdbc =_dgcbe +1;_ebdbc <=_dfffe ;_ebdbc ++{_dbcee ,_gbdbe :=_bbgcg ._aafgd [_ebdbc ];if _gbdbe &&(!_bbgcg ._cdafg ||_bbgcg ._cdafg &&(_dbcee .Type ==1&&_dbcee .Offset > _bbgcg ._cecef )){continue ;};break ;};_fgfg .Append (_fg .MakeInteger (int64 (_dgcbe )),_fg .MakeInteger (int64 (_ebdbc -_dgcbe )));
|
||
for _eggda :=_dgcbe ;_eggda < _ebdbc ;_eggda ++{_cbafa :=_bbgcg ._aafgd [_eggda ];switch _cbafa .Type {case 0:_df .Write (_dfgef ,_df .BigEndian ,byte (0));_df .Write (_dfgef ,_df .BigEndian ,uint32 (0));_df .Write (_dfgef ,_df .BigEndian ,uint16 (0xFFFF));
|
||
case 1:_df .Write (_dfgef ,_df .BigEndian ,byte (1));_df .Write (_dfgef ,_df .BigEndian ,uint32 (_cbafa .Offset ));_df .Write (_dfgef ,_df .BigEndian ,uint16 (_cbafa .Generation ));case 2:_df .Write (_dfgef ,_df .BigEndian ,byte (2));_df .Write (_dfgef ,_df .BigEndian ,uint32 (_cbafa .ObjectNumber ));
|
||
_df .Write (_dfgef ,_df .BigEndian ,uint16 (_cbafa .Index ));};};_dgcbe =_ebdbc +1;};_abbcc ,_fgdef :=_fg .MakeStream (_dfgef .Bytes (),_fg .NewFlateEncoder ());if _fgdef !=nil {return _fgdef ;};_abbcc .ObjectNumber =int64 (_faccg );_abbcc .PdfObjectDictionary .Set ("\u0054\u0079\u0070\u0065",_fg .MakeName ("\u0058\u0052\u0065\u0066"));
|
||
_abbcc .PdfObjectDictionary .Set ("\u0057",_fg .MakeArray (_fg .MakeInteger (1),_fg .MakeInteger (4),_fg .MakeInteger (2)));_abbcc .PdfObjectDictionary .Set ("\u0049\u006e\u0064e\u0078",_fgfg );_abbcc .PdfObjectDictionary .Set ("\u0053\u0069\u007a\u0065",_fg .MakeInteger (int64 (_faccg +1)));
|
||
_abbcc .PdfObjectDictionary .Set ("\u0049\u006e\u0066\u006f",_bbgcg ._deabg );_abbcc .PdfObjectDictionary .Set ("\u0052\u006f\u006f\u0074",_bbgcg ._cegde );if _bbgcg ._cdafg &&_bbgcg ._cgdbf > 0{_abbcc .PdfObjectDictionary .Set ("\u0050\u0072\u0065\u0076",_fg .MakeInteger (_bbgcg ._cgdbf ));
|
||
};if _bbgcg ._bbdbd !=nil {_abbcc .Set ("\u0045n\u0063\u0072\u0079\u0070\u0074",_bbgcg ._abgdg );};if _bbgcg ._dadgc ==nil &&_bbgcg ._deeab !=""&&_bbgcg ._ccccb !=""{_bbgcg ._dadgc =_fg .MakeArray (_fg .MakeHexString (_bbgcg ._deeab ),_fg .MakeHexString (_bbgcg ._ccccb ));
|
||
};if _bbgcg ._dadgc !=nil {_aa .Log .Trace ("\u0049d\u0073\u003a\u0020\u0025\u0073",_bbgcg ._dadgc );_abbcc .Set ("\u0049\u0044",_bbgcg ._dadgc );};_bbgcg .writeObject (int (_abbcc .ObjectNumber ),_abbcc );return nil ;};
|
||
|
||
// SetContentStream updates the content stream with specified encoding.
|
||
// If encoding is null, will use the xform.Filter object or Raw encoding if not set.
|
||
func (_faege *XObjectForm )SetContentStream (content []byte ,encoder _fg .StreamEncoder )error {_fddbc :=content ;if encoder ==nil {if _faege .Filter !=nil {encoder =_faege .Filter ;}else {encoder =_fg .NewRawEncoder ();};};_afda ,_dggfg :=encoder .EncodeBytes (_fddbc );
|
||
if _dggfg !=nil {return _dggfg ;};_fddbc =_afda ;_faege .Stream =_fddbc ;_faege .Filter =encoder ;return nil ;};
|
||
|
||
// ToImage converts an object to an Image which can be transformed or saved out.
|
||
// The image data is decoded and the Image returned.
|
||
func (_egcgb *XObjectImage )ToImage ()(*Image ,error ){_gcbfc :=&Image {};if _egcgb .Height ==nil {return nil ,_ce .New ("\u0068e\u0069\u0067\u0068\u0074\u0020\u0061\u0074\u0074\u0072\u0069\u0062u\u0074\u0065\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067");
|
||
};_gcbfc .Height =*_egcgb .Height ;if _egcgb .Width ==nil {return nil ,_ce .New ("\u0077\u0069\u0064th\u0020\u0061\u0074\u0074\u0072\u0069\u0062\u0075\u0074\u0065\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067");};_gcbfc .Width =*_egcgb .Width ;if _egcgb .BitsPerComponent ==nil {switch _egcgb .Filter .(type ){case *_fg .CCITTFaxEncoder ,*_fg .JBIG2Encoder :_gcbfc .BitsPerComponent =1;
|
||
case *_fg .LZWEncoder ,*_fg .RunLengthEncoder :_gcbfc .BitsPerComponent =8;default:return nil ,_ce .New ("\u0062\u0069\u0074\u0073\u0020\u0070\u0065\u0072\u0020\u0063\u006fm\u0070\u006f\u006e\u0065\u006e\u0074\u0020\u006d\u0069\u0073s\u0069\u006e\u0067");
|
||
};}else {_gcbfc .BitsPerComponent =*_egcgb .BitsPerComponent ;};_gcbfc .ColorComponents =_egcgb .ColorSpace .GetNumComponents ();_egcgb ._eafbc .Set ("\u0043o\u006co\u0072\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074\u0073",_fg .MakeInteger (int64 (_gcbfc .ColorComponents )));
|
||
_fgabc ,_fgcb :=_fg .DecodeStream (_egcgb ._eafbc );if _fgcb !=nil {return nil ,_fgcb ;};_gcbfc .Data =_fgabc ;if _egcgb .Decode !=nil {_fgfbdf ,_aedb :=_egcgb .Decode .(*_fg .PdfObjectArray );if !_aedb {_aa .Log .Debug ("I\u006e\u0076\u0061\u006cid\u0020D\u0065\u0063\u006f\u0064\u0065 \u006f\u0062\u006a\u0065\u0063\u0074");
|
||
return nil ,_ce .New ("\u0069\u006e\u0076a\u006c\u0069\u0064\u0020\u0074\u0079\u0070\u0065");};_dfbae ,_dcfbf :=_fgfbdf .ToFloat64Array ();if _dcfbf !=nil {return nil ,_dcfbf ;};switch _egcgb .ColorSpace .(type ){case *PdfColorspaceDeviceCMYK :_fggfa :=_egcgb .ColorSpace .DecodeArray ();
|
||
if _fggfa [0]==_dfbae [0]&&_fggfa [1]==_dfbae [1]&&_fggfa [2]==_dfbae [2]&&_fggfa [3]==_dfbae [3]{_gcbfc ._dbge =_dfbae ;};default:_gcbfc ._dbge =_dfbae ;};};return _gcbfc ,nil ;};
|
||
|
||
// Permissions specify a permissions dictionary (PDF 1.5).
|
||
// (Section 12.8.4, Table 258 - Entries in a permissions dictionary p. 477 in PDF32000_2008).
|
||
type Permissions struct{DocMDP *PdfSignature ;_gdfff *_fg .PdfObjectDictionary ;};
|
||
|
||
// CompliancePdfReader is a wrapper over PdfReader that is used for verifying if the input Pdf document matches the
|
||
// compliance rules of standards like PDF/A.
|
||
// NOTE: This implementation is in experimental development state.
|
||
// Keep in mind that it might change in the subsequent minor versions.
|
||
type CompliancePdfReader struct{*PdfReader ;_aefc _fg .ParserMetadata ;};
|
||
|
||
// ColorFromFloats returns a new PdfColor based on the input slice of color
|
||
// components. The slice should contain three elements representing the
|
||
// L (range 0-100), A (range -100-100) and B (range -100-100) components of
|
||
// the color.
|
||
func (_fbdf *PdfColorspaceLab )ColorFromFloats (vals []float64 )(PdfColor ,error ){if len (vals )!=3{return nil ,_ce .New ("r\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b");};_ffcdf :=vals [0];if _ffcdf < 0.0||_ffcdf > 100.0{_aa .Log .Debug ("\u004c\u0020\u006f\u0075\u0074\u0020\u006f\u0066\u0020\u0072\u0061\u006e\u0067e\u0020\u0028\u0067\u006f\u0074\u0020%\u0076\u0020\u0073\u0068\u006f\u0075\u006c\u0064\u0020\u0062\u0065\u0020\u0030-\u0031\u0030\u0030\u0029",_ffcdf );
|
||
return nil ,ErrColorOutOfRange ;};_fcgb :=vals [1];_efcc :=float64 (-100);_bdfa :=float64 (100);if len (_fbdf .Range )> 1{_efcc =_fbdf .Range [0];_bdfa =_fbdf .Range [1];};if _fcgb < _efcc ||_fcgb > _bdfa {_aa .Log .Debug ("\u0041\u0020\u006f\u0075\u0074\u0020\u006f\u0066\u0020\u0072\u0061\u006e\u0067e\u0020\u0028\u0067\u006f\u0074\u0020%\u0076\u003b\u0020\u0072\u0061\u006e\u0067\u0065\u0020\u0025\u0076\u0020\u0074o\u0020\u0025\u0076\u0029",_fcgb ,_efcc ,_bdfa );
|
||
return nil ,ErrColorOutOfRange ;};_ebcdc :=vals [2];_dbcf :=float64 (-100);_ebed :=float64 (100);if len (_fbdf .Range )> 3{_dbcf =_fbdf .Range [2];_ebed =_fbdf .Range [3];};if _ebcdc < _dbcf ||_ebcdc > _ebed {_aa .Log .Debug ("\u0062\u0020\u006f\u0075\u0074\u0020\u006f\u0066\u0020\u0072\u0061\u006e\u0067e\u0020\u0028\u0067\u006f\u0074\u0020%\u0076\u003b\u0020\u0072\u0061\u006e\u0067\u0065\u0020\u0025\u0076\u0020\u0074o\u0020\u0025\u0076\u0029",_ebcdc ,_dbcf ,_ebed );
|
||
return nil ,ErrColorOutOfRange ;};_gcgcf :=NewPdfColorLab (_ffcdf ,_fcgb ,_ebcdc );return _gcgcf ,nil ;};func (_cfcc *PdfReader )newPdfAnnotationFromIndirectObject (_cbae *_fg .PdfIndirectObject )(*PdfAnnotation ,error ){_ceb ,_cga :=_cbae .PdfObject .(*_fg .PdfObjectDictionary );
|
||
if !_cga {return nil ,_d .Errorf ("\u0061\u006e\u006e\u006f\u0074\u0061\u0074\u0069\u006f\u006e\u0020\u0069\u006e\u0064\u0069r\u0065\u0063\u0074\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u0020\u006e\u006ft\u0020\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0069\u006e\u0067\u0020a \u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061\u0072\u0079");
|
||
};if model :=_cfcc ._edebb .GetModelFromPrimitive (_ceb );model !=nil {_dbf ,_cgaf :=model .(*PdfAnnotation );if !_cgaf {return nil ,_d .Errorf ("\u0063\u0061\u0063\u0068\u0065\u0064 \u006d\u006f\u0064\u0065\u006c\u0020\u006e\u006f\u0074\u0020\u0061\u0020\u0050D\u0046\u0020\u0061\u006e\u006e\u006f\u0074a\u0074\u0069\u006f\u006e");
|
||
};return _dbf ,nil ;};_cfd :=&PdfAnnotation {};_cfd ._agb =_cbae ;_cfcc ._edebb .Register (_ceb ,_cfd );if _def :=_ceb .Get ("\u0054\u0079\u0070\u0065");_def !=nil {_ffb ,_cebe :=_def .(*_fg .PdfObjectName );if !_cebe {_aa .Log .Trace ("\u0049\u006e\u0063\u006f\u006d\u0070\u0061\u0074\u0069\u0062\u0069\u006c\u0069\u0074\u0079\u0021\u0020\u0049\u006e\u0076a\u006c\u0069\u0064\u0020\u0074\u0079\u0070\u0065\u0020\u006f\u0066\u0020\u0054\u0079\u0070\u0065\u0020\u0028\u0025\u0054\u0029\u0020\u002d\u0020\u0073\u0068\u006f\u0075\u006c\u0064 \u0062\u0065\u0020\u004e\u0061m\u0065",_def );
|
||
}else {if *_ffb !="\u0041\u006e\u006eo\u0074"{_aa .Log .Trace ("\u0055\u006e\u0073\u0075\u0073\u0070\u0065\u0063\u0074\u0065d\u0020\u0054\u0079\u0070\u0065\u0020\u0021=\u0020\u0041\u006e\u006e\u006f\u0074\u0020\u0028\u0025\u0073\u0029",*_ffb );};};};if _bcd :=_ceb .Get ("\u0052\u0065\u0063\u0074");
|
||
_bcd !=nil {_cfd .Rect =_bcd ;};if _ead :=_ceb .Get ("\u0043\u006f\u006e\u0074\u0065\u006e\u0074\u0073");_ead !=nil {_cfd .Contents =_ead ;};if _ebe :=_ceb .Get ("\u0050");_ebe !=nil {_cfd .P =_ebe ;};if _fab :=_ceb .Get ("\u004e\u004d");_fab !=nil {_cfd .NM =_fab ;
|
||
};if _eaf :=_ceb .Get ("\u004d");_eaf !=nil {_cfd .M =_eaf ;};if _ecf :=_ceb .Get ("\u0046");_ecf !=nil {_cfd .F =_ecf ;};if _aff :=_ceb .Get ("\u0041\u0050");_aff !=nil {_cfd .AP =_aff ;};if _adb :=_ceb .Get ("\u0041\u0053");_adb !=nil {_cfd .AS =_adb ;
|
||
};if _ebf :=_ceb .Get ("\u0042\u006f\u0072\u0064\u0065\u0072");_ebf !=nil {_cfd .Border =_ebf ;};if _cab :=_ceb .Get ("\u0043");_cab !=nil {_cfd .C =_cab ;};if _daa :=_ceb .Get ("\u0053\u0074\u0072u\u0063\u0074\u0050\u0061\u0072\u0065\u006e\u0074");_daa !=nil {_cfd .StructParent =_daa ;
|
||
};if _dcdg :=_ceb .Get ("\u004f\u0043");_dcdg !=nil {_cfd .OC =_dcdg ;};_dgac :=_ceb .Get ("\u0053u\u0062\u0074\u0079\u0070\u0065");if _dgac ==nil {_aa .Log .Debug ("\u0057\u0041\u0052\u004e\u0049\u004e\u0047:\u0020\u0043\u006f\u006d\u0070\u0061\u0074\u0069\u0062\u0069\u006c\u0069\u0074\u0079 \u0069s\u0073\u0075\u0065\u0020\u002d\u0020a\u006e\u006e\u006f\u0074\u0061\u0074\u0069o\u006e\u0020\u0053\u0075\u0062\u0074\u0079\u0070\u0065\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u002d\u0020\u0061\u0073\u0073u\u006d\u0069\u006e\u0067\u0020\u006e\u006f\u0020\u0073\u0075\u0062\u0074\u0079p\u0065");
|
||
_cfd ._cbea =nil ;return _cfd ,nil ;};_dceg ,_eeg :=_dgac .(*_fg .PdfObjectName );if !_eeg {_aa .Log .Debug ("E\u0052\u0052\u004f\u0052\u003a\u0020\u0049\u006e\u0076a\u006c\u0069\u0064\u0020\u0053\u0075\u0062ty\u0070\u0065\u0020\u006fb\u006a\u0065\u0063\u0074\u0020\u0074\u0079\u0070\u0065 !\u003d\u0020n\u0061\u006d\u0065\u0020\u0028\u0025\u0054\u0029",_dgac );
|
||
return nil ,_d .Errorf ("i\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0053\u0075\u0062\u0074\u0079\u0070\u0065\u0020\u006f\u0062\u006ae\u0063\u0074\u0020\u0074\u0079\u0070\u0065\u0020\u0021\u003d n\u0061\u006d\u0065 \u0028%\u0054\u0029",_dgac );};switch *_dceg {case "\u0054\u0065\u0078\u0074":_eeac ,_fgfa :=_cfcc .newPdfAnnotationTextFromDict (_ceb );
|
||
if _fgfa !=nil {return nil ,_fgfa ;};_eeac .PdfAnnotation =_cfd ;_cfd ._cbea =_eeac ;return _cfd ,nil ;case "\u004c\u0069\u006e\u006b":_gcg ,_bbe :=_cfcc .newPdfAnnotationLinkFromDict (_ceb );if _bbe !=nil {return nil ,_bbe ;};_gcg .PdfAnnotation =_cfd ;
|
||
_cfd ._cbea =_gcg ;return _cfd ,nil ;case "\u0046\u0072\u0065\u0065\u0054\u0065\u0078\u0074":_ageg ,_cag :=_cfcc .newPdfAnnotationFreeTextFromDict (_ceb );if _cag !=nil {return nil ,_cag ;};_ageg .PdfAnnotation =_cfd ;_cfd ._cbea =_ageg ;return _cfd ,nil ;
|
||
case "\u004c\u0069\u006e\u0065":_fdc ,_fdd :=_cfcc .newPdfAnnotationLineFromDict (_ceb );if _fdd !=nil {return nil ,_fdd ;};_fdc .PdfAnnotation =_cfd ;_cfd ._cbea =_fdc ;_aa .Log .Trace ("\u004c\u0049\u004e\u0045\u0020\u0041N\u004e\u004f\u0054\u0041\u0054\u0049\u004f\u004e\u003a\u0020\u0061\u006e\u006eo\u0074\u0020\u0028\u0025\u0054\u0029\u003a \u0025\u002b\u0076\u000a",_cfd ,_cfd );
|
||
_aa .Log .Trace ("\u004c\u0049\u004eE\u0020\u0041\u004e\u004eO\u0054\u0041\u0054\u0049\u004f\u004e\u003a \u0063\u0074\u0078\u0020\u0028\u0025\u0054\u0029\u003a\u0020\u0025\u002b\u0076\u000a",_fdc ,_fdc );_aa .Log .Trace ("\u004c\u0049\u004e\u0045\u0020\u0041\u004e\u004e\u004f\u0054\u0041\u0054\u0049\u004f\u004e\u0020\u004d\u0061\u0072\u006b\u0075\u0070\u003a\u0020c\u0074\u0078\u0020\u0028\u0025T\u0029\u003a \u0025\u002b\u0076\u000a",_fdc .PdfAnnotationMarkup ,_fdc .PdfAnnotationMarkup );
|
||
return _cfd ,nil ;case "\u0053\u0071\u0075\u0061\u0072\u0065":_fdbe ,_gfbe :=_cfcc .newPdfAnnotationSquareFromDict (_ceb );if _gfbe !=nil {return nil ,_gfbe ;};_fdbe .PdfAnnotation =_cfd ;_cfd ._cbea =_fdbe ;return _cfd ,nil ;case "\u0043\u0069\u0072\u0063\u006c\u0065":_gaae ,_abdg :=_cfcc .newPdfAnnotationCircleFromDict (_ceb );
|
||
if _abdg !=nil {return nil ,_abdg ;};_gaae .PdfAnnotation =_cfd ;_cfd ._cbea =_gaae ;return _cfd ,nil ;case "\u0050o\u006c\u0079\u0067\u006f\u006e":_efe ,_gbgf :=_cfcc .newPdfAnnotationPolygonFromDict (_ceb );if _gbgf !=nil {return nil ,_gbgf ;};_efe .PdfAnnotation =_cfd ;
|
||
_cfd ._cbea =_efe ;return _cfd ,nil ;case "\u0050\u006f\u006c\u0079\u004c\u0069\u006e\u0065":_dde ,_gcef :=_cfcc .newPdfAnnotationPolyLineFromDict (_ceb );if _gcef !=nil {return nil ,_gcef ;};_dde .PdfAnnotation =_cfd ;_cfd ._cbea =_dde ;return _cfd ,nil ;
|
||
case "\u0048i\u0067\u0068\u006c\u0069\u0067\u0068t":_aggf ,_fdgg :=_cfcc .newPdfAnnotationHighlightFromDict (_ceb );if _fdgg !=nil {return nil ,_fdgg ;};_aggf .PdfAnnotation =_cfd ;_cfd ._cbea =_aggf ;return _cfd ,nil ;case "\u0055n\u0064\u0065\u0072\u006c\u0069\u006ee":_fee ,_bfd :=_cfcc .newPdfAnnotationUnderlineFromDict (_ceb );
|
||
if _bfd !=nil {return nil ,_bfd ;};_fee .PdfAnnotation =_cfd ;_cfd ._cbea =_fee ;return _cfd ,nil ;case "\u0053\u0071\u0075\u0069\u0067\u0067\u006c\u0079":_ebfa ,_bgc :=_cfcc .newPdfAnnotationSquigglyFromDict (_ceb );if _bgc !=nil {return nil ,_bgc ;};
|
||
_ebfa .PdfAnnotation =_cfd ;_cfd ._cbea =_ebfa ;return _cfd ,nil ;case "\u0053t\u0072\u0069\u006b\u0065\u004f\u0075t":_daag ,_abf :=_cfcc .newPdfAnnotationStrikeOut (_ceb );if _abf !=nil {return nil ,_abf ;};_daag .PdfAnnotation =_cfd ;_cfd ._cbea =_daag ;
|
||
return _cfd ,nil ;case "\u0043\u0061\u0072e\u0074":_ecbg ,_gaea :=_cfcc .newPdfAnnotationCaretFromDict (_ceb );if _gaea !=nil {return nil ,_gaea ;};_ecbg .PdfAnnotation =_cfd ;_cfd ._cbea =_ecbg ;return _cfd ,nil ;case "\u0053\u0074\u0061m\u0070":_aabc ,_cfgf :=_cfcc .newPdfAnnotationStampFromDict (_ceb );
|
||
if _cfgf !=nil {return nil ,_cfgf ;};_aabc .PdfAnnotation =_cfd ;_cfd ._cbea =_aabc ;return _cfd ,nil ;case "\u0049\u006e\u006b":_eebf ,_fbc :=_cfcc .newPdfAnnotationInkFromDict (_ceb );if _fbc !=nil {return nil ,_fbc ;};_eebf .PdfAnnotation =_cfd ;_cfd ._cbea =_eebf ;
|
||
return _cfd ,nil ;case "\u0050\u006f\u0070u\u0070":_add ,_ecacb :=_cfcc .newPdfAnnotationPopupFromDict (_ceb );if _ecacb !=nil {return nil ,_ecacb ;};_add .PdfAnnotation =_cfd ;_cfd ._cbea =_add ;return _cfd ,nil ;case "\u0046\u0069\u006c\u0065\u0041\u0074\u0074\u0061\u0063h\u006d\u0065\u006e\u0074":_ddb ,_faaf :=_cfcc .newPdfAnnotationFileAttachmentFromDict (_ceb );
|
||
if _faaf !=nil {return nil ,_faaf ;};_ddb .PdfAnnotation =_cfd ;_cfd ._cbea =_ddb ;return _cfd ,nil ;case "\u0053\u006f\u0075n\u0064":_ggeb ,_efff :=_cfcc .newPdfAnnotationSoundFromDict (_ceb );if _efff !=nil {return nil ,_efff ;};_ggeb .PdfAnnotation =_cfd ;
|
||
_cfd ._cbea =_ggeb ;return _cfd ,nil ;case "\u0052i\u0063\u0068\u004d\u0065\u0064\u0069a":_ecbgb ,_ggc :=_cfcc .newPdfAnnotationRichMediaFromDict (_ceb );if _ggc !=nil {return nil ,_ggc ;};_ecbgb .PdfAnnotation =_cfd ;_cfd ._cbea =_ecbgb ;return _cfd ,nil ;
|
||
case "\u004d\u006f\u0076i\u0065":_geb ,_fdbg :=_cfcc .newPdfAnnotationMovieFromDict (_ceb );if _fdbg !=nil {return nil ,_fdbg ;};_geb .PdfAnnotation =_cfd ;_cfd ._cbea =_geb ;return _cfd ,nil ;case "\u0053\u0063\u0072\u0065\u0065\u006e":_fgec ,_deb :=_cfcc .newPdfAnnotationScreenFromDict (_ceb );
|
||
if _deb !=nil {return nil ,_deb ;};_fgec .PdfAnnotation =_cfd ;_cfd ._cbea =_fgec ;return _cfd ,nil ;case "\u0057\u0069\u0064\u0067\u0065\u0074":_agfd ,_fcaf :=_cfcc .newPdfAnnotationWidgetFromDict (_ceb );if _fcaf !=nil {return nil ,_fcaf ;};_agfd .PdfAnnotation =_cfd ;
|
||
_cfd ._cbea =_agfd ;return _cfd ,nil ;case "P\u0072\u0069\u006e\u0074\u0065\u0072\u004d\u0061\u0072\u006b":_ggee ,_eba :=_cfcc .newPdfAnnotationPrinterMarkFromDict (_ceb );if _eba !=nil {return nil ,_eba ;};_ggee .PdfAnnotation =_cfd ;_cfd ._cbea =_ggee ;
|
||
return _cfd ,nil ;case "\u0054r\u0061\u0070\u004e\u0065\u0074":_bef ,_bgb :=_cfcc .newPdfAnnotationTrapNetFromDict (_ceb );if _bgb !=nil {return nil ,_bgb ;};_bef .PdfAnnotation =_cfd ;_cfd ._cbea =_bef ;return _cfd ,nil ;case "\u0057a\u0074\u0065\u0072\u006d\u0061\u0072k":_cac ,_caf :=_cfcc .newPdfAnnotationWatermarkFromDict (_ceb );
|
||
if _caf !=nil {return nil ,_caf ;};_cac .PdfAnnotation =_cfd ;_cfd ._cbea =_cac ;return _cfd ,nil ;case "\u0033\u0044":_edfa ,_cabe :=_cfcc .newPdfAnnotation3DFromDict (_ceb );if _cabe !=nil {return nil ,_cabe ;};_edfa .PdfAnnotation =_cfd ;_cfd ._cbea =_edfa ;
|
||
return _cfd ,nil ;case "\u0050\u0072\u006f\u006a\u0065\u0063\u0074\u0069\u006f\u006e":_edac ,_cgbc :=_cfcc .newPdfAnnotationProjectionFromDict (_ceb );if _cgbc !=nil {return nil ,_cgbc ;};_edac .PdfAnnotation =_cfd ;_cfd ._cbea =_edac ;return _cfd ,nil ;
|
||
case "\u0052\u0065\u0064\u0061\u0063\u0074":_cdcg ,_dfb :=_cfcc .newPdfAnnotationRedactFromDict (_ceb );if _dfb !=nil {return nil ,_dfb ;};_cdcg .PdfAnnotation =_cfd ;_cfd ._cbea =_cdcg ;return _cfd ,nil ;};_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0049\u0067\u006e\u006f\u0072\u0069\u006e\u0067\u0020\u0075\u006e\u006b\u006e\u006f\u0077\u006e\u0020a\u006e\u006e\u006f\u0074\u0061t\u0069\u006fn\u003a\u0020\u0025\u0073",*_dceg );
|
||
return nil ,nil ;};
|
||
|
||
// ToGoImage converts the unidoc Image to a golang Image structure.
|
||
func (_afdga *Image )ToGoImage ()(_ac .Image ,error ){_aa .Log .Trace ("\u0043\u006f\u006e\u0076er\u0074\u0069\u006e\u0067\u0020\u0074\u006f\u0020\u0067\u006f\u0020\u0069\u006d\u0061g\u0065");_dfaf ,_gccfa :=_cc .NewImage (int (_afdga .Width ),int (_afdga .Height ),int (_afdga .BitsPerComponent ),_afdga .ColorComponents ,_afdga .Data ,_afdga ._gccd ,_afdga ._dbge );
|
||
if _gccfa !=nil {return nil ,_gccfa ;};return _dfaf ,nil ;};func _dgfg (_abgaa *PdfPage ){_fcda :=_bec .GetLicenseKey ();if _fcda !=nil &&_fcda .IsLicensed (){return ;};_cdgdf :=_fg .PdfObjectName ("\u0055\u0046\u0031");if !_abgaa .Resources .HasFontByName (_cdgdf ){_abgaa .Resources .SetFontByName (_cdgdf ,DefaultFont ().ToPdfObject ());
|
||
};var _efca []string ;_efca =append (_efca ,"\u0071");_efca =append (_efca ,"\u0042\u0054");_efca =append (_efca ,_d .Sprintf ("\u002f%\u0073\u0020\u0031\u0034\u0020\u0054f",_cdgdf .String ()));_efca =append (_efca ,"\u0031\u0020\u0030\u0020\u0030\u0020\u0072\u0067");
|
||
_efca =append (_efca ,"\u0031\u0030\u0020\u0031\u0030\u0020\u0054\u0064");_cbaf :="\u0055\u006e\u006c\u0069\u0063\u0065\u006e\u0073\u0065\u0064\u0020\u0055\u006e\u0069\u0044o\u0063\u0020\u002d\u0020\u0047\u0065\u0074\u0020\u0061\u0020\u006c\u0069\u0063e\u006e\u0073\u0065\u0020\u006f\u006e\u0020\u0068\u0074\u0074\u0070\u0073:/\u002f\u0075\u006e\u0069\u0064\u006f\u0063\u002e\u0069\u006f";
|
||
_efca =append (_efca ,_d .Sprintf ("\u0028%\u0073\u0029\u0020\u0054\u006a",_cbaf ));_efca =append (_efca ,"\u0045\u0054");_efca =append (_efca ,"\u0051");_cbdcg :=_dc .Join (_efca ,"\u000a");_abgaa .AddContentStreamByString (_cbdcg );_abgaa .ToPdfObject ();
|
||
};
|
||
|
||
// String returns a string representation of what flags are set.
|
||
func (_baeg FieldFlag )String ()string {_eedf :="";if _baeg ==FieldFlagClear {_eedf ="\u0043\u006c\u0065a\u0072";return _eedf ;};if _baeg &FieldFlagReadOnly > 0{_eedf +="\u007cR\u0065\u0061\u0064\u004f\u006e\u006cy";};if _baeg &FieldFlagRequired > 0{_eedf +="\u007cR\u0065\u0071\u0075\u0069\u0072\u0065d";
|
||
};if _baeg &FieldFlagNoExport > 0{_eedf +="\u007cN\u006f\u0045\u0078\u0070\u006f\u0072t";};if _baeg &FieldFlagNoToggleToOff > 0{_eedf +="\u007c\u004e\u006f\u0054\u006f\u0067\u0067\u006c\u0065T\u006f\u004f\u0066\u0066";};if _baeg &FieldFlagRadio > 0{_eedf +="\u007c\u0052\u0061\u0064\u0069\u006f";
|
||
};if _baeg &FieldFlagPushbutton > 0{_eedf +="|\u0050\u0075\u0073\u0068\u0062\u0075\u0074\u0074\u006f\u006e";};if _baeg &FieldFlagRadiosInUnision > 0{_eedf +="\u007c\u0052a\u0064\u0069\u006fs\u0049\u006e\u0055\u006e\u0069\u0073\u0069\u006f\u006e";};if _baeg &FieldFlagMultiline > 0{_eedf +="\u007c\u004d\u0075\u006c\u0074\u0069\u006c\u0069\u006e\u0065";
|
||
};if _baeg &FieldFlagPassword > 0{_eedf +="\u007cP\u0061\u0073\u0073\u0077\u006f\u0072d";};if _baeg &FieldFlagFileSelect > 0{_eedf +="|\u0046\u0069\u006c\u0065\u0053\u0065\u006c\u0065\u0063\u0074";};if _baeg &FieldFlagDoNotScroll > 0{_eedf +="\u007c\u0044\u006fN\u006f\u0074\u0053\u0063\u0072\u006f\u006c\u006c";
|
||
};if _baeg &FieldFlagComb > 0{_eedf +="\u007c\u0043\u006fm\u0062";};if _baeg &FieldFlagRichText > 0{_eedf +="\u007cR\u0069\u0063\u0068\u0054\u0065\u0078t";};if _baeg &FieldFlagDoNotSpellCheck > 0{_eedf +="\u007c\u0044o\u004e\u006f\u0074S\u0070\u0065\u006c\u006c\u0043\u0068\u0065\u0063\u006b";
|
||
};if _baeg &FieldFlagCombo > 0{_eedf +="\u007c\u0043\u006f\u006d\u0062\u006f";};if _baeg &FieldFlagEdit > 0{_eedf +="\u007c\u0045\u0064i\u0074";};if _baeg &FieldFlagSort > 0{_eedf +="\u007c\u0053\u006fr\u0074";};if _baeg &FieldFlagMultiSelect > 0{_eedf +="\u007c\u004d\u0075l\u0074\u0069\u0053\u0065\u006c\u0065\u0063\u0074";
|
||
};if _baeg &FieldFlagCommitOnSelChange > 0{_eedf +="\u007cC\u006fm\u006d\u0069\u0074\u004f\u006eS\u0065\u006cC\u0068\u0061\u006e\u0067\u0065";};return _dc .Trim (_eedf ,"\u007c");};
|
||
|
||
// PdfVersion returns version of the PDF file.
|
||
func (_bffdff *PdfReader )PdfVersion ()_fg .Version {return _bffdff ._ccgg .PdfVersion ()};func _aefba (_ebgc _fg .PdfObject )(*PdfColorspaceSpecialPattern ,error ){_aa .Log .Trace ("\u004e\u0065\u0077\u0020\u0050\u0061\u0074\u0074\u0065\u0072n\u0020\u0043\u0053\u0020\u0066\u0072\u006fm\u0020\u006f\u0062\u006a\u003a\u0020\u0025\u0073\u0020\u0025\u0054",_ebgc .String (),_ebgc );
|
||
_bafb :=NewPdfColorspaceSpecialPattern ();if _eccb ,_cfbg :=_ebgc .(*_fg .PdfIndirectObject );_cfbg {_bafb ._agcec =_eccb ;};_ebgc =_fg .TraceToDirectObject (_ebgc );if _afgf ,_becba :=_ebgc .(*_fg .PdfObjectName );_becba {if *_afgf !="\u0050a\u0074\u0074\u0065\u0072\u006e"{return nil ,_d .Errorf ("\u0069\u006e\u0076a\u006c\u0069\u0064\u0020\u006e\u0061\u006d\u0065");
|
||
};return _bafb ,nil ;};_bbfb ,_ccfd :=_ebgc .(*_fg .PdfObjectArray );if !_ccfd {_aa .Log .Error ("\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0050\u0061t\u0074\u0065\u0072\u006e\u0020\u0043\u0053 \u004f\u0062\u006a\u0065\u0063\u0074\u003a\u0020\u0025\u0023\u0076",_ebgc );
|
||
return nil ,_d .Errorf ("\u0069n\u0076\u0061\u006c\u0069d\u0020\u0050\u0061\u0074\u0074e\u0072n\u0020C\u0053\u0020\u006f\u0062\u006a\u0065\u0063t");};if _bbfb .Len ()!=1&&_bbfb .Len ()!=2{_aa .Log .Error ("\u0049\u006ev\u0061\u006c\u0069\u0064\u0020\u0050\u0061\u0074\u0074\u0065\u0072\u006e\u0020\u0043\u0053\u0020\u0061\u0072\u0072\u0061\u0079\u003a %\u0023\u0076",_bbfb );
|
||
return nil ,_d .Errorf ("\u0069n\u0076\u0061\u006c\u0069\u0064\u0020\u0050\u0061\u0074\u0074\u0065r\u006e\u0020\u0043\u0053\u0020\u0061\u0072\u0072\u0061\u0079");};_ebgc =_bbfb .Get (0);if _eebga ,_abaaa :=_ebgc .(*_fg .PdfObjectName );_abaaa {if *_eebga !="\u0050a\u0074\u0074\u0065\u0072\u006e"{_aa .Log .Error ("\u0049\u006e\u0076al\u0069\u0064\u0020\u0050\u0061\u0074\u0074\u0065\u0072n\u0020C\u0053 \u0061r\u0072\u0061\u0079\u0020\u006e\u0061\u006d\u0065\u003a\u0020\u0025\u0023\u0076",_eebga );
|
||
return nil ,_d .Errorf ("\u0069\u006e\u0076a\u006c\u0069\u0064\u0020\u006e\u0061\u006d\u0065");};};if _bbfb .Len ()> 1{_ebgc =_bbfb .Get (1);_ebgc =_fg .TraceToDirectObject (_ebgc );_daagd ,_abcba :=NewPdfColorspaceFromPdfObject (_ebgc );if _abcba !=nil {return nil ,_abcba ;
|
||
};_bafb .UnderlyingCS =_daagd ;};_aa .Log .Trace ("R\u0065\u0074\u0075\u0072\u006e\u0069\u006e\u0067\u0020\u0050\u0061\u0074\u0074\u0065\u0072\u006e\u0020\u0077i\u0074\u0068\u0020\u0075\u006e\u0064\u0065\u0072\u006c\u0079in\u0067\u0020\u0063s\u003a \u0025\u0054",_bafb .UnderlyingCS );
|
||
return _bafb ,nil ;};
|
||
|
||
// ColorToRGB converts a Lab color to an RGB color.
|
||
func (_debb *PdfColorspaceLab )ColorToRGB (color PdfColor )(PdfColor ,error ){_ccagd :=func (_caea float64 )float64 {if _caea >=6.0/29{return _caea *_caea *_caea ;};return 108.0/841*(_caea -4.0/29.0);};_fafd ,_eebd :=color .(*PdfColorLab );if !_eebd {_aa .Log .Debug ("\u0069\u006e\u0070\u0075t \u0063\u006f\u006c\u006f\u0072\u0020\u006e\u006f\u0074\u0020\u006c\u0061\u0062");
|
||
return nil ,_ce .New ("\u0074\u0079p\u0065\u0020\u0063h\u0065\u0063\u006b\u0020\u0065\u0072\u0072\u006f\u0072");};LStar :=_fafd .L ();AStar :=_fafd .A ();BStar :=_fafd .B ();L :=(LStar +16)/116+AStar /500;M :=(LStar +16)/116;N :=(LStar +16)/116-BStar /200;
|
||
X :=_debb .WhitePoint [0]*_ccagd (L );Y :=_debb .WhitePoint [1]*_ccagd (M );Z :=_debb .WhitePoint [2]*_ccagd (N );_gbgd :=3.240479*X +-1.537150*Y +-0.498535*Z ;_abdf :=-0.969256*X +1.875992*Y +0.041556*Z ;_fcdd :=0.055648*X +-0.204043*Y +1.057311*Z ;_gbgd =_ef .Min (_ef .Max (_gbgd ,0),1.0);
|
||
_abdf =_ef .Min (_ef .Max (_abdf ,0),1.0);_fcdd =_ef .Min (_ef .Max (_fcdd ,0),1.0);return NewPdfColorDeviceRGB (_gbgd ,_abdf ,_fcdd ),nil ;};
|
||
|
||
// NewPdfDateFromTime will create a PdfDate based on the given time
|
||
func NewPdfDateFromTime (timeObj _g .Time )(PdfDate ,error ){_fcbdb :=timeObj .Format ("\u002d\u0030\u0037\u003a\u0030\u0030");_dbdfg ,_ :=_bad .ParseInt (_fcbdb [1:3],10,32);_abffc ,_ :=_bad .ParseInt (_fcbdb [4:6],10,32);return PdfDate {_fddef :int64 (timeObj .Year ()),_agbab :int64 (timeObj .Month ()),_adaba :int64 (timeObj .Day ()),_bedbf :int64 (timeObj .Hour ()),_fgdec :int64 (timeObj .Minute ()),_cfebe :int64 (timeObj .Second ()),_ebdc :_fcbdb [0],_eedgc :_dbdfg ,_gfcga :_abffc },nil ;
|
||
};func (_fcccf *pdfFontSimple )getFontDescriptor ()*PdfFontDescriptor {if _gffac :=_fcccf ._cdgef ;_gffac !=nil {return _gffac ;};return _fcccf ._fdfca ;};
|
||
|
||
// NewPdfPageResources returns a new PdfPageResources object.
|
||
func NewPdfPageResources ()*PdfPageResources {_gdegd :=&PdfPageResources {};_gdegd ._cgce =_fg .MakeDict ();return _gdegd ;};func (_cfeb *pdfFontType0 )getFontDescriptor ()*PdfFontDescriptor {if _cfeb ._cdgef ==nil &&_cfeb .DescendantFont !=nil {return _cfeb .DescendantFont .FontDescriptor ();
|
||
};return _cfeb ._cdgef ;};
|
||
|
||
// GetColorspaceByName returns the colorspace with the specified name from the page resources.
|
||
func (_ecdbe *PdfPageResources )GetColorspaceByName (keyName _fg .PdfObjectName )(PdfColorspace ,bool ){_bbec ,_dcdga :=_ecdbe .GetColorspaces ();if _dcdga !=nil {_aa .Log .Debug ("\u0045\u0052R\u004f\u0052\u0020\u0067\u0065\u0074\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072\u0073\u0070\u0072\u0061\u0063\u0065: \u0025\u0076",_dcdga );
|
||
return nil ,false ;};if _bbec ==nil {return nil ,false ;};_aecgf ,_cdcfa :=_bbec .Colorspaces [string (keyName )];if !_cdcfa {return nil ,false ;};return _aecgf ,true ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_cbdf *PdfAnnotationScreen )ToPdfObject ()_fg .PdfObject {_cbdf .PdfAnnotation .ToPdfObject ();_agcc :=_cbdf ._agb ;_egf :=_agcc .PdfObject .(*_fg .PdfObjectDictionary );_egf .SetIfNotNil ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u0053\u0063\u0072\u0065\u0065\u006e"));
|
||
_egf .SetIfNotNil ("\u0054",_cbdf .T );_egf .SetIfNotNil ("\u004d\u004b",_cbdf .MK );_egf .SetIfNotNil ("\u0041",_cbdf .A );_egf .SetIfNotNil ("\u0041\u0041",_cbdf .AA );return _agcc ;};
|
||
|
||
// GetFillImage get attached model.Image in push button.
|
||
func (_gdff *PdfFieldButton )GetFillImage ()*Image {if _gdff .IsPush (){return _gdff ._babe ;};return nil ;};
|
||
|
||
// DecodeArray returns the component range values for the DeviceN colorspace.
|
||
// [0 1.0 0 1.0 ...] for each color component.
|
||
func (_dcbg *PdfColorspaceDeviceN )DecodeArray ()[]float64 {var _eadde []float64 ;for _ddec :=0;_ddec < _dcbg .GetNumComponents ();_ddec ++{_eadde =append (_eadde ,0.0,1.0);};return _eadde ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_dcc *PdfActionSound )ToPdfObject ()_fg .PdfObject {_dcc .PdfAction .ToPdfObject ();_fad :=_dcc ._bda ;_ea :=_fad .PdfObject .(*_fg .PdfObjectDictionary );_ea .SetIfNotNil ("\u0053",_fg .MakeName (string (ActionTypeSound )));_ea .SetIfNotNil ("\u0053\u006f\u0075n\u0064",_dcc .Sound );
|
||
_ea .SetIfNotNil ("\u0056\u006f\u006c\u0075\u006d\u0065",_dcc .Volume );_ea .SetIfNotNil ("S\u0079\u006e\u0063\u0068\u0072\u006f\u006e\u006f\u0075\u0073",_dcc .Synchronous );_ea .SetIfNotNil ("\u0052\u0065\u0070\u0065\u0061\u0074",_dcc .Repeat );_ea .SetIfNotNil ("\u004d\u0069\u0078",_dcc .Mix );
|
||
return _fad ;};
|
||
|
||
// GetContainingPdfObject returns the page as a dictionary within an PdfIndirectObject.
|
||
func (_deae *PdfPage )GetContainingPdfObject ()_fg .PdfObject {return _deae ._aebf };
|
||
|
||
// NewPdfAction returns an initialized generic PDF action model.
|
||
func NewPdfAction ()*PdfAction {_bac :=&PdfAction {};_bac ._bda =_fg .MakeIndirectObject (_fg .MakeDict ());return _bac ;};func (_fbbf *PdfReader )newPdfActionGotoRFromDict (_ccc *_fg .PdfObjectDictionary )(*PdfActionGoToR ,error ){_bff ,_dca :=_ddd (_ccc .Get ("\u0046"));
|
||
if _dca !=nil {return nil ,_dca ;};return &PdfActionGoToR {D :_ccc .Get ("\u0044"),NewWindow :_ccc .Get ("\u004ee\u0077\u0057\u0069\u006e\u0064\u006fw"),F :_bff },nil ;};
|
||
|
||
// GetCatalogMetadata gets the catalog defined XMP Metadata.
|
||
func (_gaafc *PdfReader )GetCatalogMetadata ()(_fg .PdfObject ,bool ){if _gaafc ._cgegd ==nil {return nil ,false ;};_aedad :=_gaafc ._cgegd .Get ("\u004d\u0065\u0074\u0061\u0064\u0061\u0074\u0061");return _aedad ,_aedad !=nil ;};
|
||
|
||
// GetContext returns the action context which contains the specific type-dependent context.
|
||
// The context represents the subaction.
|
||
func (_fca *PdfAction )GetContext ()PdfModel {if _fca ==nil {return nil ;};return _fca ._bd ;};
|
||
|
||
// NewPdfColorspaceSpecialSeparation returns a new separation color.
|
||
func NewPdfColorspaceSpecialSeparation ()*PdfColorspaceSpecialSeparation {_fddca :=&PdfColorspaceSpecialSeparation {};return _fddca ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_fead *PdfAnnotationPolyLine )ToPdfObject ()_fg .PdfObject {_fead .PdfAnnotation .ToPdfObject ();_feda :=_fead ._agb ;_cad :=_feda .PdfObject .(*_fg .PdfObjectDictionary );_fead .PdfAnnotationMarkup .appendToPdfDictionary (_cad );_cad .SetIfNotNil ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u0050\u006f\u006c\u0079\u004c\u0069\u006e\u0065"));
|
||
_cad .SetIfNotNil ("\u0056\u0065\u0072\u0074\u0069\u0063\u0065\u0073",_fead .Vertices );_cad .SetIfNotNil ("\u004c\u0045",_fead .LE );_cad .SetIfNotNil ("\u0042\u0053",_fead .BS );_cad .SetIfNotNil ("\u0049\u0043",_fead .IC );_cad .SetIfNotNil ("\u0042\u0045",_fead .BE );
|
||
_cad .SetIfNotNil ("\u0049\u0054",_fead .IT );_cad .SetIfNotNil ("\u004de\u0061\u0073\u0075\u0072\u0065",_fead .Measure );return _feda ;};
|
||
|
||
// SetAction sets the PDF action for the annotation link.
|
||
func (_aefbb *PdfAnnotationLink )SetAction (action *PdfAction ){_aefbb ._efc =action ;if action ==nil {_aefbb .A =nil ;};};
|
||
|
||
// ImageToGray returns a new grayscale image based on the passed in RGB image.
|
||
func (_aggb *PdfColorspaceDeviceRGB )ImageToGray (img Image )(Image ,error ){if img .ColorComponents !=3{return img ,_ce .New ("\u0070\u0072\u006f\u0076\u0069\u0064e\u0064\u0020\u0069\u006d\u0061\u0067\u0065\u0020\u0069\u0073\u0020\u006e\u006ft\u0020\u0061\u0020\u0044\u0065\u0076\u0069c\u0065\u0052\u0047\u0042");
|
||
};_cfbf ,_cfgfe :=_cc .NewImage (int (img .Width ),int (img .Height ),int (img .BitsPerComponent ),img .ColorComponents ,img .Data ,img ._gccd ,img ._dbge );if _cfgfe !=nil {return img ,_cfgfe ;};_deafe ,_cfgfe :=_cc .GrayConverter .Convert (_cfbf );if _cfgfe !=nil {return img ,_cfgfe ;
|
||
};return _adad (_deafe .Base ()),nil ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_cdd *PdfActionGoTo )ToPdfObject ()_fg .PdfObject {_cdd .PdfAction .ToPdfObject ();_cfg :=_cdd ._bda ;_dce :=_cfg .PdfObject .(*_fg .PdfObjectDictionary );_dce .SetIfNotNil ("\u0053",_fg .MakeName (string (ActionTypeGoTo )));_dce .SetIfNotNil ("\u0044",_cdd .D );
|
||
return _cfg ;};func _bcabg (_aadad _fg .PdfObject )(map[_dg .CharCode ]float64 ,error ){if _aadad ==nil {return nil ,nil ;};_caege ,_egdf :=_fg .GetArray (_aadad );if !_egdf {return nil ,nil ;};_dbgb :=map[_dg .CharCode ]float64 {};_gddbg :=_caege .Len ();
|
||
for _gfge :=0;_gfge < _gddbg -1;_gfge ++{_fddcc :=_fg .TraceToDirectObject (_caege .Get (_gfge ));_dafa ,_dacd :=_fg .GetIntVal (_fddcc );if !_dacd {return nil ,_d .Errorf ("\u0042a\u0064\u0020\u0066\u006fn\u0074\u0020\u0057\u0020\u006fb\u006a0\u003a \u0069\u003d\u0025\u0064\u0020\u0025\u0023v",_gfge ,_fddcc );
|
||
};_gfge ++;if _gfge > _gddbg -1{return nil ,_d .Errorf ("\u0042\u0061\u0064\u0020\u0066\u006f\u006e\u0074\u0020\u0057\u0020a\u0072\u0072\u0061\u0079\u003a\u0020\u0061\u0072\u0072\u0032=\u0025\u002b\u0076",_caege );};_gegg :=_fg .TraceToDirectObject (_caege .Get (_gfge ));
|
||
switch _gegg .(type ){case *_fg .PdfObjectArray :_cdgee ,_ :=_fg .GetArray (_gegg );if _adbef ,_bdbf :=_cdgee .ToFloat64Array ();_bdbf ==nil {for _ebec :=0;_ebec < len (_adbef );_ebec ++{_dbgb [_dg .CharCode (_dafa +_ebec )]=_adbef [_ebec ];};}else {return nil ,_d .Errorf ("\u0042\u0061\u0064 \u0066\u006f\u006e\u0074 \u0057\u0020\u0061\u0072\u0072\u0061\u0079 \u006f\u0062\u006a\u0031\u003a\u0020\u0069\u003d\u0025\u0064\u0020\u0025\u0023\u0076",_gfge ,_gegg );
|
||
};case *_fg .PdfObjectInteger :_cefd ,_bcbbb :=_fg .GetIntVal (_gegg );if !_bcbbb {return nil ,_d .Errorf ("\u0042\u0061d\u0020\u0066\u006f\u006e\u0074\u0020\u0057\u0020\u0069\u006e\u0074\u0020\u006f\u0062\u006a\u0031\u003a\u0020\u0069\u003d\u0025\u0064 %\u0023\u0076",_gfge ,_gegg );
|
||
};_gfge ++;if _gfge > _gddbg -1{return nil ,_d .Errorf ("\u0042\u0061\u0064\u0020\u0066\u006f\u006e\u0074\u0020\u0057\u0020a\u0072\u0072\u0061\u0079\u003a\u0020\u0061\u0072\u0072\u0032=\u0025\u002b\u0076",_caege );};_gbgbb :=_caege .Get (_gfge );_gddbgd ,_gcda :=_fg .GetNumberAsFloat (_gbgbb );
|
||
if _gcda !=nil {return nil ,_d .Errorf ("\u0042\u0061d\u0020\u0066\u006f\u006e\u0074\u0020\u0057\u0020\u0069\u006e\u0074\u0020\u006f\u0062\u006a\u0032\u003a\u0020\u0069\u003d\u0025\u0064 %\u0023\u0076",_gfge ,_gbgbb );};for _bbfe :=_dafa ;_bbfe <=_cefd ;
|
||
_bbfe ++{_dbgb [_dg .CharCode (_bbfe )]=_gddbgd ;};default:return nil ,_d .Errorf ("\u0042\u0061\u0064\u0020\u0066\u006f\u006e\u0074\u0020\u0057 \u006f\u0062\u006a\u0031\u0020\u0074\u0079p\u0065\u003a\u0020\u0069\u003d\u0025\u0064\u0020\u0025\u0023\u0076",_gfge ,_gegg );
|
||
};};return _dbgb ,nil ;};
|
||
|
||
// DecodeArray returns the range of color component values in CalGray colorspace.
|
||
func (_efgcg *PdfColorspaceCalGray )DecodeArray ()[]float64 {return []float64 {0.0,1.0}};
|
||
|
||
// PdfOutputIntentType is the subtype of the given PdfOutputIntent.
|
||
type PdfOutputIntentType int ;
|
||
|
||
// NewPdfInfoFromObject creates a new PdfInfo from the input core.PdfObject.
|
||
func NewPdfInfoFromObject (obj _fg .PdfObject )(*PdfInfo ,error ){var _bbfaf PdfInfo ;_dgdf ,_acbb :=obj .(*_fg .PdfObjectDictionary );if !_acbb {return nil ,_d .Errorf ("i\u006e\u0076\u0061\u006c\u0069\u0064 \u0070\u0064\u0066\u0020\u006f\u0062\u006a\u0065\u0063t\u0020\u0074\u0079p\u0065:\u0020\u0025\u0054",obj );
|
||
};for _ ,_edefe :=range _dgdf .Keys (){switch _edefe {case "\u0054\u0069\u0074l\u0065":_bbfaf .Title ,_ =_fg .GetString (_dgdf .Get ("\u0054\u0069\u0074l\u0065"));case "\u0041\u0075\u0074\u0068\u006f\u0072":_bbfaf .Author ,_ =_fg .GetString (_dgdf .Get ("\u0041\u0075\u0074\u0068\u006f\u0072"));
|
||
case "\u0053u\u0062\u006a\u0065\u0063\u0074":_bbfaf .Subject ,_ =_fg .GetString (_dgdf .Get ("\u0053u\u0062\u006a\u0065\u0063\u0074"));case "\u004b\u0065\u0079\u0077\u006f\u0072\u0064\u0073":_bbfaf .Keywords ,_ =_fg .GetString (_dgdf .Get ("\u004b\u0065\u0079\u0077\u006f\u0072\u0064\u0073"));
|
||
case "\u0043r\u0065\u0061\u0074\u006f\u0072":_bbfaf .Creator ,_ =_fg .GetString (_dgdf .Get ("\u0043r\u0065\u0061\u0074\u006f\u0072"));case "\u0050\u0072\u006f\u0064\u0075\u0063\u0065\u0072":_bbfaf .Producer ,_ =_fg .GetString (_dgdf .Get ("\u0050\u0072\u006f\u0064\u0075\u0063\u0065\u0072"));
|
||
case "\u0054r\u0061\u0070\u0070\u0065\u0064":_bbfaf .Trapped ,_ =_fg .GetName (_dgdf .Get ("\u0054r\u0061\u0070\u0070\u0065\u0064"));case "\u0043\u0072\u0065a\u0074\u0069\u006f\u006e\u0044\u0061\u0074\u0065":if _fccg ,_fedgd :=_fg .GetString (_dgdf .Get ("\u0043\u0072\u0065a\u0074\u0069\u006f\u006e\u0044\u0061\u0074\u0065"));
|
||
_fedgd &&_fccg .String ()!=""{_cbedgf ,_cbbac :=NewPdfDate (_fccg .String ());if _cbbac !=nil {return nil ,_d .Errorf ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0043\u0072e\u0061\u0074\u0069\u006f\u006e\u0044\u0061t\u0065\u0020\u0066\u0069\u0065\u006c\u0064\u003a\u0020\u0025\u0077",_cbbac );
|
||
};_bbfaf .CreationDate =&_cbedgf ;};case "\u004do\u0064\u0044\u0061\u0074\u0065":if _dfce ,_gegf :=_fg .GetString (_dgdf .Get ("\u004do\u0064\u0044\u0061\u0074\u0065"));_gegf &&_dfce .String ()!=""{_aceb ,_bcbd :=NewPdfDate (_dfce .String ());if _bcbd !=nil {return nil ,_d .Errorf ("\u0069n\u0076\u0061\u006c\u0069d\u0020\u004d\u006f\u0064\u0044a\u0074e\u0020f\u0069\u0065\u006c\u0064\u003a\u0020\u0025w",_bcbd );
|
||
};_bbfaf .ModifiedDate =&_aceb ;};default:_abcg ,_ :=_fg .GetString (_dgdf .Get (_edefe ));if _bbfaf ._aaee ==nil {_bbfaf ._aaee =_fg .MakeDict ();};_bbfaf ._aaee .Set (_edefe ,_abcg );};};return &_bbfaf ,nil ;};
|
||
|
||
// SignatureHandlerDocMDP extends SignatureHandler with the ValidateWithOpts method for checking the DocMDP policy.
|
||
type SignatureHandlerDocMDP interface{SignatureHandler ;
|
||
|
||
// ValidateWithOpts validates a PDF signature by checking PdfReader or PdfParser
|
||
// ValidateWithOpts shall contain Validate call
|
||
ValidateWithOpts (_gfec *PdfSignature ,_acegf Hasher ,_gcedc SignatureHandlerDocMDPParams )(SignatureValidationResult ,error );};
|
||
|
||
// ColorFromFloats returns a new PdfColorDevice based on the input slice of
|
||
// color components. The slice should contain four elements representing the
|
||
// cyan, magenta, yellow and key components of the color. The values of the
|
||
// elements should be between 0 and 1.
|
||
func (_gbcc *PdfColorspaceDeviceCMYK )ColorFromFloats (vals []float64 )(PdfColor ,error ){if len (vals )!=4{return nil ,_ce .New ("r\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b");};_ccbd :=vals [0];if _ccbd < 0.0||_ccbd > 1.0{_aa .Log .Debug ("\u0063\u006f\u006cor\u0020\u006f\u0075\u0074\u0020\u006f\u0066\u0020\u0043\u0053\u0020\u0072\u0061\u006e\u0067\u0065\u003a\u0020",_ccbd );
|
||
return nil ,ErrColorOutOfRange ;};_afgd :=vals [1];if _afgd < 0.0||_afgd > 1.0{_aa .Log .Debug ("\u0063\u006f\u006cor\u0020\u006f\u0075\u0074\u0020\u006f\u0066\u0020\u0043\u0053\u0020\u0072\u0061\u006e\u0067\u0065\u003a\u0020",_afgd );return nil ,ErrColorOutOfRange ;
|
||
};_dccg :=vals [2];if _dccg < 0.0||_dccg > 1.0{_aa .Log .Debug ("\u0063\u006f\u006cor\u0020\u006f\u0075\u0074\u0020\u006f\u0066\u0020\u0043\u0053\u0020\u0072\u0061\u006e\u0067\u0065\u003a\u0020",_dccg );return nil ,ErrColorOutOfRange ;};_dced :=vals [3];
|
||
if _dced < 0.0||_dced > 1.0{_aa .Log .Debug ("\u0063\u006f\u006cor\u0020\u006f\u0075\u0074\u0020\u006f\u0066\u0020\u0043\u0053\u0020\u0072\u0061\u006e\u0067\u0065\u003a\u0020",_dced );return nil ,ErrColorOutOfRange ;};_bbgec :=NewPdfColorDeviceCMYK (_ccbd ,_afgd ,_dccg ,_dced );
|
||
return _bbgec ,nil ;};
|
||
|
||
// Items returns all children outline items.
|
||
func (_cffcc *Outline )Items ()[]*OutlineItem {return _cffcc .Entries };
|
||
|
||
// Hasher is the interface that wraps the basic Write method.
|
||
type Hasher interface{Write (_gbagga []byte )(_gebbgg int ,_bbecd error );};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_bedd *PdfSignature )ToPdfObject ()_fg .PdfObject {_dcceg :=_bedd ._fbbgf ;var _ggagg *_fg .PdfObjectDictionary ;if _cgagb ,_fggb :=_dcceg .PdfObject .(*pdfSignDictionary );_fggb {_ggagg =_cgagb .PdfObjectDictionary ;}else {_ggagg =_dcceg .PdfObject .(*_fg .PdfObjectDictionary );
|
||
};_ggagg .SetIfNotNil ("\u0054\u0079\u0070\u0065",_bedd .Type );_ggagg .SetIfNotNil ("\u0046\u0069\u006c\u0074\u0065\u0072",_bedd .Filter );_ggagg .SetIfNotNil ("\u0053u\u0062\u0046\u0069\u006c\u0074\u0065r",_bedd .SubFilter );_ggagg .SetIfNotNil ("\u0042y\u0074\u0065\u0052\u0061\u006e\u0067e",_bedd .ByteRange );
|
||
_ggagg .SetIfNotNil ("\u0043\u006f\u006e\u0074\u0065\u006e\u0074\u0073",_bedd .Contents );_ggagg .SetIfNotNil ("\u0043\u0065\u0072\u0074",_bedd .Cert );_ggagg .SetIfNotNil ("\u004e\u0061\u006d\u0065",_bedd .Name );_ggagg .SetIfNotNil ("\u0052\u0065\u0061\u0073\u006f\u006e",_bedd .Reason );
|
||
_ggagg .SetIfNotNil ("\u004d",_bedd .M );_ggagg .SetIfNotNil ("\u0052e\u0066\u0065\u0072\u0065\u006e\u0063e",_bedd .Reference );_ggagg .SetIfNotNil ("\u0043h\u0061\u006e\u0067\u0065\u0073",_bedd .Changes );_ggagg .SetIfNotNil ("C\u006f\u006e\u0074\u0061\u0063\u0074\u0049\u006e\u0066\u006f",_bedd .ContactInfo );
|
||
return _dcceg ;};func (_ffae *PdfAnnotation )String ()string {_fed :="";_eag ,_bcfb :=_ffae .ToPdfObject ().(*_fg .PdfIndirectObject );if _bcfb {_fed =_d .Sprintf ("\u0025\u0054\u003a\u0020\u0025\u0073",_ffae ._cbea ,_eag .PdfObject .String ());};return _fed ;
|
||
};
|
||
|
||
// ColorFromPdfObjects gets the color from a series of pdf objects (4 for cmyk).
|
||
func (_cge *PdfColorspaceDeviceCMYK )ColorFromPdfObjects (objects []_fg .PdfObject )(PdfColor ,error ){if len (objects )!=4{return nil ,_ce .New ("r\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b");};_abce ,_cddd :=_fg .GetNumbersAsFloat (objects );
|
||
if _cddd !=nil {return nil ,_cddd ;};return _cge .ColorFromFloats (_abce );};func _egdcc (_beede _fg .PdfObject )(*PdfColorspaceCalGray ,error ){_gdda :=NewPdfColorspaceCalGray ();if _efee ,_gbgb :=_beede .(*_fg .PdfIndirectObject );_gbgb {_gdda ._ffbdb =_efee ;
|
||
};_beede =_fg .TraceToDirectObject (_beede );_dfda ,_beeda :=_beede .(*_fg .PdfObjectArray );if !_beeda {return nil ,_d .Errorf ("\u0074\u0079\u0070\u0065\u0020\u0065\u0072\u0072\u006f\u0072");};if _dfda .Len ()!=2{return nil ,_d .Errorf ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0043\u0061\u006cG\u0072\u0061\u0079\u0020\u0063\u006f\u006c\u006f\u0072\u0073p\u0061\u0063\u0065");
|
||
};_beede =_fg .TraceToDirectObject (_dfda .Get (0));_fedfb ,_beeda :=_beede .(*_fg .PdfObjectName );if !_beeda {return nil ,_d .Errorf ("\u0043\u0061\u006c\u0047\u0072\u0061\u0079\u0020\u006e\u0061m\u0065\u0020\u006e\u006f\u0074\u0020\u0061 \u004e\u0061\u006d\u0065\u0020\u006f\u0062\u006a\u0065\u0063\u0074");
|
||
};if *_fedfb !="\u0043a\u006c\u0047\u0072\u0061\u0079"{return nil ,_d .Errorf ("\u006eo\u0074\u0020\u0061\u0020\u0043\u0061\u006c\u0047\u0072\u0061\u0079 \u0063\u006f\u006c\u006f\u0072\u0073\u0070\u0061\u0063\u0065");};_beede =_fg .TraceToDirectObject (_dfda .Get (1));
|
||
_bagd ,_beeda :=_beede .(*_fg .PdfObjectDictionary );if !_beeda {return nil ,_d .Errorf ("\u0043\u0061lG\u0072\u0061\u0079 \u0064\u0069\u0063\u0074 no\u0074 a\u0020\u0044\u0069\u0063\u0074\u0069\u006fna\u0072\u0079\u0020\u006f\u0062\u006a\u0065c\u0074");
|
||
};_beede =_bagd .Get ("\u0057\u0068\u0069\u0074\u0065\u0050\u006f\u0069\u006e\u0074");_beede =_fg .TraceToDirectObject (_beede );_bcdc ,_beeda :=_beede .(*_fg .PdfObjectArray );if !_beeda {return nil ,_d .Errorf ("C\u0061\u006c\u0047\u0072\u0061\u0079:\u0020\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020W\u0068\u0069\u0074e\u0050o\u0069\u006e\u0074");
|
||
};if _bcdc .Len ()!=3{return nil ,_d .Errorf ("\u0043\u0061\u006c\u0047\u0072\u0061y\u003a\u0020\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0057\u0068\u0069t\u0065\u0050\u006f\u0069\u006e\u0074\u0020a\u0072\u0072\u0061\u0079");};_cgba ,_ccad :=_bcdc .GetAsFloat64Slice ();
|
||
if _ccad !=nil {return nil ,_ccad ;};_gdda .WhitePoint =_cgba ;_beede =_bagd .Get ("\u0042\u006c\u0061\u0063\u006b\u0050\u006f\u0069\u006e\u0074");if _beede !=nil {_beede =_fg .TraceToDirectObject (_beede );_efac ,_bdgcc :=_beede .(*_fg .PdfObjectArray );
|
||
if !_bdgcc {return nil ,_d .Errorf ("C\u0061\u006c\u0047\u0072\u0061\u0079:\u0020\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020B\u006c\u0061\u0063k\u0050o\u0069\u006e\u0074");};if _efac .Len ()!=3{return nil ,_d .Errorf ("\u0043\u0061\u006c\u0047\u0072\u0061y\u003a\u0020\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0042\u006c\u0061c\u006b\u0050\u006f\u0069\u006e\u0074\u0020a\u0072\u0072\u0061\u0079");
|
||
};_dgfa ,_gdbeg :=_efac .GetAsFloat64Slice ();if _gdbeg !=nil {return nil ,_gdbeg ;};_gdda .BlackPoint =_dgfa ;};_beede =_bagd .Get ("\u0047\u0061\u006dm\u0061");if _beede !=nil {_beede =_fg .TraceToDirectObject (_beede );_bgdb ,_bgbec :=_fg .GetNumberAsFloat (_beede );
|
||
if _bgbec !=nil {return nil ,_d .Errorf ("C\u0061\u006c\u0047\u0072\u0061\u0079:\u0020\u0067\u0061\u006d\u006d\u0061\u0020\u006e\u006ft\u0020\u0061\u0020n\u0075m\u0062\u0065\u0072");};_gdda .Gamma =_bgdb ;};return _gdda ,nil ;};
|
||
|
||
// GetNumComponents returns the number of color components (3 for Lab).
|
||
func (_dfaaa *PdfColorLab )GetNumComponents ()int {return 3};func (_dfbc *PdfReader )traverseObjectData (_bcbab _fg .PdfObject )error {return _fg .ResolveReferencesDeep (_bcbab ,_dfbc ._aefbbf );};
|
||
|
||
// NewPdfColorLab returns a new Lab color.
|
||
func NewPdfColorLab (l ,a ,b float64 )*PdfColorLab {_fbbde :=PdfColorLab {l ,a ,b };return &_fbbde };
|
||
|
||
// GetPageAsIndirectObject returns the page as a dictionary within an PdfIndirectObject.
|
||
func (_edaac *PdfPage )GetPageAsIndirectObject ()*_fg .PdfIndirectObject {return _edaac ._aebf };
|
||
|
||
// ToPdfObject converts rectangle to a PDF object.
|
||
func (_gfdec *PdfRectangle )ToPdfObject ()_fg .PdfObject {return _fg .MakeArray (_fg .MakeFloat (_gfdec .Llx ),_fg .MakeFloat (_gfdec .Lly ),_fg .MakeFloat (_gfdec .Urx ),_fg .MakeFloat (_gfdec .Ury ));};
|
||
|
||
// GetXObjectByName returns the XObject with the specified keyName and the object type.
|
||
func (_cedda *PdfPageResources )GetXObjectByName (keyName _fg .PdfObjectName )(*_fg .PdfObjectStream ,XObjectType ){if _cedda .XObject ==nil {return nil ,XObjectTypeUndefined ;};_feaff ,_faag :=_fg .TraceToDirectObject (_cedda .XObject ).(*_fg .PdfObjectDictionary );
|
||
if !_faag {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052:\u0020\u0058\u004f\u0062\u006a\u0065\u0063\u0074\u0020\u006e\u006f\u0074\u0020a\u0020\u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061\u0072\u0079\u0021\u0020\u0028\u0067\u006f\u0074\u0020\u0025\u0054\u0029",_fg .TraceToDirectObject (_cedda .XObject ));
|
||
return nil ,XObjectTypeUndefined ;};if _afadf :=_feaff .Get (keyName );_afadf !=nil {_beeb ,_dbefb :=_fg .GetStream (_afadf );if !_dbefb {_aa .Log .Debug ("X\u004f\u0062\u006a\u0065\u0063\u0074 \u006e\u006f\u0074\u0020\u0070\u006fi\u006e\u0074\u0069\u006e\u0067\u0020\u0074o\u0020\u0061\u0020\u0073\u0074\u0072\u0065\u0061\u006d\u0020%\u0054",_afadf );
|
||
return nil ,XObjectTypeUndefined ;};_ddab :=_beeb .PdfObjectDictionary ;_dcabf ,_dbefb :=_fg .TraceToDirectObject (_ddab .Get ("\u0053u\u0062\u0074\u0079\u0070\u0065")).(*_fg .PdfObjectName );if !_dbefb {_aa .Log .Debug ("\u0058\u004fbj\u0065\u0063\u0074 \u0053\u0075\u0062\u0074ype\u0020no\u0074\u0020\u0061\u0020\u004e\u0061\u006de,\u0020\u0064\u0069\u0063\u0074\u003a\u0020%\u0073",_ddab .String ());
|
||
return nil ,XObjectTypeUndefined ;};if *_dcabf =="\u0049\u006d\u0061g\u0065"{return _beeb ,XObjectTypeImage ;}else if *_dcabf =="\u0046\u006f\u0072\u006d"{return _beeb ,XObjectTypeForm ;}else if *_dcabf =="\u0050\u0053"{return _beeb ,XObjectTypePS ;}else {_aa .Log .Debug ("\u0058\u004f\u0062\u006a\u0065\u0063\u0074\u0020\u0053\u0075b\u0074\u0079\u0070\u0065\u0020\u006e\u006ft\u0020\u006b\u006e\u006f\u0077\u006e\u0020\u0028\u0025\u0073\u0029",*_dcabf );
|
||
return nil ,XObjectTypeUndefined ;};}else {return nil ,XObjectTypeUndefined ;};};
|
||
|
||
// GetNumComponents returns the number of color components (1 for CalGray).
|
||
func (_ggcb *PdfColorCalGray )GetNumComponents ()int {return 1};
|
||
|
||
// SetLocation sets the `Location` field of the signature.
|
||
func (_dgab *PdfSignature )SetLocation (location string ){_dgab .Location =_fg .MakeString (location )};
|
||
|
||
// ImageToRGB converts an Image in a given PdfColorspace to an RGB image.
|
||
func (_bcdg *PdfColorspaceDeviceN )ImageToRGB (img Image )(Image ,error ){_ffdd :=_ade .NewReader (img .getBase ());_bceed :=_cc .NewImageBase (int (img .Width ),int (img .Height ),int (img .BitsPerComponent ),img .ColorComponents ,nil ,img ._gccd ,img ._dbge );
|
||
_adce :=_ade .NewWriter (_bceed );_cace :=_ef .Pow (2,float64 (img .BitsPerComponent ))-1;_eeaaf :=_bcdg .GetNumComponents ();_dfdab :=make ([]uint32 ,_eeaaf );_bfef :=make ([]float64 ,_eeaaf );for {_fdcgf :=_ffdd .ReadSamples (_dfdab );if _fdcgf ==_ff .EOF {break ;
|
||
}else if _fdcgf !=nil {return img ,_fdcgf ;};for _gcdd :=0;_gcdd < _eeaaf ;_gcdd ++{_adfc :=float64 (_dfdab [_gcdd ])/_cace ;_bfef [_gcdd ]=_adfc ;};_abdbc ,_fdcgf :=_bcdg .TintTransform .Evaluate (_bfef );if _fdcgf !=nil {return img ,_fdcgf ;};for _ ,_cdgd :=range _abdbc {_cdgd =_ef .Min (_ef .Max (0,_cdgd ),1.0);
|
||
if _fdcgf =_adce .WriteSample (uint32 (_cdgd *_cace ));_fdcgf !=nil {return img ,_fdcgf ;};};};return _bcdg .AlternateSpace .ImageToRGB (_adad (&_bceed ));};func (_adbag *PdfPattern )getDict ()*_fg .PdfObjectDictionary {if _gdae ,_bedga :=_adbag ._gaac .(*_fg .PdfIndirectObject );
|
||
_bedga {_cddfgg ,_gacaf :=_gdae .PdfObject .(*_fg .PdfObjectDictionary );if !_gacaf {return nil ;};return _cddfgg ;}else if _ecab ,_eeba :=_adbag ._gaac .(*_fg .PdfObjectStream );_eeba {return _ecab .PdfObjectDictionary ;}else {_aa .Log .Debug ("\u0054r\u0079\u0069\u006e\u0067\u0020\u0074\u006f a\u0063\u0063\u0065\u0073\u0073\u0020\u0070\u0061\u0074\u0074\u0065\u0072\u006e\u0020d\u0069\u0063t\u0069\u006f\u006ea\u0072\u0079\u0020\u006f\u0066\u0020\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u006f\u0062j\u0065\u0063t \u0074\u0079\u0070e\u0020\u0028\u0025\u0054\u0029",_adbag ._gaac );
|
||
return nil ;};};
|
||
|
||
// Size returns the width and the height of the page. The method reports
|
||
// the page dimensions as displayed by a PDF viewer (i.e. page rotation is
|
||
// taken into account).
|
||
func (_eaea *PdfPage )Size ()(float64 ,float64 ,error ){_cegbe ,_ecedf :=_eaea .GetMediaBox ();if _ecedf !=nil {return 0,0,_ecedf ;};_gdgg ,_aafgb :=_cegbe .Width (),_cegbe .Height ();_fefbf ,_ecedf :=_eaea .GetRotate ();if _ecedf !=nil {_aa .Log .Debug ("\u0045\u0052R\u004f\u0052\u003a\u0020\u0025\u0073\u0020\u002d\u0020\u0069\u0067\u006e\u006f\u0072\u0069\u006e\u0067\u0020\u0061\u006e\u0064\u0020\u0061\u0073\u0073\u0075\u006d\u0069\u006e\u0067\u0020\u006e\u006f\u0020\u0072\u006f\u0074\u0061\u0074\u0069\u006f\u006e\u000a",_ecedf .Error ());
|
||
};if _cbbed :=_fefbf ;_cbbed %360!=0&&_cbbed %90==0{if _gdcg :=(360+_cbbed %360)%360;_gdcg ==90||_gdcg ==270{_gdgg ,_aafgb =_aafgb ,_gdgg ;};};return _gdgg ,_aafgb ,nil ;};
|
||
|
||
// GetNumComponents returns the number of color components of the colorspace device.
|
||
// Returns 3 for a Lab device.
|
||
func (_efaae *PdfColorspaceLab )GetNumComponents ()int {return 3};func (_dcfgd *LTV )getOCSPs (_dacbf []*_ge .Certificate ,_gaabf map[string ]*_ge .Certificate )([][]byte ,error ){_fafac :=make ([][]byte ,0,len (_dacbf ));for _ ,_gbec :=range _dacbf {for _ ,_bgfbf :=range _gbec .OCSPServer {if _dcfgd .CertClient .IsCA (_gbec ){continue ;
|
||
};_bacdae ,_cadfe :=_gaabf [_gbec .Issuer .CommonName ];if !_cadfe {_aa .Log .Debug ("\u0057\u0041\u0052\u004e:\u0020\u0053\u006b\u0069\u0070\u0070\u0069\u006e\u0067 \u004f\u0043\u0053\u0050\u0020\u0072\u0065\u0071\u0075\u0065\u0073\u0074\u003a\u0020\u0069\u0073\u0073\u0075e\u0072\u0020\u0063\u0065\u0072t\u0069\u0066\u0069\u0063\u0061\u0074\u0065\u0020\u006e\u006f\u0074\u0020\u0066\u006f\u0075\u006e\u0064");
|
||
continue ;};_ ,_ffafa ,_cgefg :=_dcfgd .OCSPClient .MakeRequest (_bgfbf ,_gbec ,_bacdae );if _cgefg !=nil {_aa .Log .Debug ("\u0057\u0041\u0052\u004e:\u0020\u004f\u0043\u0053\u0050\u0020\u0072\u0065\u0071\u0075e\u0073t\u0020\u0065\u0072\u0072\u006f\u0072\u003a \u0025\u0076",_cgefg );
|
||
continue ;};_fafac =append (_fafac ,_ffafa );};};return _fafac ,nil ;};
|
||
|
||
// GetExtGState gets the ExtGState specified by keyName. Returns a bool
|
||
// indicating whether it was found or not.
|
||
func (_ebggd *PdfPageResources )GetExtGState (keyName _fg .PdfObjectName )(_fg .PdfObject ,bool ){if _ebggd .ExtGState ==nil {return nil ,false ;};_eacgc ,_fbddc :=_fg .TraceToDirectObject (_ebggd .ExtGState ).(*_fg .PdfObjectDictionary );if !_fbddc {_aa .Log .Debug ("\u0045\u0052R\u004f\u0052\u003a\u0020\u0049n\u0076\u0061\u006c\u0069\u0064 \u0045\u0078\u0074\u0047\u0053\u0074\u0061\u0074\u0065\u0020\u0065\u006e\u0074\u0072\u0079\u0020\u002d\u0020\u006e\u006f\u0074\u0020\u0061\u0020\u0064\u0069\u0063\u0074\u0020\u0028\u0067\u006f\u0074\u0020\u0025\u0054\u0029",_ebggd .ExtGState );
|
||
return nil ,false ;};if _abbb :=_eacgc .Get (keyName );_abbb !=nil {return _abbb ,true ;};return nil ,false ;};
|
||
|
||
// Add appends a top level outline item to the outline.
|
||
func (_aegbd *Outline )Add (item *OutlineItem ){_aegbd .Entries =append (_aegbd .Entries ,item )};
|
||
|
||
// ColorFromPdfObjects returns a new PdfColor based on the input slice of color
|
||
// components. The slice should contain a single PdfObjectFloat element in
|
||
// range 0-1.
|
||
func (_dcbe *PdfColorspaceCalGray )ColorFromPdfObjects (objects []_fg .PdfObject )(PdfColor ,error ){if len (objects )!=1{return nil ,_ce .New ("r\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b");};_edcad ,_dddg :=_fg .GetNumbersAsFloat (objects );
|
||
if _dddg !=nil {return nil ,_dddg ;};return _dcbe .ColorFromFloats (_edcad );};
|
||
|
||
// GetShadingByName gets the shading specified by keyName. Returns nil if not existing.
|
||
// The bool flag indicated whether it was found or not.
|
||
func (_ebfff *PdfPageResources )GetShadingByName (keyName _fg .PdfObjectName )(*PdfShading ,bool ){if _ebfff .Shading ==nil {return nil ,false ;};_efdbd ,_dgfb :=_fg .TraceToDirectObject (_ebfff .Shading ).(*_fg .PdfObjectDictionary );if !_dgfb {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0053\u0068\u0061d\u0069\u006e\u0067\u0020\u0065\u006e\u0074r\u0079\u0020\u002d\u0020\u006e\u006f\u0074\u0020\u0061\u0020\u0064i\u0063\u0074\u0020\u0028\u0067\u006f\u0074\u0020\u0025\u0054\u0029",_ebfff .Shading );
|
||
return nil ,false ;};if _effcd :=_efdbd .Get (keyName );_effcd !=nil {_eaffd ,_gdggb :=_fffbg (_effcd );if _gdggb !=nil {_aa .Log .Debug ("\u0045\u0052R\u004f\u0052\u003a\u0020f\u0061\u0069l\u0065\u0064\u0020\u0074\u006f\u0020\u006c\u006fa\u0064\u0020\u0070\u0064\u0066\u0020\u0073\u0068\u0061\u0064\u0069\u006eg\u003a\u0020\u0025\u0076",_gdggb );
|
||
return nil ,false ;};return _eaffd ,true ;};return nil ,false ;};
|
||
|
||
// NewPdfAnnotationMovie returns a new movie annotation.
|
||
func NewPdfAnnotationMovie ()*PdfAnnotationMovie {_fbe :=NewPdfAnnotation ();_afe :=&PdfAnnotationMovie {};_afe .PdfAnnotation =_fbe ;_fbe .SetContext (_afe );return _afe ;};
|
||
|
||
// NewPdfAnnotationCircle returns a new circle annotation.
|
||
func NewPdfAnnotationCircle ()*PdfAnnotationCircle {_egc :=NewPdfAnnotation ();_gcf :=&PdfAnnotationCircle {};_gcf .PdfAnnotation =_egc ;_gcf .PdfAnnotationMarkup =&PdfAnnotationMarkup {};_egc .SetContext (_gcf );return _gcf ;};
|
||
|
||
// UpdateXObjectImageFromImage creates a new XObject Image from an
|
||
// Image object `img` and default masks from xobjIn.
|
||
// The default masks are overridden if img.hasAlpha
|
||
// If `encoder` is nil, uses raw encoding (none).
|
||
func UpdateXObjectImageFromImage (xobjIn *XObjectImage ,img *Image ,cs PdfColorspace ,encoder _fg .StreamEncoder )(*XObjectImage ,error ){if encoder ==nil {encoder =_fg .NewRawEncoder ();};encoder .UpdateParams (img .GetParamsDict ());_efabg ,_faedg :=encoder .EncodeBytes (img .Data );
|
||
if _faedg !=nil {_aa .Log .Debug ("\u0045\u0072\u0072or\u0020\u0077\u0069\u0074\u0068\u0020\u0065\u006e\u0063\u006f\u0064\u0069\u006e\u0067\u003a\u0020\u0025\u0076",_faedg );return nil ,_faedg ;};_dfadc :=NewXObjectImage ();_gdggg :=img .Width ;_aadg :=img .Height ;
|
||
_dfadc .Width =&_gdggg ;_dfadc .Height =&_aadg ;_ffaeba :=img .BitsPerComponent ;_dfadc .BitsPerComponent =&_ffaeba ;_dfadc .Filter =encoder ;_dfadc .Stream =_efabg ;if cs ==nil {if img .ColorComponents ==1{_dfadc .ColorSpace =NewPdfColorspaceDeviceGray ();
|
||
if img .BitsPerComponent ==16{switch encoder .(type ){case *_fg .DCTEncoder :_dfadc .ColorSpace =NewPdfColorspaceDeviceRGB ();_ffaeba =8;_dfadc .BitsPerComponent =&_ffaeba ;};};}else if img .ColorComponents ==3{_dfadc .ColorSpace =NewPdfColorspaceDeviceRGB ();
|
||
}else if img .ColorComponents ==4{switch encoder .(type ){case *_fg .DCTEncoder :_dfadc .ColorSpace =NewPdfColorspaceDeviceRGB ();default:_dfadc .ColorSpace =NewPdfColorspaceDeviceCMYK ();};}else {return nil ,_ce .New ("c\u006fl\u006f\u0072\u0073\u0070\u0061\u0063\u0065\u0020u\u006e\u0064\u0065\u0066in\u0065\u0064");
|
||
};}else {_dfadc .ColorSpace =cs ;};if len (img ._gccd )!=0{_dacbg :=NewXObjectImage ();_dacbg .Filter =encoder ;_ffddb ,_eaefe :=encoder .EncodeBytes (img ._gccd );if _eaefe !=nil {_aa .Log .Debug ("\u0045\u0072\u0072or\u0020\u0077\u0069\u0074\u0068\u0020\u0065\u006e\u0063\u006f\u0064\u0069\u006e\u0067\u003a\u0020\u0025\u0076",_eaefe );
|
||
return nil ,_eaefe ;};_dacbg .Stream =_ffddb ;_dacbg .BitsPerComponent =_dfadc .BitsPerComponent ;_dacbg .Width =&img .Width ;_dacbg .Height =&img .Height ;_dacbg .ColorSpace =NewPdfColorspaceDeviceGray ();_dfadc .SMask =_dacbg .ToPdfObject ();}else {_dfadc .SMask =xobjIn .SMask ;
|
||
_dfadc .ImageMask =xobjIn .ImageMask ;if _dfadc .ColorSpace .GetNumComponents ()==1{_dcfa (_dfadc );};};return _dfadc ,nil ;};
|
||
|
||
// SetVersion sets the PDF version of the output file.
|
||
func (_fbeeb *PdfWriter )SetVersion (majorVersion ,minorVersion int ){_fbeeb ._fbbec .Major =majorVersion ;_fbeeb ._fbbec .Minor =minorVersion ;};
|
||
|
||
// GetNumPages returns the number of pages in the document.
|
||
func (_deacc *PdfReader )GetNumPages ()(int ,error ){if _deacc ._ccgg .GetCrypter ()!=nil &&!_deacc ._ccgg .IsAuthenticated (){return 0,_d .Errorf ("\u0066\u0069\u006ce\u0020\u006e\u0065\u0065d\u0020\u0074\u006f\u0020\u0062\u0065\u0020d\u0065\u0063\u0072\u0079\u0070\u0074\u0065\u0064\u0020\u0066\u0069\u0072\u0073\u0074");
|
||
};return len (_deacc ._bgce ),nil ;};
|
||
|
||
// PdfActionURI represents an URI action.
|
||
type PdfActionURI struct{*PdfAction ;URI _fg .PdfObject ;IsMap _fg .PdfObject ;};func _gbccc (_cdfa _fg .PdfObject )(*PdfColorspaceICCBased ,error ){_aada :=&PdfColorspaceICCBased {};if _ggge ,_eddd :=_cdfa .(*_fg .PdfIndirectObject );_eddd {_aada ._dgca =_ggge ;
|
||
};_cdfa =_fg .TraceToDirectObject (_cdfa );_abfd ,_gbf :=_cdfa .(*_fg .PdfObjectArray );if !_gbf {return nil ,_d .Errorf ("\u0074\u0079\u0070\u0065\u0020\u0065\u0072\u0072\u006f\u0072");};if _abfd .Len ()!=2{return nil ,_d .Errorf ("i\u006e\u0076\u0061\u006c\u0069\u0064 \u0049\u0043\u0043\u0042\u0061\u0073\u0065\u0064\u0020c\u006f\u006c\u006fr\u0073p\u0061\u0063\u0065");
|
||
};_cdfa =_fg .TraceToDirectObject (_abfd .Get (0));_bdbce ,_gbf :=_cdfa .(*_fg .PdfObjectName );if !_gbf {return nil ,_d .Errorf ("\u0049\u0043\u0043B\u0061\u0073\u0065\u0064 \u006e\u0061\u006d\u0065\u0020\u006e\u006ft\u0020\u0061\u0020\u004e\u0061\u006d\u0065\u0020\u006f\u0062\u006a\u0065\u0063\u0074");
|
||
};if *_bdbce !="\u0049\u0043\u0043\u0042\u0061\u0073\u0065\u0064"{return nil ,_d .Errorf ("\u006e\u006f\u0074\u0020\u0061\u006e\u0020\u0049\u0043\u0043\u0042a\u0073\u0065\u0064\u0020\u0063\u006f\u006c\u006f\u0072\u0073p\u0061\u0063\u0065");};_cdfa =_abfd .Get (1);
|
||
_cbba ,_gbf :=_fg .GetStream (_cdfa );if !_gbf {_aa .Log .Error ("I\u0043\u0043\u0042\u0061\u0073\u0065d\u0020\u006e\u006f\u0074\u0020\u0070o\u0069\u006e\u0074\u0069\u006e\u0067\u0020t\u006f\u0020\u0073\u0074\u0072\u0065\u0061\u006d\u003a\u0020%\u0054",_cdfa );
|
||
return nil ,_d .Errorf ("\u0049\u0043\u0043Ba\u0073\u0065\u0064\u0020\u0073\u0074\u0072\u0065\u0061\u006d\u0020\u0069\u006e\u0076\u0061\u006c\u0069\u0064");};_baba :=_cbba .PdfObjectDictionary ;_ggfc ,_gbf :=_baba .Get ("\u004e").(*_fg .PdfObjectInteger );
|
||
if !_gbf {return nil ,_d .Errorf ("I\u0043\u0043\u0042\u0061\u0073\u0065d\u0020\u006d\u0069\u0073\u0073\u0069n\u0067\u0020\u004e\u0020\u0066\u0072\u006fm\u0020\u0073\u0074\u0072\u0065\u0061\u006d\u0020\u0064\u0069c\u0074");};if *_ggfc !=1&&*_ggfc !=3&&*_ggfc !=4{return nil ,_d .Errorf ("\u0049\u0043\u0043\u0042\u0061s\u0065\u0064\u0020\u0063\u006f\u006c\u006f\u0072\u0073\u0070\u0061\u0063\u0065 \u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u004e\u0020\u0028\u006e\u006f\u0074\u0020\u0031\u002c\u0033\u002c\u0034\u0029");
|
||
};_aada .N =int (*_ggfc );if _abgf :=_baba .Get ("\u0041l\u0074\u0065\u0072\u006e\u0061\u0074e");_abgf !=nil {_bba ,_dadf :=NewPdfColorspaceFromPdfObject (_abgf );if _dadf !=nil {return nil ,_dadf ;};_aada .Alternate =_bba ;};if _fega :=_baba .Get ("\u0052\u0061\u006eg\u0065");
|
||
_fega !=nil {_fega =_fg .TraceToDirectObject (_fega );_cddbd ,_edef :=_fega .(*_fg .PdfObjectArray );if !_edef {return nil ,_d .Errorf ("I\u0043\u0043\u0042\u0061\u0073\u0065d\u0020\u0052\u0061\u006e\u0067\u0065\u0020\u006e\u006ft\u0020\u0061\u006e \u0061r\u0072\u0061\u0079");
|
||
};if _cddbd .Len ()!=2*_aada .N {return nil ,_d .Errorf ("\u0049\u0043\u0043\u0042\u0061\u0073\u0065\u0064\u0020\u0052\u0061\u006e\u0067e\u0020\u0077\u0072\u006f\u006e\u0067 \u006e\u0075\u006d\u0062\u0065\u0072\u0020\u006f\u0066\u0020\u0065\u006c\u0065m\u0065\u006e\u0074\u0073");
|
||
};_cgae ,_cfba :=_cddbd .GetAsFloat64Slice ();if _cfba !=nil {return nil ,_cfba ;};_aada .Range =_cgae ;}else {_aada .Range =make ([]float64 ,2*_aada .N );for _fdce :=0;_fdce < _aada .N ;_fdce ++{_aada .Range [2*_fdce ]=0.0;_aada .Range [2*_fdce +1]=1.0;
|
||
};};if _dfed :=_baba .Get ("\u004d\u0065\u0074\u0061\u0064\u0061\u0074\u0061");_dfed !=nil {_cfbb ,_aeeec :=_dfed .(*_fg .PdfObjectStream );if !_aeeec {return nil ,_d .Errorf ("\u0049\u0043\u0043\u0042\u0061\u0073\u0065\u0064\u0020\u004de\u0074\u0061\u0064\u0061\u0074\u0061\u0020n\u006f\u0074\u0020\u0061\u0020\u0073\u0074\u0072\u0065\u0061\u006d");
|
||
};_aada .Metadata =_cfbb ;};_cdfe ,_deba :=_fg .DecodeStream (_cbba );if _deba !=nil {return nil ,_deba ;};_aada .Data =_cdfe ;_aada ._cebf =_cbba ;return _aada ,nil ;};
|
||
|
||
// ToPdfObject returns an indirect object containing the signature field dictionary.
|
||
func (_fabe *PdfFieldSignature )ToPdfObject ()_fg .PdfObject {if _fabe .PdfAnnotationWidget !=nil {_fabe .PdfAnnotationWidget .ToPdfObject ();};_fabe .PdfField .ToPdfObject ();_dfbd :=_fabe ._daecc ;_cadg :=_dfbd .PdfObject .(*_fg .PdfObjectDictionary );
|
||
_cadg .SetIfNotNil ("\u0046\u0054",_fg .MakeName ("\u0053\u0069\u0067"));_cadg .SetIfNotNil ("\u004c\u006f\u0063\u006b",_fabe .Lock );_cadg .SetIfNotNil ("\u0053\u0056",_fabe .SV );if _fabe .V !=nil {_cadg .SetIfNotNil ("\u0056",_fabe .V .ToPdfObject ());
|
||
};return _dfbd ;};
|
||
|
||
// AddPages adds pages to be appended to the end of the source PDF.
|
||
func (_deaf *PdfAppender )AddPages (pages ...*PdfPage ){for _ ,_agfc :=range pages {_agfc =_agfc .Duplicate ();_dgfg (_agfc );_deaf ._agbg =append (_deaf ._agbg ,_agfc );};};
|
||
|
||
// PdfColorDeviceRGB represents a color in DeviceRGB colorspace with R, G, B components, where component is
|
||
// defined in the range 0.0 - 1.0 where 1.0 is the primary intensity.
|
||
type PdfColorDeviceRGB [3]float64 ;func (_dfdg *LTV )buildCertChain (_eabac ,_eacg []*_ge .Certificate )([]*_ge .Certificate ,map[string ]*_ge .Certificate ,error ){_dfdea :=map[string ]*_ge .Certificate {};for _ ,_gaaeed :=range _eabac {_dfdea [_gaaeed .Subject .CommonName ]=_gaaeed ;
|
||
};_fddcg :=_eabac ;for _ ,_efbd :=range _eacg {_ebbfc :=_efbd .Subject .CommonName ;if _ ,_fcbecg :=_dfdea [_ebbfc ];_fcbecg {continue ;};_dfdea [_ebbfc ]=_efbd ;_fddcg =append (_fddcg ,_efbd );};if len (_fddcg )==0{return nil ,nil ,ErrSignNoCertificates ;
|
||
};var _fbda error ;for _efdea :=_fddcg [0];_efdea !=nil &&!_dfdg .CertClient .IsCA (_efdea );{_eddc ,_bedc :=_dfdea [_efdea .Issuer .CommonName ];if !_bedc {if _eddc ,_fbda =_dfdg .CertClient .GetIssuer (_efdea );_fbda !=nil {_aa .Log .Debug ("W\u0041\u0052\u004e\u003a\u0020\u0043\u006f\u0075\u006cd\u0020\u006e\u006f\u0074\u0020\u0072\u0065tr\u0069\u0065\u0076\u0065 \u0063\u0065\u0072\u0074\u0069\u0066\u0069\u0063\u0061te\u0020\u0069s\u0073\u0075\u0065\u0072\u003a\u0020\u0025\u0076",_fbda );
|
||
break ;};_dfdea [_efdea .Issuer .CommonName ]=_eddc ;_fddcg =append (_fddcg ,_eddc );};_efdea =_eddc ;};return _fddcg ,_dfdea ,nil ;};
|
||
|
||
// AddExtension adds the specified extension to the Extensions dictionary.
|
||
// See section 7.1.2 "Extensions Dictionary" (pp. 108-109 PDF32000_2008).
|
||
func (_fadbe *PdfWriter )AddExtension (extName ,baseVersion string ,extLevel int ){_baddc ,_bebaa :=_fg .GetDict (_fadbe ._cgacf .Get ("\u0045\u0078\u0074\u0065\u006e\u0073\u0069\u006f\u006e\u0073"));if !_bebaa {_baddc =_fg .MakeDict ();_fadbe ._cgacf .Set ("\u0045\u0078\u0074\u0065\u006e\u0073\u0069\u006f\u006e\u0073",_baddc );
|
||
};_bfbaf ,_bebaa :=_fg .GetDict (_baddc .Get (_fg .PdfObjectName (extName )));if !_bebaa {_bfbaf =_fg .MakeDict ();_baddc .Set (_fg .PdfObjectName (extName ),_bfbaf );};if _gfgea ,_ :=_fg .GetNameVal (_bfbaf .Get ("B\u0061\u0073\u0065\u0056\u0065\u0072\u0073\u0069\u006f\u006e"));
|
||
_gfgea !=baseVersion {_bfbaf .Set ("B\u0061\u0073\u0065\u0056\u0065\u0072\u0073\u0069\u006f\u006e",_fg .MakeName (baseVersion ));};if _fbccf ,_ :=_fg .GetIntVal (_bfbaf .Get ("\u0045\u0078\u0074\u0065\u006e\u0073\u0069\u006f\u006eL\u0065\u0076\u0065\u006c"));
|
||
_fbccf !=extLevel {_bfbaf .Set ("\u0045\u0078\u0074\u0065\u006e\u0073\u0069\u006f\u006eL\u0065\u0076\u0065\u006c",_fg .MakeInteger (int64 (extLevel )));};};
|
||
|
||
// ToPdfObject returns a PDF object representation of the outline.
|
||
func (_cbccd *Outline )ToPdfObject ()_fg .PdfObject {return _cbccd .ToPdfOutline ().ToPdfObject ()};
|
||
|
||
// GetCharMetrics returns the char metrics for character code `code`.
|
||
// How it works:
|
||
// 1. It calls the GetCharMetrics function for the underlying font, either a simple font or
|
||
// a Type0 font. The underlying font GetCharMetrics() functions do direct charcode ➞ metrics
|
||
// mappings.
|
||
// 2. If the underlying font's GetCharMetrics() doesn't have a CharMetrics for `code` then a
|
||
// a CharMetrics with the FontDescriptor's /MissingWidth is returned.
|
||
// 3. If there is no /MissingWidth then a failure is returned.
|
||
//
|
||
// TODO(peterwilliams97) There is nothing callers can do if no CharMetrics are found so we might as
|
||
// well give them 0 width. There is no need for the bool return.
|
||
//
|
||
// TODO(gunnsth): Reconsider whether needed or if can map via GlyphName.
|
||
func (_bggg *PdfFont )GetCharMetrics (code _dg .CharCode )(CharMetrics ,bool ){var _eegeg _eed .CharMetrics ;switch _egac :=_bggg ._gcaeff .(type ){case *pdfFontSimple :if _abdfe ,_ceae :=_egac .GetCharMetrics (code );_ceae {return _abdfe ,_ceae ;};case *pdfFontType0 :if _cdcgd ,_feac :=_egac .GetCharMetrics (code );
|
||
_feac {return _cdcgd ,_feac ;};case *pdfCIDFontType0 :if _dbcg ,_afae :=_egac .GetCharMetrics (code );_afae {return _dbcg ,_afae ;};case *pdfCIDFontType2 :if _gedgg ,_ggeaf :=_egac .GetCharMetrics (code );_ggeaf {return _gedgg ,_ggeaf ;};case *pdfFontType3 :if _ecfde ,_eabg :=_egac .GetCharMetrics (code );
|
||
_eabg {return _ecfde ,_eabg ;};default:_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020G\u0065\u0074\u0043h\u0061\u0072\u004de\u0074\u0072i\u0063\u0073\u0020\u006e\u006f\u0074 \u0069mp\u006c\u0065\u006d\u0065\u006e\u0074\u0065\u0064\u0020\u0066\u006f\u0072\u0020\u0066\u006f\u006e\u0074\u0020\u0074\u0079\u0070\u0065\u003d\u0025\u0054\u002e",_bggg ._gcaeff );
|
||
return _eegeg ,false ;};if _egeea ,_gbafg :=_bggg .GetFontDescriptor ();_gbafg ==nil &&_egeea !=nil {return _eed .CharMetrics {Wx :_egeea ._gbbgb },true ;};_aa .Log .Debug ("\u0047\u0065\u0074\u0043\u0068\u0061\u0072\u004d\u0065\u0074\u0072\u0069\u0063\u0073\u003a\u0020\u004e\u006f\u0020\u006d\u0065\u0074\u0072\u0069c\u0073\u0020\u0066\u006f\u0072 \u0066\u006fn\u0074\u003d\u0025\u0073",_bggg );
|
||
return _eegeg ,false ;};
|
||
|
||
// GetNumComponents returns the number of color components of the colorspace device.
|
||
// Returns 1 for a grayscale device.
|
||
func (_abef *PdfColorspaceDeviceGray )GetNumComponents ()int {return 1};
|
||
|
||
// NewPdfShadingPatternType2 creates an empty shading pattern type 2 object.
|
||
func NewPdfShadingPatternType2 ()*PdfShadingPatternType2 {_baada :=&PdfShadingPatternType2 {};_baada .Matrix =_fg .MakeArrayFromIntegers ([]int {1,0,0,1,0,0});_baada .PdfPattern =&PdfPattern {};_baada .PdfPattern .PatternType =int64 (*_fg .MakeInteger (2));
|
||
_baada .PdfPattern ._ccdc =_baada ;_baada .PdfPattern ._gaac =_fg .MakeIndirectObject (_fg .MakeDict ());return _baada ;};
|
||
|
||
// NewOutlineItem returns a new outline item instance.
|
||
func NewOutlineItem (title string ,dest OutlineDest )*OutlineItem {return &OutlineItem {Title :title ,Dest :dest };};
|
||
|
||
// SetContext sets the sub action (context).
|
||
func (_fe *PdfAction )SetContext (ctx PdfModel ){_fe ._bd =ctx };
|
||
|
||
// WriteToFile writes the output PDF to file.
|
||
func (_fgebe *PdfWriter )WriteToFile (outputFilePath string )error {_cgafb ,_efdfe :=_c .Create (outputFilePath );if _efdfe !=nil {return _efdfe ;};defer _cgafb .Close ();return _fgebe .Write (_cgafb );};
|
||
|
||
// NewPdfAnnotationStrikeOut returns a new text strikeout annotation.
|
||
func NewPdfAnnotationStrikeOut ()*PdfAnnotationStrikeOut {_dfac :=NewPdfAnnotation ();_eda :=&PdfAnnotationStrikeOut {};_eda .PdfAnnotation =_dfac ;_eda .PdfAnnotationMarkup =&PdfAnnotationMarkup {};_dfac .SetContext (_eda );return _eda ;};
|
||
|
||
// VariableText contains the common attributes of a variable text.
|
||
// The VariableText is typically not used directly, but is can encapsulate by PdfField
|
||
// See section 12.7.3.3 "Variable Text" and Table 222 (pp. 434-436 PDF32000_2008).
|
||
type VariableText struct{DA *_fg .PdfObjectString ;Q *_fg .PdfObjectInteger ;DS *_fg .PdfObjectString ;RV _fg .PdfObject ;};
|
||
|
||
// ToInteger convert to an integer format.
|
||
func (_ceedb *PdfColorDeviceGray )ToInteger (bits int )uint32 {_fdaa :=_ef .Pow (2,float64 (bits ))-1;return uint32 (_fdaa *_ceedb .Val ());};func (_bcad *PdfReader )loadAction (_facg _fg .PdfObject )(*PdfAction ,error ){if _ffgb ,_efgd :=_fg .GetIndirect (_facg );
|
||
_efgd {_gegcb ,_cgac :=_bcad .newPdfActionFromIndirectObject (_ffgb );if _cgac !=nil {return nil ,_cgac ;};return _gegcb ,nil ;}else if !_fg .IsNullObject (_facg ){return nil ,_ce .New ("\u0061\u0063\u0074\u0069\u006fn\u0020\u0073\u0068\u006f\u0075\u006c\u0064\u0020\u0070\u006f\u0069\u006e\u0074 \u0074\u006f\u0020\u0061\u006e\u0020\u0069\u006e\u0064\u0069\u0072\u0065\u0063\u0074\u0020\u006f\u0062\u006a\u0065\u0063\u0074");
|
||
};return nil ,nil ;};
|
||
|
||
// ToPdfObject returns colorspace in a PDF object format [name dictionary]
|
||
func (_ccdf *PdfColorspaceCalRGB )ToPdfObject ()_fg .PdfObject {_abgc :=&_fg .PdfObjectArray {};_abgc .Append (_fg .MakeName ("\u0043\u0061\u006c\u0052\u0047\u0042"));_cadf :=_fg .MakeDict ();if _ccdf .WhitePoint !=nil {_ced :=_fg .MakeArray (_fg .MakeFloat (_ccdf .WhitePoint [0]),_fg .MakeFloat (_ccdf .WhitePoint [1]),_fg .MakeFloat (_ccdf .WhitePoint [2]));
|
||
_cadf .Set ("\u0057\u0068\u0069\u0074\u0065\u0050\u006f\u0069\u006e\u0074",_ced );}else {_aa .Log .Error ("\u0043\u0061l\u0052\u0047\u0042\u003a \u004d\u0069s\u0073\u0069\u006e\u0067\u0020\u0057\u0068\u0069t\u0065\u0050\u006f\u0069\u006e\u0074\u0020\u0028\u0052\u0065\u0071\u0075i\u0072\u0065\u0064\u0029");
|
||
};if _ccdf .BlackPoint !=nil {_gac :=_fg .MakeArray (_fg .MakeFloat (_ccdf .BlackPoint [0]),_fg .MakeFloat (_ccdf .BlackPoint [1]),_fg .MakeFloat (_ccdf .BlackPoint [2]));_cadf .Set ("\u0042\u006c\u0061\u0063\u006b\u0050\u006f\u0069\u006e\u0074",_gac );
|
||
};if _ccdf .Gamma !=nil {_gadc :=_fg .MakeArray (_fg .MakeFloat (_ccdf .Gamma [0]),_fg .MakeFloat (_ccdf .Gamma [1]),_fg .MakeFloat (_ccdf .Gamma [2]));_cadf .Set ("\u0047\u0061\u006dm\u0061",_gadc );};if _ccdf .Matrix !=nil {_gedd :=_fg .MakeArray (_fg .MakeFloat (_ccdf .Matrix [0]),_fg .MakeFloat (_ccdf .Matrix [1]),_fg .MakeFloat (_ccdf .Matrix [2]),_fg .MakeFloat (_ccdf .Matrix [3]),_fg .MakeFloat (_ccdf .Matrix [4]),_fg .MakeFloat (_ccdf .Matrix [5]),_fg .MakeFloat (_ccdf .Matrix [6]),_fg .MakeFloat (_ccdf .Matrix [7]),_fg .MakeFloat (_ccdf .Matrix [8]));
|
||
_cadf .Set ("\u004d\u0061\u0074\u0072\u0069\u0078",_gedd );};_abgc .Append (_cadf );if _ccdf ._cfcb !=nil {_ccdf ._cfcb .PdfObject =_abgc ;return _ccdf ._cfcb ;};return _abgc ;};
|
||
|
||
// SetAlpha sets the alpha layer for the image.
|
||
func (_cdafa *Image )SetAlpha (alpha []byte ){_cdafa ._gccd =alpha };
|
||
|
||
// SetXObjectFormByName adds the provided XObjectForm to the page resources.
|
||
// The added XObjectForm is identified by the specified name.
|
||
func (_aefca *PdfPageResources )SetXObjectFormByName (keyName _fg .PdfObjectName ,xform *XObjectForm )error {_cdaee :=xform .ToPdfObject ().(*_fg .PdfObjectStream );_gaffg :=_aefca .SetXObjectByName (keyName ,_cdaee );return _gaffg ;};
|
||
|
||
// ImageToRGB returns the passed in image. Method exists in order to satisfy
|
||
// the PdfColorspace interface.
|
||
func (_dcfb *PdfColorspaceDeviceRGB )ImageToRGB (img Image )(Image ,error ){return img ,nil };
|
||
|
||
// PdfActionResetForm represents a resetForm action.
|
||
type PdfActionResetForm struct{*PdfAction ;Fields _fg .PdfObject ;Flags _fg .PdfObject ;};
|
||
|
||
// PdfAnnotationTrapNet represents TrapNet annotations.
|
||
// (Section 12.5.6.21).
|
||
type PdfAnnotationTrapNet struct{*PdfAnnotation };func (_fggad *PdfReader )loadPerms ()(*Permissions ,error ){if _bfdag :=_fggad ._cgegd .Get ("\u0050\u0065\u0072m\u0073");_bfdag !=nil {if _bdeeg ,_dggg :=_fg .GetDict (_bfdag );_dggg {_fdda :=_bdeeg .Get ("\u0044\u006f\u0063\u004d\u0044\u0050");
|
||
if _fdda ==nil {return nil ,nil ;};if _adgcdg ,_efaba :=_fg .GetIndirect (_fdda );_efaba {_fcdde ,_fagag :=_fggad .newPdfSignatureFromIndirect (_adgcdg );if _fagag !=nil {return nil ,_fagag ;};return NewPermissions (_fcdde ),nil ;};return nil ,_d .Errorf ("i\u006ev\u0061\u006c\u0069\u0064\u0020\u0044\u006f\u0063M\u0044\u0050\u0020\u0065nt\u0072\u0079");
|
||
};return nil ,_d .Errorf ("\u0069\u006e\u0076\u0061li\u0064\u0020\u0050\u0065\u0072\u006d\u0073\u0020\u0065\u006e\u0074\u0072\u0079");};return nil ,nil ;};func (_bbbb *pdfFontType3 )getFontDescriptor ()*PdfFontDescriptor {return _bbbb ._cdgef };
|
||
|
||
// ColorToRGB converts a DeviceN color to an RGB color.
|
||
func (_dgcc *PdfColorspaceDeviceN )ColorToRGB (color PdfColor )(PdfColor ,error ){if _dgcc .AlternateSpace ==nil {return nil ,_ce .New ("\u0044\u0065\u0076\u0069\u0063\u0065N\u0020\u0061\u006c\u0074\u0065\u0072\u006e\u0061\u0074\u0065\u0020\u0073\u0070a\u0063\u0065\u0020\u0075\u006e\u0064\u0065f\u0069\u006e\u0065\u0064");
|
||
};return _dgcc .AlternateSpace .ColorToRGB (color );};
|
||
|
||
// PdfShadingType6 is a Coons patch mesh.
|
||
type PdfShadingType6 struct{*PdfShading ;BitsPerCoordinate *_fg .PdfObjectInteger ;BitsPerComponent *_fg .PdfObjectInteger ;BitsPerFlag *_fg .PdfObjectInteger ;Decode *_fg .PdfObjectArray ;Function []PdfFunction ;};
|
||
|
||
// NewPdfShadingType2 creates an empty shading type 2 dictionary.
|
||
func NewPdfShadingType2 ()*PdfShadingType2 {_fabbe :=&PdfShadingType2 {};_fabbe .PdfShading =&PdfShading {};_fabbe .PdfShading ._cbabf =_fg .MakeIndirectObject (_fg .MakeDict ());_fabbe .PdfShading ._bcbef =_fabbe ;return _fabbe ;};func _gcbf (_eaagc _fg .PdfObject ){_aa .Log .Debug ("\u006f\u0062\u006a\u003a\u0020\u0025\u0054\u0020\u0025\u0073",_eaagc ,_eaagc .String ());
|
||
if _cfgda ,_gbggb :=_eaagc .(*_fg .PdfObjectStream );_gbggb {_dgbd ,_ffggg :=_fg .DecodeStream (_cfgda );if _ffggg !=nil {_aa .Log .Debug ("\u0045r\u0072\u006f\u0072\u003a\u0020\u0025v",_ffggg );return ;};_aa .Log .Debug ("D\u0065\u0063\u006f\u0064\u0065\u0064\u003a\u0020\u0025\u0073",_dgbd );
|
||
}else if _ebbea ,_agadd :=_eaagc .(*_fg .PdfIndirectObject );_agadd {_aa .Log .Debug ("\u0025\u0054\u0020%\u0076",_ebbea .PdfObject ,_ebbea .PdfObject );_aa .Log .Debug ("\u0025\u0073",_ebbea .PdfObject .String ());};};func _cgef (_fafdg _fg .PdfObject )(*PdfFunctionType3 ,error ){_bafe :=&PdfFunctionType3 {};
|
||
var _ebbc *_fg .PdfObjectDictionary ;if _dgce ,_ggcda :=_fafdg .(*_fg .PdfIndirectObject );_ggcda {_cfgc ,_edfc :=_dgce .PdfObject .(*_fg .PdfObjectDictionary );if !_edfc {return nil ,_ce .New ("\u0074\u0079p\u0065\u0020\u0063h\u0065\u0063\u006b\u0020\u0065\u0072\u0072\u006f\u0072");
|
||
};_bafe ._daga =_dgce ;_ebbc =_cfgc ;}else if _dafb ,_gefga :=_fafdg .(*_fg .PdfObjectDictionary );_gefga {_ebbc =_dafb ;}else {return nil ,_ce .New ("\u0074\u0079p\u0065\u0020\u0063h\u0065\u0063\u006b\u0020\u0065\u0072\u0072\u006f\u0072");};_dggf ,_adee :=_fg .TraceToDirectObject (_ebbc .Get ("\u0044\u006f\u006d\u0061\u0069\u006e")).(*_fg .PdfObjectArray );
|
||
if !_adee {_aa .Log .Error ("D\u006fm\u0061\u0069\u006e\u0020\u006e\u006f\u0074\u0020s\u0070\u0065\u0063\u0069fi\u0065\u0064");return nil ,_ce .New ("\u0072\u0065q\u0075\u0069\u0072\u0065d\u0020\u0061t\u0074\u0072\u0069\u0062\u0075\u0074\u0065\u0020m\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u006f\u0072\u0020\u0069\u006ev\u0061\u006c\u0069\u0064");
|
||
};if _dggf .Len ()!=2{_aa .Log .Error ("\u0044\u006f\u006d\u0061\u0069\u006e\u0020\u0069\u006ev\u0061\u006c\u0069\u0064");return nil ,_ce .New ("i\u006ev\u0061\u006c\u0069\u0064\u0020\u0064\u006f\u006da\u0069\u006e\u0020\u0072an\u0067\u0065");};_agbe ,_bbaf :=_dggf .ToFloat64Array ();
|
||
if _bbaf !=nil {return nil ,_bbaf ;};_bafe .Domain =_agbe ;_dggf ,_adee =_fg .TraceToDirectObject (_ebbc .Get ("\u0052\u0061\u006eg\u0065")).(*_fg .PdfObjectArray );if _adee {if _dggf .Len ()< 0||_dggf .Len ()%2!=0{return nil ,_ce .New ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0072\u0061\u006e\u0067\u0065");
|
||
};_bdgf ,_dafcd :=_dggf .ToFloat64Array ();if _dafcd !=nil {return nil ,_dafcd ;};_bafe .Range =_bdgf ;};_dggf ,_adee =_fg .TraceToDirectObject (_ebbc .Get ("\u0046u\u006e\u0063\u0074\u0069\u006f\u006es")).(*_fg .PdfObjectArray );if !_adee {_aa .Log .Error ("\u0046\u0075\u006ect\u0069\u006f\u006e\u0073\u0020\u006e\u006f\u0074\u0020\u0073\u0070\u0065\u0063\u0069\u0066\u0069\u0065\u0064");
|
||
return nil ,_ce .New ("\u0072\u0065q\u0075\u0069\u0072\u0065d\u0020\u0061t\u0074\u0072\u0069\u0062\u0075\u0074\u0065\u0020m\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u006f\u0072\u0020\u0069\u006ev\u0061\u006c\u0069\u0064");};_bafe .Functions =[]PdfFunction {};
|
||
for _ ,_gdaa :=range _dggf .Elements (){_bcag ,_afdg :=_defgb (_gdaa );if _afdg !=nil {return nil ,_afdg ;};_bafe .Functions =append (_bafe .Functions ,_bcag );};_dggf ,_adee =_fg .TraceToDirectObject (_ebbc .Get ("\u0042\u006f\u0075\u006e\u0064\u0073")).(*_fg .PdfObjectArray );
|
||
if !_adee {_aa .Log .Error ("B\u006fu\u006e\u0064\u0073\u0020\u006e\u006f\u0074\u0020s\u0070\u0065\u0063\u0069fi\u0065\u0064");return nil ,_ce .New ("\u0072\u0065q\u0075\u0069\u0072\u0065d\u0020\u0061t\u0074\u0072\u0069\u0062\u0075\u0074\u0065\u0020m\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u006f\u0072\u0020\u0069\u006ev\u0061\u006c\u0069\u0064");
|
||
};_adfb ,_bbaf :=_dggf .ToFloat64Array ();if _bbaf !=nil {return nil ,_bbaf ;};_bafe .Bounds =_adfb ;if len (_bafe .Bounds )!=len (_bafe .Functions )-1{_aa .Log .Error ("B\u006f\u0075\u006e\u0064\u0073\u0020\u0028\u0025\u0064)\u0020\u0061\u006e\u0064\u0020\u006e\u0075m \u0066\u0075\u006e\u0063t\u0069\u006f\u006e\u0073\u0020\u0028\u0025\u0064\u0029 n\u006f\u0074 \u006d\u0061\u0074\u0063\u0068\u0069\u006e\u0067",len (_bafe .Bounds ),len (_bafe .Functions ));
|
||
return nil ,_ce .New ("r\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b");};_dggf ,_adee =_fg .TraceToDirectObject (_ebbc .Get ("\u0045\u006e\u0063\u006f\u0064\u0065")).(*_fg .PdfObjectArray );if !_adee {_aa .Log .Error ("E\u006ec\u006f\u0064\u0065\u0020\u006e\u006f\u0074\u0020s\u0070\u0065\u0063\u0069fi\u0065\u0064");
|
||
return nil ,_ce .New ("\u0072\u0065q\u0075\u0069\u0072\u0065d\u0020\u0061t\u0074\u0072\u0069\u0062\u0075\u0074\u0065\u0020m\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u006f\u0072\u0020\u0069\u006ev\u0061\u006c\u0069\u0064");};_cfafe ,_bbaf :=_dggf .ToFloat64Array ();
|
||
if _bbaf !=nil {return nil ,_bbaf ;};_bafe .Encode =_cfafe ;if len (_bafe .Encode )!=2*len (_bafe .Functions ){_aa .Log .Error ("\u004c\u0065\u006e\u0020\u0065\u006e\u0063\u006f\u0064\u0065\u0020\u0028\u0025\u0064\u0029 \u0061\u006e\u0064\u0020\u006e\u0075\u006d\u0020\u0066\u0075\u006e\u0063\u0074i\u006f\u006e\u0073\u0020\u0028\u0025\u0064\u0029\u0020\u006e\u006f\u0074 m\u0061\u0074\u0063\u0068\u0069\u006e\u0067\u0020\u0075\u0070",len (_bafe .Encode ),len (_bafe .Functions ));
|
||
return nil ,_ce .New ("r\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b");};return _bafe ,nil ;};
|
||
|
||
// StandardImplementer is an interface that defines specified PDF standards like PDF/A-1A (pdfa.Profile1A)
|
||
// NOTE: This implementation is in experimental development state.
|
||
// Keep in mind that it might change in the subsequent minor versions.
|
||
type StandardImplementer interface{StandardValidator ;StandardApplier ;
|
||
|
||
// StandardName gets the human-readable name of the standard.
|
||
StandardName ()string ;};
|
||
|
||
// ToPdfObject returns the PDF representation of the shading dictionary.
|
||
func (_cbcdc *PdfShadingType6 )ToPdfObject ()_fg .PdfObject {_cbcdc .PdfShading .ToPdfObject ();_fcfb ,_daeaa :=_cbcdc .getShadingDict ();if _daeaa !=nil {_aa .Log .Error ("\u0055\u006ea\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0061\u0063\u0063\u0065\u0073\u0073\u0020\u0073\u0068\u0061\u0064\u0069\u006e\u0067\u0020di\u0063\u0074");
|
||
return nil ;};if _cbcdc .BitsPerCoordinate !=nil {_fcfb .Set ("\u0042\u0069\u0074\u0073\u0050\u0065\u0072\u0043\u006f\u006f\u0072\u0064i\u006e\u0061\u0074\u0065",_cbcdc .BitsPerCoordinate );};if _cbcdc .BitsPerComponent !=nil {_fcfb .Set ("\u0042\u0069t\u0073\u0050\u0065r\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074",_cbcdc .BitsPerComponent );
|
||
};if _cbcdc .BitsPerFlag !=nil {_fcfb .Set ("B\u0069\u0074\u0073\u0050\u0065\u0072\u0046\u006c\u0061\u0067",_cbcdc .BitsPerFlag );};if _cbcdc .Decode !=nil {_fcfb .Set ("\u0044\u0065\u0063\u006f\u0064\u0065",_cbcdc .Decode );};if _cbcdc .Function !=nil {if len (_cbcdc .Function )==1{_fcfb .Set ("\u0046\u0075\u006e\u0063\u0074\u0069\u006f\u006e",_cbcdc .Function [0].ToPdfObject ());
|
||
}else {_gdab :=_fg .MakeArray ();for _ ,_fceb :=range _cbcdc .Function {_gdab .Append (_fceb .ToPdfObject ());};_fcfb .Set ("\u0046\u0075\u006e\u0063\u0074\u0069\u006f\u006e",_gdab );};};return _cbcdc ._cbabf ;};func _cecgc (_ggcde *_fg .PdfObjectDictionary )(*PdfTilingPattern ,error ){_afeedc :=&PdfTilingPattern {};
|
||
_bfefd :=_ggcde .Get ("\u0050a\u0069\u006e\u0074\u0054\u0079\u0070e");if _bfefd ==nil {_aa .Log .Debug ("\u0050\u0061\u0069\u006e\u0074\u0054\u0079\u0070\u0065\u0020\u006d\u0069s\u0073\u0069\u006e\u0067");return nil ,ErrRequiredAttributeMissing ;};_cbeaa ,_aaeeb :=_bfefd .(*_fg .PdfObjectInteger );
|
||
if !_aaeeb {_aa .Log .Debug ("\u0050\u0061\u0069\u006e\u0074\u0054y\u0070\u0065\u0020\u006e\u006f\u0074\u0020\u0061\u006e\u0020\u0069\u006e\u0074e\u0067\u0065\u0072\u0020\u0028\u0067\u006ft\u0020\u0025\u0054\u0029",_bfefd );return nil ,_fg .ErrTypeError ;
|
||
};_afeedc .PaintType =_cbeaa ;_bfefd =_ggcde .Get ("\u0054\u0069\u006c\u0069\u006e\u0067\u0054\u0079\u0070\u0065");if _bfefd ==nil {_aa .Log .Debug ("\u0054i\u006ci\u006e\u0067\u0054\u0079\u0070e\u0020\u006di\u0073\u0073\u0069\u006e\u0067");return nil ,ErrRequiredAttributeMissing ;
|
||
};_becgf ,_aaeeb :=_bfefd .(*_fg .PdfObjectInteger );if !_aaeeb {_aa .Log .Debug ("\u0054\u0069\u006cin\u0067\u0054\u0079\u0070\u0065\u0020\u006e\u006f\u0074 \u0061n\u0020i\u006et\u0065\u0067\u0065\u0072\u0020\u0028\u0067\u006f\u0074\u0020\u0025\u0054\u0029",_bfefd );
|
||
return nil ,_fg .ErrTypeError ;};_afeedc .TilingType =_becgf ;_bfefd =_ggcde .Get ("\u0042\u0042\u006f\u0078");if _bfefd ==nil {_aa .Log .Debug ("\u0042\u0042\u006fx\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067");return nil ,ErrRequiredAttributeMissing ;
|
||
};_bfefd =_fg .TraceToDirectObject (_bfefd );_bagee ,_aaeeb :=_bfefd .(*_fg .PdfObjectArray );if !_aaeeb {_aa .Log .Debug ("\u0042B\u006f\u0078 \u0073\u0068\u006fu\u006c\u0064\u0020\u0062\u0065\u0020\u0073p\u0065\u0063\u0069\u0066\u0069\u0065d\u0020\u0062\u0079\u0020\u0061\u006e\u0020\u0061\u0072\u0072\u0061y\u0020\u0028\u0067\u006f\u0074\u0020\u0025\u0054\u0029",_bfefd );
|
||
return nil ,_fg .ErrTypeError ;};_dbafg ,_cggdec :=NewPdfRectangle (*_bagee );if _cggdec !=nil {_aa .Log .Debug ("\u0042\u0042\u006f\u0078\u0020\u0065\u0072\u0072\u006fr\u003a\u0020\u0025\u0076",_cggdec );return nil ,_cggdec ;};_afeedc .BBox =_dbafg ;_bfefd =_ggcde .Get ("\u0058\u0053\u0074e\u0070");
|
||
if _bfefd ==nil {_aa .Log .Debug ("\u0058\u0053\u0074\u0065\u0070\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067");return nil ,ErrRequiredAttributeMissing ;};_fdcea ,_cggdec :=_fg .GetNumberAsFloat (_bfefd );if _cggdec !=nil {_aa .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0067\u0065\u0074\u0074\u0069\u006e\u0067\u0020\u0058S\u0074e\u0070\u0020\u0061\u0073\u0020\u0066\u006c\u006f\u0061\u0074\u003a\u0020\u0025\u0076",_fdcea );
|
||
return nil ,_cggdec ;};_afeedc .XStep =_fg .MakeFloat (_fdcea );_bfefd =_ggcde .Get ("\u0059\u0053\u0074e\u0070");if _bfefd ==nil {_aa .Log .Debug ("\u0059\u0053\u0074\u0065\u0070\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067");return nil ,ErrRequiredAttributeMissing ;
|
||
};_agbdf ,_cggdec :=_fg .GetNumberAsFloat (_bfefd );if _cggdec !=nil {_aa .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0067\u0065\u0074\u0074\u0069\u006e\u0067\u0020\u0059S\u0074e\u0070\u0020\u0061\u0073\u0020\u0066\u006c\u006f\u0061\u0074\u003a\u0020\u0025\u0076",_agbdf );
|
||
return nil ,_cggdec ;};_afeedc .YStep =_fg .MakeFloat (_agbdf );_bfefd =_ggcde .Get ("\u0052e\u0073\u006f\u0075\u0072\u0063\u0065s");if _bfefd ==nil {_aa .Log .Debug ("\u0052\u0065\u0073\u006f\u0075\u0072\u0063\u0065\u0073\u0020\u006d\u0069s\u0073\u0069\u006e\u0067");
|
||
return nil ,ErrRequiredAttributeMissing ;};_ggcde ,_aaeeb =_fg .TraceToDirectObject (_bfefd ).(*_fg .PdfObjectDictionary );if !_aaeeb {return nil ,_d .Errorf ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0072\u0065\u0073\u006f\u0075\u0072\u0063e\u0020d\u0069\u0063\u0074\u0069\u006f\u006e\u0061\u0072\u0079\u0020\u0028\u0025\u0054\u0029",_bfefd );
|
||
};_egffb ,_cggdec :=NewPdfPageResourcesFromDict (_ggcde );if _cggdec !=nil {return nil ,_cggdec ;};_afeedc .Resources =_egffb ;if _cefgg :=_ggcde .Get ("\u004d\u0061\u0074\u0072\u0069\u0078");_cefgg !=nil {_cegag ,_dbabc :=_cefgg .(*_fg .PdfObjectArray );
|
||
if !_dbabc {_aa .Log .Debug ("\u004d\u0061\u0074\u0072i\u0078\u0020\u006e\u006f\u0074\u0020\u0061\u006e\u0020\u0061r\u0072a\u0079\u0020\u0028\u0067\u006f\u0074\u0020%\u0054\u0029",_cefgg );return nil ,_fg .ErrTypeError ;};_afeedc .Matrix =_cegag ;};return _afeedc ,nil ;
|
||
};
|
||
|
||
// PdfFunctionType3 defines stitching of the subdomains of several 1-input functions to produce
|
||
// a single new 1-input function.
|
||
type PdfFunctionType3 struct{Domain []float64 ;Range []float64 ;Functions []PdfFunction ;Bounds []float64 ;Encode []float64 ;_daga *_fg .PdfIndirectObject ;};func _ccde (_aagge *_fg .PdfObjectDictionary )(*PdfShadingType1 ,error ){_fecfa :=PdfShadingType1 {};
|
||
if _dgcac :=_aagge .Get ("\u0044\u006f\u006d\u0061\u0069\u006e");_dgcac !=nil {_dgcac =_fg .TraceToDirectObject (_dgcac );_cbcad ,_faaedg :=_dgcac .(*_fg .PdfObjectArray );if !_faaedg {_aa .Log .Debug ("\u0044\u006f\u006d\u0061i\u006e\u0020\u006e\u006f\u0074\u0020\u0061\u006e\u0020\u0061r\u0072a\u0079\u0020\u0028\u0067\u006f\u0074\u0020%\u0054\u0029",_dgcac );
|
||
return nil ,_ce .New ("\u0074\u0079p\u0065\u0020\u0063h\u0065\u0063\u006b\u0020\u0065\u0072\u0072\u006f\u0072");};_fecfa .Domain =_cbcad ;};if _dcfeb :=_aagge .Get ("\u004d\u0061\u0074\u0072\u0069\u0078");_dcfeb !=nil {_dcfeb =_fg .TraceToDirectObject (_dcfeb );
|
||
_ddggb ,_fddbe :=_dcfeb .(*_fg .PdfObjectArray );if !_fddbe {_aa .Log .Debug ("\u004d\u0061\u0074\u0072i\u0078\u0020\u006e\u006f\u0074\u0020\u0061\u006e\u0020\u0061r\u0072a\u0079\u0020\u0028\u0067\u006f\u0074\u0020%\u0054\u0029",_dcfeb );return nil ,_ce .New ("\u0074\u0079p\u0065\u0020\u0063h\u0065\u0063\u006b\u0020\u0065\u0072\u0072\u006f\u0072");
|
||
};_fecfa .Matrix =_ddggb ;};_fefff :=_aagge .Get ("\u0046\u0075\u006e\u0063\u0074\u0069\u006f\u006e");if _fefff ==nil {_aa .Log .Debug ("\u0052\u0065q\u0075\u0069\u0072\u0065d\u0020\u0061t\u0074\u0072\u0069\u0062\u0075\u0074\u0065\u0020m\u0069\u0073\u0073\u0069\u006e\u0067\u003a\u0020\u0020\u0046\u0075\u006ec\u0074\u0069\u006f\u006e");
|
||
return nil ,ErrRequiredAttributeMissing ;};_fecfa .Function =[]PdfFunction {};if _cdecb ,_ecbef :=_fefff .(*_fg .PdfObjectArray );_ecbef {for _ ,_aeabbf :=range _cdecb .Elements (){_gbgbd ,_efeb :=_defgb (_aeabbf );if _efeb !=nil {_aa .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0070\u0061\u0072\u0073\u0069n\u0067\u0020\u0066\u0075\u006e\u0063\u0074\u0069\u006f\u006e:\u0020\u0025\u0076",_efeb );
|
||
return nil ,_efeb ;};_fecfa .Function =append (_fecfa .Function ,_gbgbd );};}else {_aegbc ,_bfdg :=_defgb (_fefff );if _bfdg !=nil {_aa .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0070\u0061\u0072\u0073\u0069n\u0067\u0020\u0066\u0075\u006e\u0063\u0074\u0069\u006f\u006e:\u0020\u0025\u0076",_bfdg );
|
||
return nil ,_bfdg ;};_fecfa .Function =append (_fecfa .Function ,_aegbc );};return &_fecfa ,nil ;};
|
||
|
||
// GetNumComponents returns the number of color components (1 for Separation).
|
||
func (_dbdb *PdfColorspaceSpecialSeparation )GetNumComponents ()int {return 1};
|
||
|
||
// Transform rectangle with the supplied matrix.
|
||
func (_abagb *PdfRectangle )Transform (transformMatrix _gbe .Matrix ){_abagb .Llx ,_abagb .Lly =transformMatrix .Transform (_abagb .Llx ,_abagb .Lly );_abagb .Urx ,_abagb .Ury =transformMatrix .Transform (_abagb .Urx ,_abagb .Ury );_abagb .Normalize ();
|
||
};var _dbfbeb =false ;
|
||
|
||
// PdfSignature represents a PDF signature dictionary and is used for signing via form signature fields.
|
||
// (Section 12.8, Table 252 - Entries in a signature dictionary p. 475 in PDF32000_2008).
|
||
type PdfSignature struct{Handler SignatureHandler ;_fbbgf *_fg .PdfIndirectObject ;
|
||
|
||
// Type: Sig/DocTimeStamp
|
||
Type *_fg .PdfObjectName ;Filter *_fg .PdfObjectName ;SubFilter *_fg .PdfObjectName ;Contents *_fg .PdfObjectString ;Cert _fg .PdfObject ;ByteRange *_fg .PdfObjectArray ;Reference *_fg .PdfObjectArray ;Changes *_fg .PdfObjectArray ;Name *_fg .PdfObjectString ;
|
||
M *_fg .PdfObjectString ;Location *_fg .PdfObjectString ;Reason *_fg .PdfObjectString ;ContactInfo *_fg .PdfObjectString ;R *_fg .PdfObjectInteger ;V *_fg .PdfObjectInteger ;PropBuild *_fg .PdfObjectDictionary ;PropAuthTime *_fg .PdfObjectInteger ;PropAuthType *_fg .PdfObjectName ;
|
||
};
|
||
|
||
// ImageToRGB convert an indexed image to RGB.
|
||
func (_eacf *PdfColorspaceSpecialIndexed )ImageToRGB (img Image )(Image ,error ){N :=_eacf .Base .GetNumComponents ();if N < 1{return Image {},_d .Errorf ("\u0062\u0061d \u0062\u0061\u0073e\u0020\u0063\u006f\u006cors\u0070ac\u0065\u0020\u004e\u0075\u006d\u0043\u006fmp\u006f\u006e\u0065\u006e\u0074\u0073\u003d%\u0064",N );
|
||
};_affb :=_cc .NewImageBase (int (img .Width ),int (img .Height ),8,N ,nil ,img ._gccd ,img ._dbge );_afff :=_ade .NewReader (img .getBase ());_dbgf :=_ade .NewWriter (_affb );var (_efgg uint32 ;_gaf int ;_eagc error ;);for {_efgg ,_eagc =_afff .ReadSample ();
|
||
if _eagc ==_ff .EOF {break ;}else if _eagc !=nil {return img ,_eagc ;};_gaf =int (_efgg );_aa .Log .Trace ("\u0049\u006ed\u0065\u0078\u0065\u0064\u003a\u0020\u0069\u006e\u0064\u0065\u0078\u003d\u0025\u0064\u0020\u004e\u003d\u0025\u0064\u0020\u006c\u0075t=\u0025\u0064",_gaf ,N ,len (_eacf ._acce ));
|
||
if (_gaf +1)*N > len (_eacf ._acce ){_gaf =len (_eacf ._acce )/N -1;_aa .Log .Trace ("C\u006c\u0069\u0070\u0070in\u0067 \u0074\u006f\u0020\u0069\u006ed\u0065\u0078\u003a\u0020\u0025\u0064",_gaf );if _gaf < 0{_aa .Log .Debug ("\u0045R\u0052\u004fR\u003a\u0020\u0043a\u006e\u0027\u0074\u0020\u0063\u006c\u0069p\u0020\u0069\u006e\u0064\u0065\u0078.\u0020\u0049\u0073\u0020\u0050\u0044\u0046\u0020\u0066\u0069\u006ce\u0020\u0064\u0061\u006d\u0061\u0067\u0065\u0064\u003f");
|
||
break ;};};for _fafb :=_gaf *N ;_fafb < (_gaf +1)*N ;_fafb ++{if _eagc =_dbgf .WriteSample (uint32 (_eacf ._acce [_fafb ]));_eagc !=nil {return img ,_eagc ;};};};return _eacf .Base .ImageToRGB (_adad (&_affb ));};
|
||
|
||
// NewCompositePdfFontFromTTF loads a composite TTF font. Composite fonts can
|
||
// be used to represent unicode fonts which can have multi-byte character codes, representing a wide
|
||
// range of values. They are often used for symbolic languages, including Chinese, Japanese and Korean.
|
||
// It is represented by a Type0 Font with an underlying CIDFontType2 and an Identity-H encoding map.
|
||
// TODO: May be extended in the future to support a larger variety of CMaps and vertical fonts.
|
||
// NOTE: For simple fonts, use NewPdfFontFromTTF.
|
||
func NewCompositePdfFontFromTTF (r _ff .ReadSeeker )(*PdfFont ,error ){_bggd ,_agad :=_ga .ReadAll (r );if _agad !=nil {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0055\u006e\u0061\u0062\u006c\u0065 \u0074\u006f\u0020\u0072\u0065\u0061d\u0020\u0066\u006f\u006e\u0074\u0020\u0063\u006f\u006e\u0074\u0065\u006e\u0074s\u003a\u0020\u0025\u0076",_agad );
|
||
return nil ,_agad ;};_ecdfa ,_agad :=_eed .TtfParse (_cb .NewReader (_bggd ));if _agad !=nil {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a \u0077\u0068\u0069\u006c\u0065\u0020\u006c\u006f\u0061\u0064\u0069\u006e\u0067 \u0074\u0074\u0066\u0020\u0066\u006f\u006et\u003a\u0020\u0025\u0076",_agad );
|
||
return nil ,_agad ;};_bgbd :=&pdfCIDFontType2 {fontCommon :fontCommon {_ggcfc :"\u0043\u0049\u0044F\u006f\u006e\u0074\u0054\u0079\u0070\u0065\u0032"},CIDToGIDMap :_fg .MakeName ("\u0049\u0064\u0065\u006e\u0074\u0069\u0074\u0079")};if len (_ecdfa .Widths )<=0{return nil ,_ce .New ("\u0045\u0052\u0052O\u0052\u003a\u0020\u004d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0072\u0065\u0071\u0075\u0069\u0072\u0065\u0064\u0020\u0061\u0074\u0074\u0072\u0069\u0062\u0075\u0074\u0065 \u0028\u0057\u0069\u0064\u0074\u0068\u0073\u0029");
|
||
};_becfg :=1000.0/float64 (_ecdfa .UnitsPerEm );_gbedc :=_becfg *float64 (_ecdfa .Widths [0]);_cafe :=make (map[rune ]int );_bfdea :=make (map[_eed .GID ]int );_fcbc :=_eed .GID (len (_ecdfa .Widths ));for _ebfaa ,_ccef :=range _ecdfa .Chars {if _ccef > _fcbc -1{continue ;
|
||
};_fccf :=int (_becfg *float64 (_ecdfa .Widths [_ccef ]));_cafe [_ebfaa ]=_fccf ;_bfdea [_ccef ]=_fccf ;};_bgbd ._ebda =_cafe ;_bgbd .DW =_fg .MakeInteger (int64 (_gbedc ));_cbagg :=_fffd (_bfdea ,uint16 (_fcbc ));_bgbd .W =_fg .MakeIndirectObject (_cbagg );
|
||
_ggdf :=_fg .MakeDict ();_ggdf .Set ("\u004f\u0072\u0064\u0065\u0072\u0069\u006e\u0067",_fg .MakeString ("\u0049\u0064\u0065\u006e\u0074\u0069\u0074\u0079"));_ggdf .Set ("\u0052\u0065\u0067\u0069\u0073\u0074\u0072\u0079",_fg .MakeString ("\u0041\u0064\u006fb\u0065"));
|
||
_ggdf .Set ("\u0053\u0075\u0070\u0070\u006c\u0065\u006d\u0065\u006e\u0074",_fg .MakeInteger (0));_bgbd .CIDSystemInfo =_ggdf ;_bgfb :=&PdfFontDescriptor {FontName :_fg .MakeName (_ecdfa .PostScriptName ),Ascent :_fg .MakeFloat (_becfg *float64 (_ecdfa .TypoAscender )),Descent :_fg .MakeFloat (_becfg *float64 (_ecdfa .TypoDescender )),CapHeight :_fg .MakeFloat (_becfg *float64 (_ecdfa .CapHeight )),FontBBox :_fg .MakeArrayFromFloats ([]float64 {_becfg *float64 (_ecdfa .Xmin ),_becfg *float64 (_ecdfa .Ymin ),_becfg *float64 (_ecdfa .Xmax ),_becfg *float64 (_ecdfa .Ymax )}),ItalicAngle :_fg .MakeFloat (_ecdfa .ItalicAngle ),MissingWidth :_fg .MakeFloat (_gbedc )};
|
||
_fefe ,_agad :=_fg .MakeStream (_bggd ,_fg .NewFlateEncoder ());if _agad !=nil {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0055\u006e\u0061\u0062\u006c\u0065\u0020\u0074o\u0020m\u0061\u006b\u0065\u0020\u0073\u0074\u0072\u0065\u0061\u006d\u003a\u0020\u0025\u0076",_agad );
|
||
return nil ,_agad ;};_fefe .PdfObjectDictionary .Set ("\u004ce\u006e\u0067\u0074\u0068\u0031",_fg .MakeInteger (int64 (len (_bggd ))));_bgfb .FontFile2 =_fefe ;if _ecdfa .Bold {_bgfb .StemV =_fg .MakeInteger (120);}else {_bgfb .StemV =_fg .MakeInteger (70);
|
||
};_fecb :=_dbbc ;if _ecdfa .IsFixedPitch {_fecb |=_aeada ;};if _ecdfa .ItalicAngle !=0{_fecb |=_aedcf ;};_bgfb .Flags =_fg .MakeInteger (int64 (_fecb ));_bgbd ._aefg =_ecdfa .PostScriptName ;_bgbd ._cdgef =_bgfb ;_gabce :=pdfFontType0 {fontCommon :fontCommon {_ggcfc :"\u0054\u0079\u0070e\u0030",_aefg :_ecdfa .PostScriptName },DescendantFont :&PdfFont {_gcaeff :_bgbd },Encoding :_fg .MakeName ("\u0049\u0064\u0065\u006e\u0074\u0069\u0074\u0079\u002d\u0048"),_bcacf :_ecdfa .NewEncoder ()};
|
||
if len (_ecdfa .Chars )> 0{_edfeg :=make (map[_fc .CharCode ]rune ,len (_ecdfa .Chars ));for _cffgdb ,_egeg :=range _ecdfa .Chars {_begf :=_fc .CharCode (_egeg );if _bcbcb ,_gfaaf :=_edfeg [_begf ];!_gfaaf ||(_gfaaf &&_bcbcb > _cffgdb ){_edfeg [_begf ]=_cffgdb ;
|
||
};};_gabce ._agab =_fc .NewToUnicodeCMap (_edfeg );};_dba :=PdfFont {_gcaeff :&_gabce };return &_dba ,nil ;};
|
||
|
||
// XObjectForm (Table 95 in 8.10.2).
|
||
type XObjectForm struct{Filter _fg .StreamEncoder ;FormType _fg .PdfObject ;BBox _fg .PdfObject ;Matrix _fg .PdfObject ;Resources *PdfPageResources ;Group _fg .PdfObject ;Ref _fg .PdfObject ;MetaData _fg .PdfObject ;PieceInfo _fg .PdfObject ;LastModified _fg .PdfObject ;
|
||
StructParent _fg .PdfObject ;StructParents _fg .PdfObject ;OPI _fg .PdfObject ;OC _fg .PdfObject ;Name _fg .PdfObject ;
|
||
|
||
// Stream data.
|
||
Stream []byte ;_bdage *_fg .PdfObjectStream ;};
|
||
|
||
// GetContainingPdfObject implements interface PdfModel.
|
||
func (_ccccf *Permissions )GetContainingPdfObject ()_fg .PdfObject {return _ccccf ._gdfff };func (_gdac fontCommon )asPdfObjectDictionary (_cgbg string )*_fg .PdfObjectDictionary {if _cgbg !=""&&_gdac ._ggcfc !=""&&_cgbg !=_gdac ._ggcfc {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0061\u0073\u0050\u0064\u0066\u004f\u0062\u006a\u0065\u0063\u0074\u0044\u0069c\u0074\u0069\u006f\u006e\u0061\u0072\u0079\u002e\u0020O\u0076\u0065\u0072\u0072\u0069\u0064\u0069\u006e\u0067\u0020\u0073\u0075\u0062t\u0079\u0070\u0065\u0020\u0074\u006f \u0025\u0023\u0071 \u0025\u0073",_cgbg ,_gdac );
|
||
}else if _cgbg ==""&&_gdac ._ggcfc ==""{_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0061s\u0050\u0064\u0066Ob\u006a\u0065\u0063\u0074\u0044\u0069c\u0074\u0069\u006f\u006e\u0061\u0072\u0079\u0020\u006e\u006f\u0020\u0073\u0075\u0062\u0074y\u0070\u0065\u002e\u0020\u0066\u006f\u006e\u0074=\u0025\u0073",_gdac );
|
||
}else if _gdac ._ggcfc ==""{_gdac ._ggcfc =_cgbg ;};_dccd :=_fg .MakeDict ();_dccd .Set ("\u0054\u0079\u0070\u0065",_fg .MakeName ("\u0046\u006f\u006e\u0074"));_dccd .Set ("\u0042\u0061\u0073\u0065\u0046\u006f\u006e\u0074",_fg .MakeName (_gdac ._aefg ));
|
||
_dccd .Set ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName (_gdac ._ggcfc ));if _gdac ._cdgef !=nil {_dccd .Set ("\u0046\u006f\u006e\u0074\u0044\u0065\u0073\u0063\u0072i\u0070\u0074\u006f\u0072",_gdac ._cdgef .ToPdfObject ());};if _gdac ._eggb !=nil {_dccd .Set ("\u0054o\u0055\u006e\u0069\u0063\u006f\u0064e",_gdac ._eggb );
|
||
}else if _gdac ._agab !=nil {_afcae ,_ffgd :=_gdac ._agab .Stream ();if _ffgd !=nil {_aa .Log .Debug ("\u0057\u0041\u0052\u004e\u003a\u0020\u0063\u006f\u0075\u006c\u0064\u0020\u006eo\u0074\u0020\u0067\u0065\u0074\u0020C\u004d\u0061\u0070\u0020\u0073\u0074\u0072\u0065\u0061\u006d\u002e\u0020\u0065r\u0072\u003d\u0025\u0076",_ffgd );
|
||
}else {_dccd .Set ("\u0054o\u0055\u006e\u0069\u0063\u006f\u0064e",_afcae );};};return _dccd ;};
|
||
|
||
// DecodeArray returns an empty slice as there are no components associated with pattern colorspace.
|
||
func (_debd *PdfColorspaceSpecialPattern )DecodeArray ()[]float64 {return []float64 {}};
|
||
|
||
// ColorFromPdfObjects returns a new PdfColor based on the input slice of color
|
||
// components. The slice should contain a single PdfObjectFloat element.
|
||
func (_gaecd *PdfColorspaceSpecialIndexed )ColorFromPdfObjects (objects []_fg .PdfObject )(PdfColor ,error ){if len (objects )!=1{return nil ,_ce .New ("r\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b");};_cgfb ,_deef :=_fg .GetNumbersAsFloat (objects );
|
||
if _deef !=nil {return nil ,_deef ;};return _gaecd .ColorFromFloats (_cgfb );};func (_fgbgea *PdfWriter )optimizeDocument ()error {if _fgbgea ._effb ==nil {return nil ;};_afafc ,_cgcca :=_fg .GetDict (_fgbgea ._deabg );if !_cgcca {return _ce .New ("\u0061\u006e\u0020in\u0066\u006f\u0020\u006f\u0062\u006a\u0065\u0063\u0074 \u0069s\u0020n\u006ft\u0020\u0061\u0020\u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061\u0072\u0079");
|
||
};_accb :=_dab .Document {ID :[2]string {_fgbgea ._deeab ,_fgbgea ._ccccb },Version :_fgbgea ._fbbec ,Objects :_fgbgea ._bbfd ,Info :_afafc ,Crypt :_fgbgea ._bbdbd ,UseHashBasedID :_fgbgea ._gaaaab };if _cdbcd :=_fgbgea ._effb .ApplyStandard (&_accb );
|
||
_cdbcd !=nil {return _cdbcd ;};_fgbgea ._deeab ,_fgbgea ._ccccb =_accb .ID [0],_accb .ID [1];_fgbgea ._fbbec =_accb .Version ;_fgbgea ._bbfd =_accb .Objects ;_fgbgea ._deabg .PdfObject =_accb .Info ;_fgbgea ._gaaaab =_accb .UseHashBasedID ;_fgbgea ._bbdbd =_accb .Crypt ;
|
||
_gfgd :=make (map[_fg .PdfObject ]struct{},len (_fgbgea ._bbfd ));for _ ,_bebcg :=range _fgbgea ._bbfd {_gfgd [_bebcg ]=struct{}{};};_fgbgea ._gcbec =_gfgd ;return nil ;};
|
||
|
||
// NewPdfActionGoToE returns a new "go to embedded" action.
|
||
func NewPdfActionGoToE ()*PdfActionGoToE {_dd :=NewPdfAction ();_acd :=&PdfActionGoToE {};_acd .PdfAction =_dd ;_dd .SetContext (_acd );return _acd ;};
|
||
|
||
// RunesToCharcodeBytes maps the provided runes to charcode bytes and it
|
||
// returns the resulting slice of bytes, along with the number of runes which
|
||
// could not be converted. If the number of misses is 0, all runes were
|
||
// successfully converted.
|
||
func (_ecad *PdfFont )RunesToCharcodeBytes (data []rune )([]byte ,int ){var _cdbe []_dg .TextEncoder ;var _edeb _dg .CMapEncoder ;if _eefdf :=_ecad .baseFields ()._agab ;_eefdf !=nil {_edeb =_dg .NewCMapEncoder ("",nil ,_eefdf );};_gbgc :=_ecad .Encoder ();
|
||
if _gbgc !=nil {switch _efdf :=_gbgc .(type ){case _dg .SimpleEncoder :_eacd :=_efdf .BaseName ();if _ ,_gafd :=_cgdb [_eacd ];_gafd {_cdbe =append (_cdbe ,_gbgc );};};};if len (_cdbe )==0{if _ecad .baseFields ()._agab !=nil {_cdbe =append (_cdbe ,_edeb );
|
||
};if _gbgc !=nil {_cdbe =append (_cdbe ,_gbgc );};};var _edgf _cb .Buffer ;var _cgcbg int ;for _ ,_dddd :=range data {var _edgfd bool ;for _ ,_edgb :=range _cdbe {if _bgaf :=_edgb .Encode (string (_dddd ));len (_bgaf )> 0{_edgf .Write (_bgaf );_edgfd =true ;
|
||
break ;};};if !_edgfd {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020f\u0061\u0069\u006ce\u0064\u0020\u0074\u006f \u006d\u0061\u0070\u0020\u0072\u0075\u006e\u0065\u0020\u0060\u0025\u002b\u0071\u0060\u0020\u0074\u006f\u0020\u0063\u0068\u0061\u0072\u0063\u006f\u0064\u0065",_dddd );
|
||
_cgcbg ++;};};if _cgcbg !=0{_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a \u0063\u006f\u0075\u006c\u0064\u0020\u006e\u006f\u0074\u0020\u0063\u006f\u006e\u0076\u0065\u0072\u0074\u0020\u0061\u006cl\u0020\u0072\u0075\u006e\u0065\u0073\u0020\u0074\u006f\u0020\u0063\u0068\u0061\u0072c\u006fd\u0065\u0073\u002e\u000a"+"\u0009\u006e\u0075\u006d\u0052\u0075\u006e\u0065\u0073\u003d\u0025d\u0020\u006e\u0075\u006d\u004d\u0069\u0073\u0073\u0065\u0073=\u0025\u0064\u000a"+"\t\u0066\u006f\u006e\u0074=%\u0073 \u0065\u006e\u0063\u006f\u0064e\u0072\u0073\u003d\u0025\u002b\u0076",len (data ),_cgcbg ,_ecad ,_cdbe );
|
||
};return _edgf .Bytes (),_cgcbg ;};func (_cef *PdfColorspaceDeviceGray )String ()string {return "\u0044\u0065\u0076\u0069\u0063\u0065\u0047\u0072\u0061\u0079";};
|
||
|
||
// ToGray returns a PdfColorDeviceGray color based on the current RGB color.
|
||
func (_gbca *PdfColorDeviceRGB )ToGray ()*PdfColorDeviceGray {_bdbe :=0.3*_gbca .R ()+0.59*_gbca .G ()+0.11*_gbca .B ();_bdbe =_ef .Min (_ef .Max (_bdbe ,0.0),1.0);return NewPdfColorDeviceGray (_bdbe );};
|
||
|
||
// PdfColorCalGray represents a CalGray colorspace.
|
||
type PdfColorCalGray float64 ;
|
||
|
||
// GetCharMetrics returns the character metrics for the specified character code. A bool flag is
|
||
// returned to indicate whether or not the entry was found in the glyph to charcode mapping.
|
||
// How it works:
|
||
// 1) Return a value the /Widths array (charWidths) if there is one.
|
||
// 2) If the font has the same name as a standard 14 font then return width=250.
|
||
// 3) Otherwise return no match and let the caller substitute a default.
|
||
func (_cafdg pdfFontSimple )GetCharMetrics (code _dg .CharCode )(_eed .CharMetrics ,bool ){if _cedg ,_aeggb :=_cafdg ._fcgbd [code ];_aeggb {return _eed .CharMetrics {Wx :_cedg },true ;};if _eed .IsStdFont (_eed .StdFontName (_cafdg ._aefg )){return _eed .CharMetrics {Wx :250},true ;
|
||
};return _eed .CharMetrics {},false ;};func (_abe *PdfReader )newPdfAnnotation3DFromDict (_ecfbe *_fg .PdfObjectDictionary )(*PdfAnnotation3D ,error ){_bae :=PdfAnnotation3D {};_bae .T3DD =_ecfbe .Get ("\u0033\u0044\u0044");_bae .T3DV =_ecfbe .Get ("\u0033\u0044\u0056");
|
||
_bae .T3DA =_ecfbe .Get ("\u0033\u0044\u0041");_bae .T3DI =_ecfbe .Get ("\u0033\u0044\u0049");_bae .T3DB =_ecfbe .Get ("\u0033\u0044\u0042");return &_bae ,nil ;};func (_bbgdd *XObjectImage )getParamsDict ()*_fg .PdfObjectDictionary {_adcac :=_fg .MakeDict ();
|
||
_adcac .Set ("\u0057\u0069\u0064t\u0068",_fg .MakeInteger (*_bbgdd .Width ));_adcac .Set ("\u0048\u0065\u0069\u0067\u0068\u0074",_fg .MakeInteger (*_bbgdd .Height ));_adcac .Set ("\u0043o\u006co\u0072\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074\u0073",_fg .MakeInteger (int64 (_bbgdd .ColorSpace .GetNumComponents ())));
|
||
_adcac .Set ("\u0042\u0069t\u0073\u0050\u0065r\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074",_fg .MakeInteger (*_bbgdd .BitsPerComponent ));return _adcac ;};
|
||
|
||
// PdfAnnotationStamp represents Stamp annotations.
|
||
// (Section 12.5.6.12).
|
||
type PdfAnnotationStamp struct{*PdfAnnotation ;*PdfAnnotationMarkup ;Name _fg .PdfObject ;};
|
||
|
||
// GetXObjectImageByName returns the XObjectImage with the specified name from the
|
||
// page resources, if it exists.
|
||
func (_fgabd *PdfPageResources )GetXObjectImageByName (keyName _fg .PdfObjectName )(*XObjectImage ,error ){_cbbedd ,_efcfe :=_fgabd .GetXObjectByName (keyName );if _cbbedd ==nil {return nil ,nil ;};if _efcfe !=XObjectTypeImage {return nil ,_ce .New ("\u006e\u006f\u0074 \u0061\u006e\u0020\u0069\u006d\u0061\u0067\u0065");
|
||
};_ffade ,_gbebd :=NewXObjectImageFromStream (_cbbedd );if _gbebd !=nil {return nil ,_gbebd ;};return _ffade ,nil ;};
|
||
|
||
// WriteString outputs the object as it is to be written to file.
|
||
func (_ceedg *pdfSignDictionary )WriteString ()string {_ceedg ._afade =0;_ceedg ._accg =0;_ceedg ._aegfb =0;_ceedg ._ecdgb =0;_ecefc :=_cb .NewBuffer (nil );_ecefc .WriteString ("\u003c\u003c");for _ ,_fadg :=range _ceedg .Keys (){_gdace :=_ceedg .Get (_fadg );
|
||
switch _fadg {case "\u0042y\u0074\u0065\u0052\u0061\u006e\u0067e":_ecefc .WriteString (_fadg .WriteString ());_ecefc .WriteString ("\u0020");_ceedg ._aegfb =_ecefc .Len ();_ecefc .WriteString (_gdace .WriteString ());_ecefc .WriteString ("\u0020");_ceedg ._ecdgb =_ecefc .Len ()-1;
|
||
case "\u0043\u006f\u006e\u0074\u0065\u006e\u0074\u0073":_ecefc .WriteString (_fadg .WriteString ());_ecefc .WriteString ("\u0020");_ceedg ._afade =_ecefc .Len ();_ecefc .WriteString (_gdace .WriteString ());_ecefc .WriteString ("\u0020");_ceedg ._accg =_ecefc .Len ()-1;
|
||
default:_ecefc .WriteString (_fadg .WriteString ());_ecefc .WriteString ("\u0020");_ecefc .WriteString (_gdace .WriteString ());};};_ecefc .WriteString ("\u003e\u003e");return _ecefc .String ();};
|
||
|
||
// GetContainingPdfObject returns the container of the image object (indirect object).
|
||
func (_gdcb *XObjectImage )GetContainingPdfObject ()_fg .PdfObject {return _gdcb ._eafbc };
|
||
|
||
// GetContainingPdfObject returns the container of the PdfAcroForm (indirect object).
|
||
func (_bffa *PdfAcroForm )GetContainingPdfObject ()_fg .PdfObject {return _bffa ._daca };
|
||
|
||
// PdfActionMovie represents a movie action.
|
||
type PdfActionMovie struct{*PdfAction ;Annotation _fg .PdfObject ;T _fg .PdfObject ;Operation _fg .PdfObject ;};func (_degcd *PdfWriter )writeDocumentVersion (){if _degcd ._cdafg {_degcd .writeString ("\u000a");}else {_degcd .writeString (_d .Sprintf ("\u0025\u0025\u0050D\u0046\u002d\u0025\u0064\u002e\u0025\u0064\u000a",_degcd ._fbbec .Major ,_degcd ._fbbec .Minor ));
|
||
_degcd .writeString ("\u0025\u00e2\u00e3\u00cf\u00d3\u000a");};};
|
||
|
||
// ToInteger convert to an integer format.
|
||
func (_ffd *PdfColorDeviceCMYK )ToInteger (bits int )[4]uint32 {_egdd :=_ef .Pow (2,float64 (bits ))-1;return [4]uint32 {uint32 (_egdd *_ffd .C ()),uint32 (_egdd *_ffd .M ()),uint32 (_egdd *_ffd .Y ()),uint32 (_egdd *_ffd .K ())};};
|
||
|
||
// XObjectType represents the type of an XObject.
|
||
type XObjectType int ;
|
||
|
||
// GetNumComponents returns the number of color components (4 for CMYK32).
|
||
func (_ceadc *PdfColorDeviceCMYK )GetNumComponents ()int {return 4};var _ pdfFont =(*pdfFontSimple )(nil );
|
||
|
||
// NewPdfField returns an initialized PdfField.
|
||
func NewPdfField ()*PdfField {return &PdfField {_daecc :_fg .MakeIndirectObject (_fg .MakeDict ())}};
|
||
|
||
// SetReason sets the `Reason` field of the signature.
|
||
func (_bfgaf *PdfSignature )SetReason (reason string ){_bfgaf .Reason =_fg .MakeString (reason )};
|
||
|
||
// Image interface is a basic representation of an image used in PDF.
|
||
// The colorspace is not specified, but must be known when handling the image.
|
||
type Image struct{Width int64 ;Height int64 ;BitsPerComponent int64 ;ColorComponents int ;Data []byte ;_gccd []byte ;_dbge []float64 ;};func (_gfb *PdfReader )newPdfActionLaunchFromDict (_gfed *_fg .PdfObjectDictionary )(*PdfActionLaunch ,error ){_cce ,_dfg :=_ddd (_gfed .Get ("\u0046"));
|
||
if _dfg !=nil {return nil ,_dfg ;};return &PdfActionLaunch {Win :_gfed .Get ("\u0057\u0069\u006e"),Mac :_gfed .Get ("\u004d\u0061\u0063"),Unix :_gfed .Get ("\u0055\u006e\u0069\u0078"),NewWindow :_gfed .Get ("\u004ee\u0077\u0057\u0069\u006e\u0064\u006fw"),F :_cce },nil ;
|
||
};
|
||
|
||
// G returns the value of the green component of the color.
|
||
func (_gece *PdfColorDeviceRGB )G ()float64 {return _gece [1]};func (_eeada *PdfWriter )checkCrossReferenceStream ()bool {_ggcgge :=_eeada ._fbbec .Major > 1||(_eeada ._fbbec .Major ==1&&_eeada ._fbbec .Minor > 4);if _eeada ._gefag !=nil {_ggcgge =*_eeada ._gefag ;
|
||
};return _ggcgge ;};
|
||
|
||
// SubsetRegistered subsets the font to only the glyphs that have been registered by the encoder.
|
||
//
|
||
// NOTE: This only works on fonts that support subsetting. For unsupported fonts this is a no-op, although a debug
|
||
// message is emitted. Currently supported fonts are embedded Truetype CID fonts (type 0).
|
||
//
|
||
// NOTE: Make sure to call this soon before writing (once all needed runes have been registered).
|
||
// If using package creator, use its EnableFontSubsetting method instead.
|
||
func (_gabc *PdfFont )SubsetRegistered ()error {switch _fgca :=_gabc ._gcaeff .(type ){case *pdfFontType0 :_cebg :=_fgca .subsetRegistered ();if _cebg !=nil {_aa .Log .Debug ("\u0053\u0075b\u0073\u0065\u0074 \u0065\u0072\u0072\u006f\u0072\u003a\u0020\u0025\u0076",_cebg );
|
||
return _cebg ;};if _fgca ._cgacd !=nil {if _fgca ._bcacf !=nil {_fgca ._bcacf .ToPdfObject ();};_fgca .ToPdfObject ();};default:_aa .Log .Debug ("F\u006f\u006e\u0074\u0020\u0025\u0054 \u0064\u006f\u0065\u0073\u0020\u006eo\u0074\u0020\u0073\u0075\u0070\u0070\u006fr\u0074\u0020\u0073\u0075\u0062\u0073\u0065\u0074\u0074\u0069n\u0067",_fgca );
|
||
};return nil ;};
|
||
|
||
// ToPdfObject converts date to a PDF string object.
|
||
func (_cgcab *PdfDate )ToPdfObject ()_fg .PdfObject {_adcgf :=_d .Sprintf ("\u0044\u003a\u0025\u002e\u0034\u0064\u0025\u002e\u0032\u0064\u0025\u002e\u0032\u0064\u0025\u002e\u0032\u0064\u0025\u002e\u0032\u0064\u0025\u002e2\u0064\u0025\u0063\u0025\u002e2\u0064\u0027%\u002e\u0032\u0064\u0027",_cgcab ._fddef ,_cgcab ._agbab ,_cgcab ._adaba ,_cgcab ._bedbf ,_cgcab ._fgdec ,_cgcab ._cfebe ,_cgcab ._ebdc ,_cgcab ._eedgc ,_cgcab ._gfcga );
|
||
return _fg .MakeString (_adcgf );};
|
||
|
||
// Encoder returns the font's text encoder.
|
||
func (_cffa *PdfFont )Encoder ()_dg .TextEncoder {_ggea :=_cffa .actualFont ();if _ggea ==nil {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0045n\u0063\u006f\u0064er\u0020\u006e\u006f\u0074\u0020\u0069m\u0070\u006c\u0065\u006d\u0065\u006e\u0074\u0065\u0064\u0020\u0066\u006f\u0072\u0020\u0066o\u006e\u0074\u0020\u0074\u0079\u0070\u0065\u003d%\u0023\u0054",_cffa ._gcaeff );
|
||
return nil ;};return _ggea .Encoder ();};func _egcg (_edc *PdfPage )map[_fg .PdfObjectName ]_fg .PdfObject {_fagb :=make (map[_fg .PdfObjectName ]_fg .PdfObject );if _edc .Resources ==nil {return _fagb ;};if _edc .Resources .Font !=nil {if _aafe ,_ede :=_fg .GetDict (_edc .Resources .Font );
|
||
_ede {for _ ,_ddda :=range _aafe .Keys (){_fagb [_ddda ]=_aafe .Get (_ddda );};};};if _edc .Resources .ExtGState !=nil {if _fbfd ,_cfga :=_fg .GetDict (_edc .Resources .ExtGState );_cfga {for _ ,_ggeba :=range _fbfd .Keys (){_fagb [_ggeba ]=_fbfd .Get (_ggeba );
|
||
};};};if _edc .Resources .XObject !=nil {if _faeab ,_egfe :=_fg .GetDict (_edc .Resources .XObject );_egfe {for _ ,_beea :=range _faeab .Keys (){_fagb [_beea ]=_faeab .Get (_beea );};};};if _edc .Resources .Pattern !=nil {if _adab ,_gabb :=_fg .GetDict (_edc .Resources .Pattern );
|
||
_gabb {for _ ,_fdcg :=range _adab .Keys (){_fagb [_fdcg ]=_adab .Get (_fdcg );};};};if _edc .Resources .Shading !=nil {if _aeff ,_abda :=_fg .GetDict (_edc .Resources .Shading );_abda {for _ ,_egcf :=range _aeff .Keys (){_fagb [_egcf ]=_aeff .Get (_egcf );
|
||
};};};if _edc .Resources .ProcSet !=nil {if _aaeb ,_gbdb :=_fg .GetDict (_edc .Resources .ProcSet );_gbdb {for _ ,_cffg :=range _aaeb .Keys (){_fagb [_cffg ]=_aaeb .Get (_cffg );};};};if _edc .Resources .Properties !=nil {if _bfaaf ,_cfdc :=_fg .GetDict (_edc .Resources .Properties );
|
||
_cfdc {for _ ,_gceg :=range _bfaaf .Keys (){_fagb [_gceg ]=_bfaaf .Get (_gceg );};};};return _fagb ;};
|
||
|
||
// NewPdfShadingPatternType3 creates an empty shading pattern type 3 object.
|
||
func NewPdfShadingPatternType3 ()*PdfShadingPatternType3 {_daafc :=&PdfShadingPatternType3 {};_daafc .Matrix =_fg .MakeArrayFromIntegers ([]int {1,0,0,1,0,0});_daafc .PdfPattern =&PdfPattern {};_daafc .PdfPattern .PatternType =int64 (*_fg .MakeInteger (2));
|
||
_daafc .PdfPattern ._ccdc =_daafc ;_daafc .PdfPattern ._gaac =_fg .MakeIndirectObject (_fg .MakeDict ());return _daafc ;};
|
||
|
||
// SetSubtype sets the Subtype S for given PdfOutputIntent.
|
||
func (_cggb *PdfOutputIntent )SetSubtype (subtype PdfOutputIntentType )error {if !subtype .IsValid (){return _ce .New ("\u0070\u0072o\u0076\u0069\u0064\u0065d\u0020\u0069n\u0076\u0061\u006c\u0069\u0064\u0020\u004f\u0075t\u0070\u0075\u0074\u0049\u006e\u0074\u0065\u006e\u0074\u0020\u0053\u0075b\u0054\u0079\u0070\u0065");
|
||
};_cggb .S =subtype ;return nil ;};func _eeceb (_dafcg _fg .PdfObject )(*PdfFontDescriptor ,error ){_aedaf :=&PdfFontDescriptor {};_dafcg =_fg .ResolveReference (_dafcg );if _bcec ,_defff :=_dafcg .(*_fg .PdfIndirectObject );_defff {_aedaf ._cgcdc =_bcec ;
|
||
_dafcg =_bcec .PdfObject ;};_deece ,_feba :=_fg .GetDict (_dafcg );if !_feba {_aa .Log .Debug ("\u0045\u0052R\u004f\u0052\u003a\u0020\u0046o\u006e\u0074\u0044\u0065\u0073c\u0072\u0069\u0070\u0074\u006f\u0072\u0020\u006e\u006f\u0074\u0020\u0067\u0069\u0076\u0065\u006e\u0020\u0062\u0079\u0020\u0061\u0020\u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061\u0072\u0079\u0020\u0028\u0025\u0054\u0029",_dafcg );
|
||
return nil ,_fg .ErrTypeError ;};if _ccbg :=_deece .Get ("\u0046\u006f\u006e\u0074\u004e\u0061\u006d\u0065");_ccbg !=nil {_aedaf .FontName =_ccbg ;}else {_aa .Log .Debug ("\u0049n\u0063\u006fm\u0070\u0061\u0074\u0069b\u0069\u006c\u0069t\u0079\u003a\u0020\u0046\u006f\u006e\u0074\u004e\u0061me\u0020\u0028\u0052e\u0071\u0075i\u0072\u0065\u0064\u0029\u0020\u006di\u0073\u0073i\u006e\u0067");
|
||
};_cebea ,_ :=_fg .GetName (_aedaf .FontName );if _afgb :=_deece .Get ("\u0054\u0079\u0070\u0065");_afgb !=nil {_bddaag ,_acefg :=_afgb .(*_fg .PdfObjectName );if !_acefg ||string (*_bddaag )!="\u0046\u006f\u006e\u0074\u0044\u0065\u0073\u0063\u0072i\u0070\u0074\u006f\u0072"{_aa .Log .Debug ("I\u006e\u0063\u006f\u006d\u0070\u0061\u0074\u0069\u0062\u0069\u006c\u0069\u0074\u0079\u003a\u0020\u0046\u006f\u006e\u0074\u0020\u0064\u0065\u0073\u0063\u0072i\u0070t\u006f\u0072\u0020\u0054y\u0070\u0065 \u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0028\u0025\u0054\u0029\u0020\u0066\u006f\u006e\u0074\u003d\u0025\u0071\u0020\u0025\u0054",_afgb ,_cebea ,_aedaf .FontName );
|
||
};}else {_aa .Log .Trace ("\u0049\u006ec\u006f\u006d\u0070\u0061\u0074i\u0062\u0069\u006c\u0069\u0074y\u003a\u0020\u0054\u0079\u0070\u0065\u0020\u0028\u0052\u0065\u0071\u0075\u0069\u0072\u0065\u0064\u0029\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u002e\u0020\u0066\u006f\u006e\u0074\u003d\u0025\u0071\u0020\u0025\u0054",_cebea ,_aedaf .FontName );
|
||
};_aedaf .FontFamily =_deece .Get ("\u0046\u006f\u006e\u0074\u0046\u0061\u006d\u0069\u006c\u0079");_aedaf .FontStretch =_deece .Get ("F\u006f\u006e\u0074\u0053\u0074\u0072\u0065\u0074\u0063\u0068");_aedaf .FontWeight =_deece .Get ("\u0046\u006f\u006e\u0074\u0057\u0065\u0069\u0067\u0068\u0074");
|
||
_aedaf .Flags =_deece .Get ("\u0046\u006c\u0061g\u0073");_aedaf .FontBBox =_deece .Get ("\u0046\u006f\u006e\u0074\u0042\u0042\u006f\u0078");_aedaf .ItalicAngle =_deece .Get ("I\u0074\u0061\u006c\u0069\u0063\u0041\u006e\u0067\u006c\u0065");_aedaf .Ascent =_deece .Get ("\u0041\u0073\u0063\u0065\u006e\u0074");
|
||
_aedaf .Descent =_deece .Get ("\u0044e\u0073\u0063\u0065\u006e\u0074");_aedaf .Leading =_deece .Get ("\u004ce\u0061\u0064\u0069\u006e\u0067");_aedaf .CapHeight =_deece .Get ("\u0043a\u0070\u0048\u0065\u0069\u0067\u0068t");_aedaf .XHeight =_deece .Get ("\u0058H\u0065\u0069\u0067\u0068\u0074");
|
||
_aedaf .StemV =_deece .Get ("\u0053\u0074\u0065m\u0056");_aedaf .StemH =_deece .Get ("\u0053\u0074\u0065m\u0048");_aedaf .AvgWidth =_deece .Get ("\u0041\u0076\u0067\u0057\u0069\u0064\u0074\u0068");_aedaf .MaxWidth =_deece .Get ("\u004d\u0061\u0078\u0057\u0069\u0064\u0074\u0068");
|
||
_aedaf .MissingWidth =_deece .Get ("\u004d\u0069\u0073s\u0069\u006e\u0067\u0057\u0069\u0064\u0074\u0068");_aedaf .FontFile =_deece .Get ("\u0046\u006f\u006e\u0074\u0046\u0069\u006c\u0065");_aedaf .FontFile2 =_deece .Get ("\u0046o\u006e\u0074\u0046\u0069\u006c\u00652");
|
||
_aedaf .FontFile3 =_deece .Get ("\u0046o\u006e\u0074\u0046\u0069\u006c\u00653");_aedaf .CharSet =_deece .Get ("\u0043h\u0061\u0072\u0053\u0065\u0074");_aedaf .Style =_deece .Get ("\u0053\u0074\u0079l\u0065");_aedaf .Lang =_deece .Get ("\u004c\u0061\u006e\u0067");
|
||
_aedaf .FD =_deece .Get ("\u0046\u0044");_aedaf .CIDSet =_deece .Get ("\u0043\u0049\u0044\u0053\u0065\u0074");if _aedaf .Flags !=nil {if _dede ,_cccb :=_fg .GetIntVal (_aedaf .Flags );_cccb {_aedaf ._gbeff =_dede ;};};if _aedaf .MissingWidth !=nil {if _gacc ,_fbbdb :=_fg .GetNumberAsFloat (_aedaf .MissingWidth );
|
||
_fbbdb ==nil {_aedaf ._gbbgb =_gacc ;};};if _aedaf .FontFile !=nil {_gfaa ,_fcfe :=_badbc (_aedaf .FontFile );if _fcfe !=nil {return _aedaf ,_fcfe ;};_aa .Log .Trace ("f\u006f\u006e\u0074\u0046\u0069\u006c\u0065\u003d\u0025\u0073",_gfaa );_aedaf .fontFile =_gfaa ;
|
||
};if _aedaf .FontFile2 !=nil {_bcdeb ,_ecdbf :=_eed .NewFontFile2FromPdfObject (_aedaf .FontFile2 );if _ecdbf !=nil {return _aedaf ,_ecdbf ;};_aa .Log .Trace ("\u0066\u006f\u006et\u0046\u0069\u006c\u0065\u0032\u003d\u0025\u0073",_bcdeb .String ());_aedaf ._bbbd =&_bcdeb ;
|
||
};return _aedaf ,nil ;};func (_fdedc *LTV )enable (_ebfdd ,_bebdg []*_ge .Certificate ,_fecd string )error {_eccbf ,_abcc ,_cbbbc :=_fdedc .buildCertChain (_ebfdd ,_bebdg );if _cbbbc !=nil {return _cbbbc ;};_fdeb ,_cbbbc :=_fdedc .getCerts (_eccbf );if _cbbbc !=nil {return _cbbbc ;
|
||
};var _bdeb ,_fdfe [][]byte ;if _fdedc .OCSPClient !=nil {_bdeb ,_cbbbc =_fdedc .getOCSPs (_eccbf ,_abcc );if _cbbbc !=nil {return _cbbbc ;};};if _fdedc .CRLClient !=nil {_fdfe ,_cbbbc =_fdedc .getCRLs (_eccbf );if _cbbbc !=nil {return _cbbbc ;};};_acdf :=_fdedc ._ebbe ;
|
||
_acbcc ,_cbbbc :=_acdf .AddCerts (_fdeb );if _cbbbc !=nil {return _cbbbc ;};_dceb ,_cbbbc :=_acdf .AddOCSPs (_bdeb );if _cbbbc !=nil {return _cbbbc ;};_dadgf ,_cbbbc :=_acdf .AddCRLs (_fdfe );if _cbbbc !=nil {return _cbbbc ;};if _fecd !=""{_acdf .VRI [_fecd ]=&VRI {Cert :_acbcc ,OCSP :_dceb ,CRL :_dadgf };
|
||
};_fdedc ._edgba .SetDSS (_acdf );return nil ;};func (_daefg *PdfWriter )flushWriter ()error {if _daefg ._adgac ==nil {_daefg ._adgac =_daefg ._dbdde .Flush ();};return _daefg ._adgac ;};
|
||
|
||
// SetPdfModifiedDate sets the ModDate attribute of the output PDF.
|
||
func SetPdfModifiedDate (modifiedDate _g .Time ){_baacg .Lock ();defer _baacg .Unlock ();_fbefe =modifiedDate ;};
|
||
|
||
// PdfActionGoTo3DView represents a GoTo3DView action.
|
||
type PdfActionGoTo3DView struct{*PdfAction ;TA _fg .PdfObject ;V _fg .PdfObject ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_cfcca *PdfAnnotationWidget )ToPdfObject ()_fg .PdfObject {_cfcca .PdfAnnotation .ToPdfObject ();_cfdd :=_cfcca ._agb ;_acfee :=_cfdd .PdfObject .(*_fg .PdfObjectDictionary );if _cfcca ._db {return _cfdd ;};_cfcca ._db =true ;_acfee .SetIfNotNil ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u0057\u0069\u0064\u0067\u0065\u0074"));
|
||
_acfee .SetIfNotNil ("\u0048",_cfcca .H );_acfee .SetIfNotNil ("\u004d\u004b",_cfcca .MK );_acfee .SetIfNotNil ("\u0041",_cfcca .A );_acfee .SetIfNotNil ("\u0041\u0041",_cfcca .AA );_acfee .SetIfNotNil ("\u0042\u0053",_cfcca .BS );_dabf :=_cfcca .Parent ;
|
||
if _cfcca ._ddcc !=nil {if _cfcca ._ddcc ._daecc ==_cfcca ._agb {_cfcca ._ddcc .ToPdfObject ();};_dabf =_cfcca ._ddcc .GetContainingPdfObject ();};if _dabf !=_cfdd {_acfee .SetIfNotNil ("\u0050\u0061\u0072\u0065\u006e\u0074",_dabf );};_cfcca ._db =false ;
|
||
return _cfdd ;};func (_aeaea *PdfWriter )writeOutputIntents ()error {if len (_aeaea ._adgga )==0{return nil ;};_fcbcd :=make ([]_fg .PdfObject ,len (_aeaea ._adgga ));for _bccac ,_gfcaf :=range _aeaea ._adgga {_bfgc :=_gfcaf .ToPdfObject ();_fcbcd [_bccac ]=_fg .MakeIndirectObject (_bfgc );
|
||
};_begef :=_fg .MakeIndirectObject (_fg .MakeArray (_fcbcd ...));_aeaea ._cgacf .Set ("\u004f\u0075\u0074\u0070\u0075\u0074\u0049\u006e\u0074\u0065\u006e\u0074\u0073",_begef );if _cffad :=_aeaea .addObjects (_begef );_cffad !=nil {return _cffad ;};return nil ;
|
||
};func (_cccaa *PdfWriter )writeString (_cdgea string ){if _cccaa ._adgac !=nil {return ;};_dcdegb ,_dcagc :=_cccaa ._dbdde .WriteString (_cdgea );_cccaa ._fcgga +=int64 (_dcdegb );_cccaa ._adgac =_dcagc ;};func (_ecca *PdfReader )newPdfActionMovieFromDict (_gbcd *_fg .PdfObjectDictionary )(*PdfActionMovie ,error ){return &PdfActionMovie {Annotation :_gbcd .Get ("\u0041\u006e\u006e\u006f\u0074\u0061\u0074\u0069\u006f\u006e"),T :_gbcd .Get ("\u0054"),Operation :_gbcd .Get ("\u004fp\u0065\u0072\u0061\u0074\u0069\u006fn")},nil ;
|
||
};
|
||
|
||
// AddExtGState add External Graphics State (GState). The gsDict can be specified
|
||
// either directly as a dictionary or an indirect object containing a dictionary.
|
||
func (_ddgde *PdfPageResources )AddExtGState (gsName _fg .PdfObjectName ,gsDict _fg .PdfObject )error {if _ddgde .ExtGState ==nil {_ddgde .ExtGState =_fg .MakeDict ();};_gbagbc :=_ddgde .ExtGState ;_fbegd ,_abecg :=_fg .TraceToDirectObject (_gbagbc ).(*_fg .PdfObjectDictionary );
|
||
if !_abecg {_aa .Log .Debug ("\u0045\u0078\u0074\u0047\u0053\u0074\u0061\u0074\u0065\u0020\u0074\u0079\u0070\u0065\u0020e\u0072r\u006f\u0072\u0020\u0028\u0067\u006f\u0074\u0020\u0025\u0054\u002f\u0025\u0054\u0029",_gbagbc ,_fg .TraceToDirectObject (_gbagbc ));
|
||
return _fg .ErrTypeError ;};_fbegd .Set (gsName ,gsDict );return nil ;};
|
||
|
||
// SetFontByName sets the font specified by keyName to the given object.
|
||
func (_acfgd *PdfPageResources )SetFontByName (keyName _fg .PdfObjectName ,obj _fg .PdfObject )error {if _acfgd .Font ==nil {_acfgd .Font =_fg .MakeDict ();};_cbgba ,_feafd :=_fg .TraceToDirectObject (_acfgd .Font ).(*_fg .PdfObjectDictionary );if !_feafd {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0046\u006f\u006e\u0074\u0020\u006e\u006f\u0074\u0020\u0061\u0020\u0064\u0069\u0063\u0074\u0069\u006fn\u0061\u0072\u0079\u0021\u0020(\u0067\u006ft\u0020\u0025\u0054\u0029",_fg .TraceToDirectObject (_acfgd .Font ));
|
||
return _fg .ErrTypeError ;};_cbgba .Set (keyName ,obj );return nil ;};
|
||
|
||
// ToPdfObject converts the PdfFont object to its PDF representation.
|
||
func (_agdg *PdfFont )ToPdfObject ()_fg .PdfObject {if _agdg ._gcaeff ==nil {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0066\u006f\u006e\u0074 \u0063\u006f\u006e\u0074\u0065\u0078\u0074\u0020\u0069\u0073 \u006e\u0069\u006c");return _fg .MakeNull ();
|
||
};return _agdg ._gcaeff .ToPdfObject ();};
|
||
|
||
// NewPdfActionThread returns a new "thread" action.
|
||
func NewPdfActionThread ()*PdfActionThread {_gg :=NewPdfAction ();_edd :=&PdfActionThread {};_edd .PdfAction =_gg ;_gg .SetContext (_edd );return _edd ;};
|
||
|
||
// PdfColorspaceDeviceGray represents a grayscale colorspace.
|
||
type PdfColorspaceDeviceGray struct{};func (_fgg *PdfReader )newPdfAnnotationSquigglyFromDict (_eegc *_fg .PdfObjectDictionary )(*PdfAnnotationSquiggly ,error ){_ddbd :=PdfAnnotationSquiggly {};_fdde ,_bebe :=_fgg .newPdfAnnotationMarkupFromDict (_eegc );
|
||
if _bebe !=nil {return nil ,_bebe ;};_ddbd .PdfAnnotationMarkup =_fdde ;_ddbd .QuadPoints =_eegc .Get ("\u0051\u0075\u0061\u0064\u0050\u006f\u0069\u006e\u0074\u0073");return &_ddbd ,nil ;};
|
||
|
||
// NewXObjectForm creates a brand new XObject Form. Creates a new underlying PDF object stream primitive.
|
||
func NewXObjectForm ()*XObjectForm {_geeae :=&XObjectForm {};_bfbgf :=&_fg .PdfObjectStream {};_bfbgf .PdfObjectDictionary =_fg .MakeDict ();_geeae ._bdage =_bfbgf ;return _geeae ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_agbd *PdfAnnotationWatermark )ToPdfObject ()_fg .PdfObject {_agbd .PdfAnnotation .ToPdfObject ();_dccc :=_agbd ._agb ;_afge :=_dccc .PdfObject .(*_fg .PdfObjectDictionary );_afge .SetIfNotNil ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u0057a\u0074\u0065\u0072\u006d\u0061\u0072k"));
|
||
_afge .SetIfNotNil ("\u0046\u0069\u0078\u0065\u0064\u0050\u0072\u0069\u006e\u0074",_agbd .FixedPrint );return _dccc ;};
|
||
|
||
// NewPdfFontFromPdfObject loads a PdfFont from the dictionary `fontObj`. If there is a problem an
|
||
// error is returned.
|
||
func NewPdfFontFromPdfObject (fontObj _fg .PdfObject )(*PdfFont ,error ){return _bfab (fontObj ,true )};func (_adbda *PdfWriter )addObjects (_dfgf _fg .PdfObject )error {_aa .Log .Trace ("\u0041d\u0064i\u006e\u0067\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u0073\u0021");
|
||
if _deabef ,_fbbcb :=_dfgf .(*_fg .PdfIndirectObject );_fbbcb {_aa .Log .Trace ("\u0049\u006e\u0064\u0069\u0072\u0065\u0063\u0074");_aa .Log .Trace ("\u002d \u0025\u0073\u0020\u0028\u0025\u0070)",_dfgf ,_deabef );_aa .Log .Trace ("\u002d\u0020\u0025\u0073",_deabef .PdfObject );
|
||
if _adbda .addObject (_deabef ){_acgeec :=_adbda .addObjects (_deabef .PdfObject );if _acgeec !=nil {return _acgeec ;};};return nil ;};if _gbcae ,_ffffe :=_dfgf .(*_fg .PdfObjectStream );_ffffe {_aa .Log .Trace ("\u0053\u0074\u0072\u0065\u0061\u006d");
|
||
_aa .Log .Trace ("\u002d \u0025\u0073\u0020\u0025\u0070",_dfgf ,_dfgf );if _adbda .addObject (_gbcae ){_bfdeg :=_adbda .addObjects (_gbcae .PdfObjectDictionary );if _bfdeg !=nil {return _bfdeg ;};};return nil ;};if _bbcdga ,_cfbgdg :=_dfgf .(*_fg .PdfObjectDictionary );
|
||
_cfbgdg {_aa .Log .Trace ("\u0044\u0069\u0063\u0074");_aa .Log .Trace ("\u002d\u0020\u0025\u0073",_dfgf );for _ ,_ageaf :=range _bbcdga .Keys (){_efgfe :=_bbcdga .Get (_ageaf );if _cbfcg ,_acaea :=_efgfe .(*_fg .PdfObjectReference );_acaea {_efgfe =_cbfcg .Resolve ();
|
||
_bbcdga .Set (_ageaf ,_efgfe );};if _ageaf !="\u0050\u0061\u0072\u0065\u006e\u0074"{if _fdgba :=_adbda .addObjects (_efgfe );_fdgba !=nil {return _fdgba ;};}else {if _ ,_gegda :=_efgfe .(*_fg .PdfObjectNull );_gegda {continue ;};if _fabce :=_adbda .hasObject (_efgfe );
|
||
!_fabce {_aa .Log .Debug ("P\u0061\u0072\u0065\u006e\u0074\u0020o\u0062\u006a\u0020\u006e\u006f\u0074 \u0061\u0064\u0064\u0065\u0064\u0020\u0079e\u0074\u0021\u0021\u0020\u0025\u0054\u0020\u0025\u0070\u0020%\u0076",_efgfe ,_efgfe ,_efgfe );_adbda ._gcafd [_efgfe ]=append (_adbda ._gcafd [_efgfe ],_bbcdga );
|
||
};};};return nil ;};if _gfabaf ,_faafg :=_dfgf .(*_fg .PdfObjectArray );_faafg {_aa .Log .Trace ("\u0041\u0072\u0072a\u0079");_aa .Log .Trace ("\u002d\u0020\u0025\u0073",_dfgf );if _gfabaf ==nil {return _ce .New ("\u0061\u0072\u0072a\u0079\u0020\u0069\u0073\u0020\u006e\u0069\u006c");
|
||
};for _ebef ,_cfdde :=range _gfabaf .Elements (){if _dedea ,_gbdbbd :=_cfdde .(*_fg .PdfObjectReference );_gbdbbd {_cfdde =_dedea .Resolve ();_gfabaf .Set (_ebef ,_cfdde );};if _deacfb :=_adbda .addObjects (_cfdde );_deacfb !=nil {return _deacfb ;};};return nil ;
|
||
};if _ ,_eddga :=_dfgf .(*_fg .PdfObjectReference );_eddga {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0043\u0061\u006e\u006e\u006f\u0074 \u0062\u0065\u0020\u0061\u0020\u0072e\u0066\u0065\u0072\u0065\u006e\u0063\u0065\u0020\u002d\u0020\u0067\u006f\u0074 \u0025\u0023\u0076\u0021",_dfgf );
|
||
return _ce .New ("r\u0065\u0066\u0065\u0072en\u0063e\u0020\u006e\u006f\u0074\u0020a\u006c\u006c\u006f\u0077\u0065\u0064");};return nil ;};
|
||
|
||
// NewPdfAnnotationUnderline returns a new text underline annotation.
|
||
func NewPdfAnnotationUnderline ()*PdfAnnotationUnderline {_egaf :=NewPdfAnnotation ();_dee :=&PdfAnnotationUnderline {};_dee .PdfAnnotation =_egaf ;_dee .PdfAnnotationMarkup =&PdfAnnotationMarkup {};_egaf .SetContext (_dee );return _dee ;};func (_afcc *pdfFontSimple )getFontEncoding ()(_abec string ,_eefc map[_dg .CharCode ]_dg .GlyphName ,_fgccg error ){_abec ="\u0053\u0074a\u006e\u0064\u0061r\u0064\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067";
|
||
if _gcgca ,_fbeb :=_aeagc [_afcc ._aefg ];_fbeb {_abec =_gcgca ;}else if _afcc .fontFlags ()&_dbbc !=0{for _dadag ,_bdgde :=range _aeagc {if _dc .Contains (_afcc ._aefg ,_dadag ){_abec =_bdgde ;break ;};};};if _afcc .Encoding ==nil {return _abec ,nil ,nil ;
|
||
};switch _gabbb :=_afcc .Encoding .(type ){case *_fg .PdfObjectName :return string (*_gabbb ),nil ,nil ;case *_fg .PdfObjectDictionary :_befab ,_aecg :=_fg .GetName (_gabbb .Get ("\u0042\u0061\u0073e\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067"));if _aecg {_abec =_befab .String ();
|
||
};if _ccfc :=_gabbb .Get ("D\u0069\u0066\u0066\u0065\u0072\u0065\u006e\u0063\u0065\u0073");_ccfc !=nil {_cbcea ,_ecbd :=_fg .GetArray (_ccfc );if !_ecbd {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0042a\u0064\u0020\u0066on\u0074\u0020\u0065\u006e\u0063\u006fd\u0069\u006e\u0067\u0020\u0064\u0069\u0063\u0074\u003d\u0025\u002b\u0076\u0020\u0044\u0069f\u0066\u0065\u0072\u0065\u006e\u0063\u0065\u0073=\u0025\u0054",_gabbb ,_gabbb .Get ("D\u0069\u0066\u0066\u0065\u0072\u0065\u006e\u0063\u0065\u0073"));
|
||
return "",nil ,_fg .ErrTypeError ;};_eefc ,_fgccg =_dg .FromFontDifferences (_cbcea );};return _abec ,_eefc ,_fgccg ;default:_aa .Log .Debug ("\u0045\u0052\u0052O\u0052\u003a\u0020\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067\u0020\u006e\u006f\u0074\u0020\u0061\u0020\u006e\u0061\u006d\u0065\u0020\u006f\u0072\u0020\u0064\u0069\u0063t\u0020\u0028\u0025\u0054\u0029\u0020\u0025\u0073",_afcc .Encoding ,_afcc .Encoding );
|
||
return "",nil ,_fg .ErrTypeError ;};};func (_gbdbb *PdfFont )baseFields ()*fontCommon {if _gbdbb ._gcaeff ==nil {_aa .Log .Debug ("\u0045\u0052\u0052OR\u003a\u0020\u0062\u0061\u0073\u0065\u0046\u0069\u0065l\u0064s\u002e \u0063o\u006e\u0074\u0065\u0078\u0074\u0020\u0069\u0073\u0020\u006e\u0069\u006c\u002e");
|
||
return nil ;};return _gbdbb ._gcaeff .baseFields ();};
|
||
|
||
// NewXObjectImageFromStream builds the image xobject from a stream object.
|
||
// An image dictionary is the dictionary portion of a stream object representing an image XObject.
|
||
func NewXObjectImageFromStream (stream *_fg .PdfObjectStream )(*XObjectImage ,error ){_debdec :=&XObjectImage {};_debdec ._eafbc =stream ;_ddcfg :=*(stream .PdfObjectDictionary );_baea ,_gffbd :=_fg .NewEncoderFromStream (stream );if _gffbd !=nil {return nil ,_gffbd ;
|
||
};_debdec .Filter =_baea ;if _eedbe :=_fg .TraceToDirectObject (_ddcfg .Get ("\u0057\u0069\u0064t\u0068"));_eedbe !=nil {_beda ,_bbdd :=_eedbe .(*_fg .PdfObjectInteger );if !_bbdd {return nil ,_ce .New ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0069\u006d\u0061g\u0065\u0020\u0077\u0069\u0064\u0074\u0068\u0020\u006f\u0062j\u0065\u0063\u0074");
|
||
};_egea :=int64 (*_beda );_debdec .Width =&_egea ;}else {return nil ,_ce .New ("\u0077\u0069\u0064\u0074\u0068\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067");};if _daefa :=_fg .TraceToDirectObject (_ddcfg .Get ("\u0048\u0065\u0069\u0067\u0068\u0074"));
|
||
_daefa !=nil {_fbebg ,_afag :=_daefa .(*_fg .PdfObjectInteger );if !_afag {return nil ,_ce .New ("i\u006e\u0076\u0061\u006c\u0069\u0064 \u0069\u006d\u0061\u0067\u0065\u0020\u0068\u0065\u0069g\u0068\u0074\u0020o\u0062j\u0065\u0063\u0074");};_acece :=int64 (*_fbebg );
|
||
_debdec .Height =&_acece ;}else {return nil ,_ce .New ("\u0068\u0065\u0069\u0067\u0068\u0074\u0020\u006d\u0069s\u0073\u0069\u006e\u0067");};if _afdbe :=_fg .TraceToDirectObject (_ddcfg .Get ("\u0043\u006f\u006c\u006f\u0072\u0053\u0070\u0061\u0063\u0065"));
|
||
_afdbe !=nil {_eefdb ,_aabde :=NewPdfColorspaceFromPdfObject (_afdbe );if _aabde !=nil {return nil ,_aabde ;};_debdec .ColorSpace =_eefdb ;}else {_aa .Log .Debug ("\u0058O\u0062\u006a\u0065c\u0074\u0020\u0049m\u0061ge\u0020\u0063\u006f\u006c\u006f\u0072\u0073p\u0061\u0063\u0065\u0020\u006e\u006f\u0074\u0020\u0073\u0070\u0065\u0063\u0069\u0066\u0069\u0065\u0064\u0020\u002d\u0020\u0061\u0073\u0073\u0075\u006d\u0069\u006e\u0067 1\u0020c\u006f\u006c\u006f\u0072\u0020\u0063o\u006d\u0070\u006f\u006e\u0065n\u0074\u0020\u002d\u0020\u0044\u0065\u0076\u0069\u0063\u0065\u0047r\u0061\u0079");
|
||
_debdec .ColorSpace =NewPdfColorspaceDeviceGray ();};if _dccacb :=_fg .TraceToDirectObject (_ddcfg .Get ("\u0042\u0069t\u0073\u0050\u0065r\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074"));_dccacb !=nil {_agfgc ,_gcbcb :=_dccacb .(*_fg .PdfObjectInteger );
|
||
if !_gcbcb {return nil ,_ce .New ("i\u006e\u0076\u0061\u006c\u0069\u0064 \u0069\u006d\u0061\u0067\u0065\u0020\u0068\u0065\u0069g\u0068\u0074\u0020o\u0062j\u0065\u0063\u0074");};_fffbc :=int64 (*_agfgc );_debdec .BitsPerComponent =&_fffbc ;};_debdec .Intent =_ddcfg .Get ("\u0049\u006e\u0074\u0065\u006e\u0074");
|
||
_debdec .ImageMask =_ddcfg .Get ("\u0049m\u0061\u0067\u0065\u004d\u0061\u0073k");_debdec .Mask =_ddcfg .Get ("\u004d\u0061\u0073\u006b");_debdec .Decode =_ddcfg .Get ("\u0044\u0065\u0063\u006f\u0064\u0065");_debdec .Interpolate =_ddcfg .Get ("I\u006e\u0074\u0065\u0072\u0070\u006f\u006c\u0061\u0074\u0065");
|
||
_debdec .Alternatives =_ddcfg .Get ("\u0041\u006c\u0074e\u0072\u006e\u0061\u0074\u0069\u0076\u0065\u0073");_debdec .SMask =_ddcfg .Get ("\u0053\u004d\u0061s\u006b");_debdec .SMaskInData =_ddcfg .Get ("S\u004d\u0061\u0073\u006b\u0049\u006e\u0044\u0061\u0074\u0061");
|
||
_debdec .Matte =_ddcfg .Get ("\u004d\u0061\u0074t\u0065");_debdec .Name =_ddcfg .Get ("\u004e\u0061\u006d\u0065");_debdec .StructParent =_ddcfg .Get ("\u0053\u0074\u0072u\u0063\u0074\u0050\u0061\u0072\u0065\u006e\u0074");_debdec .ID =_ddcfg .Get ("\u0049\u0044");
|
||
_debdec .OPI =_ddcfg .Get ("\u004f\u0050\u0049");_debdec .Metadata =_ddcfg .Get ("\u004d\u0065\u0074\u0061\u0064\u0061\u0074\u0061");_debdec .OC =_ddcfg .Get ("\u004f\u0043");_debdec .Stream =stream .Stream ;return _debdec ,nil ;};func (_bdag *PdfReader )newPdfFieldSignatureFromDict (_fcfgd *_fg .PdfObjectDictionary )(*PdfFieldSignature ,error ){_efcb :=&PdfFieldSignature {};
|
||
_eecd ,_gfdgf :=_fg .GetIndirect (_fcfgd .Get ("\u0056"));if _gfdgf {var _gbab error ;_efcb .V ,_gbab =_bdag .newPdfSignatureFromIndirect (_eecd );if _gbab !=nil {return nil ,_gbab ;};};_efcb .Lock ,_ =_fg .GetIndirect (_fcfgd .Get ("\u004c\u006f\u0063\u006b"));
|
||
_efcb .SV ,_ =_fg .GetIndirect (_fcfgd .Get ("\u0053\u0056"));return _efcb ,nil ;};
|
||
|
||
// ToPdfObject returns the PDF representation of the shading dictionary.
|
||
func (_baedf *PdfShadingType7 )ToPdfObject ()_fg .PdfObject {_baedf .PdfShading .ToPdfObject ();_baag ,_bcdea :=_baedf .getShadingDict ();if _bcdea !=nil {_aa .Log .Error ("\u0055\u006ea\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0061\u0063\u0063\u0065\u0073\u0073\u0020\u0073\u0068\u0061\u0064\u0069\u006e\u0067\u0020di\u0063\u0074");
|
||
return nil ;};if _baedf .BitsPerCoordinate !=nil {_baag .Set ("\u0042\u0069\u0074\u0073\u0050\u0065\u0072\u0043\u006f\u006f\u0072\u0064i\u006e\u0061\u0074\u0065",_baedf .BitsPerCoordinate );};if _baedf .BitsPerComponent !=nil {_baag .Set ("\u0042\u0069t\u0073\u0050\u0065r\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074",_baedf .BitsPerComponent );
|
||
};if _baedf .BitsPerFlag !=nil {_baag .Set ("B\u0069\u0074\u0073\u0050\u0065\u0072\u0046\u006c\u0061\u0067",_baedf .BitsPerFlag );};if _baedf .Decode !=nil {_baag .Set ("\u0044\u0065\u0063\u006f\u0064\u0065",_baedf .Decode );};if _baedf .Function !=nil {if len (_baedf .Function )==1{_baag .Set ("\u0046\u0075\u006e\u0063\u0074\u0069\u006f\u006e",_baedf .Function [0].ToPdfObject ());
|
||
}else {_bdcf :=_fg .MakeArray ();for _ ,_fefac :=range _baedf .Function {_bdcf .Append (_fefac .ToPdfObject ());};_baag .Set ("\u0046\u0075\u006e\u0063\u0074\u0069\u006f\u006e",_bdcf );};};return _baedf ._cbabf ;};
|
||
|
||
// NewPdfAnnotationStamp returns a new stamp annotation.
|
||
func NewPdfAnnotationStamp ()*PdfAnnotationStamp {_bade :=NewPdfAnnotation ();_gef :=&PdfAnnotationStamp {};_gef .PdfAnnotation =_bade ;_gef .PdfAnnotationMarkup =&PdfAnnotationMarkup {};_bade .SetContext (_gef );return _gef ;};
|
||
|
||
// GetNamedDestinations returns the Dests entry in the PDF catalog.
|
||
// See section 12.3.2.3 "Named Destinations" (p. 367 PDF32000_2008).
|
||
func (_fbbc *PdfReader )GetNamedDestinations ()(_fg .PdfObject ,error ){_egbge :=_fg .ResolveReference (_fbbc ._cgegd .Get ("\u0044\u0065\u0073t\u0073"));if _egbge ==nil {return nil ,nil ;};if !_fbbc ._beegg {_afggbd :=_fbbc .traverseObjectData (_egbge );
|
||
if _afggbd !=nil {return nil ,_afggbd ;};};return _egbge ,nil ;};func (_acabe *PdfColorspaceDeviceCMYK )String ()string {return "\u0044\u0065\u0076\u0069\u0063\u0065\u0043\u004d\u0059\u004b";};
|
||
|
||
// Set sets the colorspace corresponding to key. Add to Names if not set.
|
||
func (_aeceg *PdfPageResourcesColorspaces )Set (key _fg .PdfObjectName ,val PdfColorspace ){if _ ,_fgfda :=_aeceg .Colorspaces [string (key )];!_fgfda {_aeceg .Names =append (_aeceg .Names ,string (key ));};_aeceg .Colorspaces [string (key )]=val ;};
|
||
|
||
// PdfColorspaceDeviceN represents a DeviceN color space. DeviceN color spaces are similar to Separation color
|
||
// spaces, except they can contain an arbitrary number of color components.
|
||
/*
|
||
Format: [/DeviceN names alternateSpace tintTransform]
|
||
or: [/DeviceN names alternateSpace tintTransform attributes]
|
||
*/
|
||
type PdfColorspaceDeviceN struct{ColorantNames *_fg .PdfObjectArray ;AlternateSpace PdfColorspace ;TintTransform PdfFunction ;Attributes *PdfColorspaceDeviceNAttributes ;_cggda *_fg .PdfIndirectObject ;};
|
||
|
||
// ColorToRGB converts an Indexed color to an RGB color.
|
||
func (_aeeb *PdfColorspaceSpecialIndexed )ColorToRGB (color PdfColor )(PdfColor ,error ){if _aeeb .Base ==nil {return nil ,_ce .New ("\u0069\u006e\u0064\u0065\u0078\u0065d\u0020\u0062\u0061\u0073\u0065\u0020\u0063\u006f\u006c\u006f\u0072\u0073\u0070a\u0063\u0065\u0020\u0075\u006e\u0064\u0065f\u0069\u006e\u0065\u0064");
|
||
};return _aeeb .Base .ColorToRGB (color );};
|
||
|
||
// SetOptimizer sets the optimizer to optimize PDF before writing.
|
||
func (_eebdcc *PdfWriter )SetOptimizer (optimizer Optimizer ){_eebdcc ._fdgfe =optimizer };
|
||
|
||
// PdfColorspace interface defines the common methods of a PDF colorspace.
|
||
// The colorspace defines the data storage format for each color and color representation.
|
||
//
|
||
// Device based colorspace, specified by name
|
||
// - /DeviceGray
|
||
// - /DeviceRGB
|
||
// - /DeviceCMYK
|
||
//
|
||
// CIE based colorspace specified by [name, dictionary]
|
||
// - [/CalGray dict]
|
||
// - [/CalRGB dict]
|
||
// - [/Lab dict]
|
||
// - [/ICCBased dict]
|
||
//
|
||
// Special colorspaces
|
||
// - /Pattern
|
||
// - /Indexed
|
||
// - /Separation
|
||
// - /DeviceN
|
||
//
|
||
// Work is in progress to support all colorspaces. At the moment ICCBased color spaces fall back to the alternate
|
||
// colorspace which works OK in most cases. For full color support, will need fully featured ICC support.
|
||
type PdfColorspace interface{
|
||
|
||
// String returns the PdfColorspace's name.
|
||
String ()string ;
|
||
|
||
// ImageToRGB converts an Image in a given PdfColorspace to an RGB image.
|
||
ImageToRGB (Image )(Image ,error );
|
||
|
||
// ColorToRGB converts a single color in a given PdfColorspace to an RGB color.
|
||
ColorToRGB (_ecdb PdfColor )(PdfColor ,error );
|
||
|
||
// GetNumComponents returns the number of components in the PdfColorspace.
|
||
GetNumComponents ()int ;
|
||
|
||
// ToPdfObject returns a PdfObject representation of the PdfColorspace.
|
||
ToPdfObject ()_fg .PdfObject ;
|
||
|
||
// ColorFromPdfObjects returns a PdfColor in the given PdfColorspace from an array of PdfObject where each
|
||
// PdfObject represents a numeric value.
|
||
ColorFromPdfObjects (_cafb []_fg .PdfObject )(PdfColor ,error );
|
||
|
||
// ColorFromFloats returns a new PdfColor based on input color components for a given PdfColorspace.
|
||
ColorFromFloats (_eabf []float64 )(PdfColor ,error );
|
||
|
||
// DecodeArray returns the Decode array for the PdfColorSpace, i.e. the range of each component.
|
||
DecodeArray ()[]float64 ;};
|
||
|
||
// PdfAnnotation3D represents 3D annotations.
|
||
// (Section 13.6.2).
|
||
type PdfAnnotation3D struct{*PdfAnnotation ;T3DD _fg .PdfObject ;T3DV _fg .PdfObject ;T3DA _fg .PdfObject ;T3DI _fg .PdfObject ;T3DB _fg .PdfObject ;};
|
||
|
||
// ParserMetadata gets the parser metadata.
|
||
func (_faed *CompliancePdfReader )ParserMetadata ()_fg .ParserMetadata {if _faed ._aefc ==(_fg .ParserMetadata {}){_faed ._aefc ,_ =_faed ._ccgg .ParserMetadata ();};return _faed ._aefc ;};func _ddd (_dccf _fg .PdfObject )(*PdfFilespec ,error ){if _dccf ==nil {return nil ,nil ;
|
||
};return NewPdfFilespecFromObj (_dccf );};
|
||
|
||
// StdFontName represents name of a standard font.
|
||
type StdFontName =_eed .StdFontName ;
|
||
|
||
// PdfFunctionType0 uses a sequence of sample values (contained in a stream) to provide an approximation
|
||
// for functions whose domains and ranges are bounded. The samples are organized as an m-dimensional
|
||
// table in which each entry has n components
|
||
type PdfFunctionType0 struct{Domain []float64 ;Range []float64 ;NumInputs int ;NumOutputs int ;Size []int ;BitsPerSample int ;Order int ;Encode []float64 ;Decode []float64 ;_cfed []byte ;_fccae []uint32 ;_ddgf *_fg .PdfObjectStream ;};
|
||
|
||
// PdfAnnotation represents an annotation in PDF (section 12.5 p. 389).
|
||
type PdfAnnotation struct{_cbea PdfModel ;Rect _fg .PdfObject ;Contents _fg .PdfObject ;P _fg .PdfObject ;NM _fg .PdfObject ;M _fg .PdfObject ;F _fg .PdfObject ;AP _fg .PdfObject ;AS _fg .PdfObject ;Border _fg .PdfObject ;C _fg .PdfObject ;StructParent _fg .PdfObject ;
|
||
OC _fg .PdfObject ;_agb *_fg .PdfIndirectObject ;};func (_bcde *PdfReader )newPdfAnnotationUnderlineFromDict (_ged *_fg .PdfObjectDictionary )(*PdfAnnotationUnderline ,error ){_fbf :=PdfAnnotationUnderline {};_bcg ,_abdbd :=_bcde .newPdfAnnotationMarkupFromDict (_ged );
|
||
if _abdbd !=nil {return nil ,_abdbd ;};_fbf .PdfAnnotationMarkup =_bcg ;_fbf .QuadPoints =_ged .Get ("\u0051\u0075\u0061\u0064\u0050\u006f\u0069\u006e\u0074\u0073");return &_fbf ,nil ;};
|
||
|
||
// ValidateSignatures validates digital signatures in the document.
|
||
func (_cegdg *PdfReader )ValidateSignatures (handlers []SignatureHandler )([]SignatureValidationResult ,error ){if _cegdg .AcroForm ==nil {return nil ,nil ;};if _cegdg .AcroForm .Fields ==nil {return nil ,nil ;};type sigFieldPair struct{_gfca *PdfSignature ;
|
||
_dbfab *PdfField ;_dgdef SignatureHandler ;};var _eceff []*sigFieldPair ;for _ ,_affcc :=range _cegdg .AcroForm .AllFields (){if _affcc .V ==nil {continue ;};if _fcea ,_ggfce :=_fg .GetDict (_affcc .V );_ggfce {if _dfca ,_ggfaf :=_fg .GetNameVal (_fcea .Get ("\u0054\u0079\u0070\u0065"));
|
||
_ggfaf &&(_dfca =="\u0053\u0069\u0067"||_dfca =="\u0044\u006f\u0063T\u0069\u006d\u0065\u0053\u0074\u0061\u006d\u0070"){_fbdga ,_gafc :=_fg .GetIndirect (_affcc .V );if !_gafc {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a \u0053\u0069\u0067\u006e\u0061\u0074\u0075\u0072\u0065\u0020\u0063\u006f\u006et\u0061\u0069\u006e\u0065\u0072\u0020\u0069s\u0020\u006e\u0069\u006c");
|
||
return nil ,ErrTypeCheck ;};_ddae ,_gcfdg :=_cegdg .newPdfSignatureFromIndirect (_fbdga );if _gcfdg !=nil {return nil ,_gcfdg ;};var _acfeab SignatureHandler ;for _ ,_caabg :=range handlers {if _caabg .IsApplicable (_ddae ){_acfeab =_caabg ;break ;};};
|
||
_eceff =append (_eceff ,&sigFieldPair {_gfca :_ddae ,_dbfab :_affcc ,_dgdef :_acfeab });};};};var _bggcc []SignatureValidationResult ;for _ ,_abcd :=range _eceff {_adfbe :=SignatureValidationResult {IsSigned :true ,Fields :[]*PdfField {_abcd ._dbfab }};
|
||
if _abcd ._dgdef ==nil {_adfbe .Errors =append (_adfbe .Errors ,"\u0068a\u006ed\u006c\u0065\u0072\u0020\u006e\u006f\u0074\u0020\u0073\u0065\u0074");_bggcc =append (_bggcc ,_adfbe );continue ;};_dccca ,_dbcb :=_abcd ._dgdef .NewDigest (_abcd ._gfca );if _dbcb !=nil {_adfbe .Errors =append (_adfbe .Errors ,"\u0064\u0069\u0067e\u0073\u0074\u0020\u0065\u0072\u0072\u006f\u0072",_dbcb .Error ());
|
||
_bggcc =append (_bggcc ,_adfbe );continue ;};_gdeaf :=_abcd ._gfca .ByteRange ;if _gdeaf ==nil {_adfbe .Errors =append (_adfbe .Errors ,"\u0042\u0079\u0074\u0065\u0052\u0061\u006e\u0067\u0065\u0020\u006e\u006ft\u0020\u0073\u0065\u0074");_bggcc =append (_bggcc ,_adfbe );
|
||
continue ;};for _ebdbd :=0;_ebdbd < _gdeaf .Len ();_ebdbd =_ebdbd +2{_fcfdf ,_ :=_fg .GetNumberAsInt64 (_gdeaf .Get (_ebdbd ));_agcfc ,_ :=_fg .GetIntVal (_gdeaf .Get (_ebdbd +1));if _ ,_cgecb :=_cegdg ._daega .Seek (_fcfdf ,_ff .SeekStart );_cgecb !=nil {return nil ,_cgecb ;
|
||
};_bcbf :=make ([]byte ,_agcfc );if _ ,_cfddb :=_cegdg ._daega .Read (_bcbf );_cfddb !=nil {return nil ,_cfddb ;};_dccca .Write (_bcbf );};var _agdfb SignatureValidationResult ;if _cbgeg ,_fcbd :=_abcd ._dgdef .(SignatureHandlerDocMDP );_fcbd {_agdfb ,_dbcb =_cbgeg .ValidateWithOpts (_abcd ._gfca ,_dccca ,SignatureHandlerDocMDPParams {Parser :_cegdg ._ccgg });
|
||
}else {_agdfb ,_dbcb =_abcd ._dgdef .Validate (_abcd ._gfca ,_dccca );};if _dbcb !=nil {_aa .Log .Debug ("E\u0052\u0052\u004f\u0052: \u0025v\u0020\u0028\u0025\u0054\u0029 \u002d\u0020\u0073\u006b\u0069\u0070",_dbcb ,_abcd ._dgdef );_agdfb .Errors =append (_agdfb .Errors ,_dbcb .Error ());
|
||
};_agdfb .Name =_abcd ._gfca .Name .Decoded ();_agdfb .Reason =_abcd ._gfca .Reason .Decoded ();if _abcd ._gfca .M !=nil {_bdaed ,_bfdfee :=NewPdfDate (_abcd ._gfca .M .String ());if _bfdfee !=nil {_aa .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_bfdfee );
|
||
_agdfb .Errors =append (_agdfb .Errors ,_bfdfee .Error ());continue ;};_agdfb .Date =_bdaed ;};_agdfb .ContactInfo =_abcd ._gfca .ContactInfo .Decoded ();_agdfb .Location =_abcd ._gfca .Location .Decoded ();_agdfb .Fields =_adfbe .Fields ;_bggcc =append (_bggcc ,_agdfb );
|
||
};return _bggcc ,nil ;};
|
||
|
||
// CharcodesToUnicodeWithStats is identical to CharcodesToUnicode except it returns more statistical
|
||
// information about hits and misses from the reverse mapping process.
|
||
// NOTE: The number of runes returned may be greater than the number of charcodes.
|
||
// TODO(peterwilliams97): Deprecate in v4 and use only CharcodesToStrings()
|
||
func (_bbba *PdfFont )CharcodesToUnicodeWithStats (charcodes []_dg .CharCode )(_gcbcd []rune ,_decbc ,_bccc int ){_dgae ,_decbc ,_bccc :=_bbba .CharcodesToStrings (charcodes );return []rune (_dc .Join (_dgae ,"")),_decbc ,_bccc ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_bggb *PdfActionRendition )ToPdfObject ()_fg .PdfObject {_bggb .PdfAction .ToPdfObject ();_gbbb :=_bggb ._bda ;_feg :=_gbbb .PdfObject .(*_fg .PdfObjectDictionary );_feg .SetIfNotNil ("\u0053",_fg .MakeName (string (ActionTypeRendition )));_feg .SetIfNotNil ("\u0052",_bggb .R );
|
||
_feg .SetIfNotNil ("\u0041\u004e",_bggb .AN );_feg .SetIfNotNil ("\u004f\u0050",_bggb .OP );_feg .SetIfNotNil ("\u004a\u0053",_bggb .JS );return _gbbb ;};
|
||
|
||
// NewCompositePdfFontFromTTFFile loads a composite font from a TTF font file. Composite fonts can
|
||
// be used to represent unicode fonts which can have multi-byte character codes, representing a wide
|
||
// range of values. They are often used for symbolic languages, including Chinese, Japanese and Korean.
|
||
// It is represented by a Type0 Font with an underlying CIDFontType2 and an Identity-H encoding map.
|
||
// TODO: May be extended in the future to support a larger variety of CMaps and vertical fonts.
|
||
// NOTE: For simple fonts, use NewPdfFontFromTTFFile.
|
||
func NewCompositePdfFontFromTTFFile (filePath string )(*PdfFont ,error ){_gdgff ,_ebgff :=_c .Open (filePath );if _ebgff !=nil {_aa .Log .Debug ("\u0045\u0052\u0052OR\u003a\u0020\u006f\u0070\u0065\u006e\u0069\u006e\u0067\u0020\u0066\u0069\u006c\u0065\u003a\u0020\u0025\u0076",_ebgff );
|
||
return nil ,_ebgff ;};defer _gdgff .Close ();return NewCompositePdfFontFromTTF (_gdgff );};
|
||
|
||
// NewPdfColorspaceSpecialIndexed returns a new Indexed color.
|
||
func NewPdfColorspaceSpecialIndexed ()*PdfColorspaceSpecialIndexed {return &PdfColorspaceSpecialIndexed {HiVal :255};};
|
||
|
||
// ToPdfObject returns the PDF representation of the shading pattern.
|
||
func (_acedc *PdfShadingPatternType2 )ToPdfObject ()_fg .PdfObject {_acedc .PdfPattern .ToPdfObject ();_aefec :=_acedc .getDict ();if _acedc .Shading !=nil {_aefec .Set ("\u0053h\u0061\u0064\u0069\u006e\u0067",_acedc .Shading .ToPdfObject ());};if _acedc .Matrix !=nil {_aefec .Set ("\u004d\u0061\u0074\u0072\u0069\u0078",_acedc .Matrix );
|
||
};if _acedc .ExtGState !=nil {_aefec .Set ("\u0045x\u0074\u0047\u0053\u0074\u0061\u0074e",_acedc .ExtGState );};return _acedc ._gaac ;};func (_eacb *PdfWriter )seekByName (_eadb _fg .PdfObject ,_fecfb []string ,_bgbgb string )([]_fg .PdfObject ,error ){_aa .Log .Trace ("\u0053\u0065\u0065\u006b\u0020\u0062\u0079\u0020\u006e\u0061\u006d\u0065.\u002e\u0020\u0025\u0054",_eadb );
|
||
var _eadba []_fg .PdfObject ;if _acadb ,_gegbd :=_eadb .(*_fg .PdfIndirectObject );_gegbd {return _eacb .seekByName (_acadb .PdfObject ,_fecfb ,_bgbgb );};if _daeff ,_gagdga :=_eadb .(*_fg .PdfObjectStream );_gagdga {return _eacb .seekByName (_daeff .PdfObjectDictionary ,_fecfb ,_bgbgb );
|
||
};if _bacag ,_fgebb :=_eadb .(*_fg .PdfObjectDictionary );_fgebb {_aa .Log .Trace ("\u0044\u0069\u0063\u0074");for _ ,_dbdbb :=range _bacag .Keys (){_gcec :=_bacag .Get (_dbdbb );if string (_dbdbb )==_bgbgb {_eadba =append (_eadba ,_gcec );};for _ ,_defdc :=range _fecfb {if string (_dbdbb )==_defdc {_aa .Log .Trace ("\u0046\u006f\u006c\u006c\u006f\u0077\u0020\u006b\u0065\u0079\u0020\u0025\u0073",_defdc );
|
||
_fafe ,_bbbeb :=_eacb .seekByName (_gcec ,_fecfb ,_bgbgb );if _bbbeb !=nil {return _eadba ,_bbbeb ;};_eadba =append (_eadba ,_fafe ...);break ;};};};return _eadba ,nil ;};return _eadba ,nil ;};func _fffa (_dadec _fg .PdfObject )(*PdfColorspaceSpecialIndexed ,error ){_cbadc :=NewPdfColorspaceSpecialIndexed ();
|
||
if _ebbd ,_acfed :=_dadec .(*_fg .PdfIndirectObject );_acfed {_cbadc ._gfeg =_ebbd ;};_dadec =_fg .TraceToDirectObject (_dadec );_badd ,_bcgf :=_dadec .(*_fg .PdfObjectArray );if !_bcgf {return nil ,_d .Errorf ("\u0074\u0079\u0070\u0065\u0020\u0065\u0072\u0072\u006f\u0072");
|
||
};if _badd .Len ()!=4{return nil ,_d .Errorf ("\u0069\u006e\u0064\u0065\u0078\u0065\u0064\u0020\u0043\u0053\u003a\u0020\u0069\u006e\u0076a\u006ci\u0064\u0020\u0061\u0072\u0072\u0061\u0079\u0020\u006c\u0065\u006e\u0067\u0074\u0068");};_dadec =_badd .Get (0);
|
||
_aecd ,_bcgf :=_dadec .(*_fg .PdfObjectName );if !_bcgf {return nil ,_d .Errorf ("\u0069n\u0064\u0065\u0078\u0065\u0064\u0020\u0043\u0053\u003a\u0020\u0069n\u0076\u0061\u006c\u0069\u0064\u0020\u006e\u0061\u006d\u0065");};if *_aecd !="\u0049n\u0064\u0065\u0078\u0065\u0064"{return nil ,_d .Errorf ("\u0069\u006e\u0064\u0065xe\u0064\u0020\u0043\u0053\u003a\u0020\u0077\u0072\u006f\u006e\u0067\u0020\u006e\u0061m\u0065");
|
||
};_dadec =_badd .Get (1);_cdcb ,_gbac :=DetermineColorspaceNameFromPdfObject (_dadec );if _gbac !=nil {return nil ,_gbac ;};if _cdcb =="\u0049n\u0064\u0065\u0078\u0065\u0064"||_cdcb =="\u0050a\u0074\u0074\u0065\u0072\u006e"{_aa .Log .Debug ("E\u0072\u0072o\u0072\u003a\u0020\u0049\u006e\u0064\u0065\u0078\u0065\u0064\u0020\u0063\u006f\u006c\u006f\u0072\u0073\u0070\u0061\u0063e\u0020\u0063\u0061\u006e\u006e\u006f\u0074\u0020\u0068\u0061\u0076\u0065\u0020\u0049\u006e\u0064e\u0078\u0065\u0064\u002f\u0050\u0061\u0074\u0074\u0065\u0072\u006e\u0020\u0043S\u0020\u0061\u0073\u0020\u0062\u0061\u0073\u0065\u0020\u0028\u0025v\u0029",_cdcb );
|
||
return nil ,_gbfa ;};_gadcd ,_gbac :=NewPdfColorspaceFromPdfObject (_dadec );if _gbac !=nil {return nil ,_gbac ;};_cbadc .Base =_gadcd ;_dadec =_badd .Get (2);_bbgab ,_gbac :=_fg .GetNumberAsInt64 (_dadec );if _gbac !=nil {return nil ,_gbac ;};if _bbgab > 255{return nil ,_d .Errorf ("\u0069n\u0064\u0065\u0078\u0065d\u0020\u0043\u0053\u003a\u0020I\u006ev\u0061l\u0069\u0064\u0020\u0068\u0069\u0076\u0061l");
|
||
};_cbadc .HiVal =int (_bbgab );_dadec =_badd .Get (3);_cbadc .Lookup =_dadec ;_dadec =_fg .TraceToDirectObject (_dadec );var _eeacg []byte ;if _bagb ,_eabe :=_dadec .(*_fg .PdfObjectString );_eabe {_eeacg =_bagb .Bytes ();_aa .Log .Trace ("\u0049\u006e\u0064\u0065\u0078\u0065\u0064\u0020\u0073\u0074r\u0069\u006e\u0067\u0020\u0063\u006f\u006co\u0072\u0020\u0064\u0061\u0074\u0061\u003a\u0020\u0025\u0020\u0064",_eeacg );
|
||
}else if _cgff ,_effa :=_dadec .(*_fg .PdfObjectStream );_effa {_aa .Log .Trace ("\u0049n\u0064e\u0078\u0065\u0064\u0020\u0073t\u0072\u0065a\u006d\u003a\u0020\u0025\u0073",_dadec .String ());_aa .Log .Trace ("\u0045\u006e\u0063\u006fde\u0064\u0020\u0028\u0025\u0064\u0029\u0020\u003a\u0020\u0025\u0023\u0020\u0078",len (_cgff .Stream ),_cgff .Stream );
|
||
_adabd ,_ccab :=_fg .DecodeStream (_cgff );if _ccab !=nil {return nil ,_ccab ;};_aa .Log .Trace ("\u0044e\u0063o\u0064\u0065\u0064\u0020\u0028%\u0064\u0029 \u003a\u0020\u0025\u0020\u0058",len (_adabd ),_adabd );_eeacg =_adabd ;}else {_aa .Log .Debug ("\u0054\u0079\u0070\u0065\u003a\u0020\u0025\u0054",_dadec );
|
||
return nil ,_d .Errorf ("\u0069\u006e\u0064\u0065\u0078\u0065\u0064\u0020\u0043\u0053\u003a\u0020\u0049\u006e\u0076a\u006ci\u0064\u0020\u0074\u0061\u0062\u006c\u0065\u0020\u0066\u006f\u0072\u006d\u0061\u0074");};if len (_eeacg )< _cbadc .Base .GetNumComponents ()*(_cbadc .HiVal +1){_aa .Log .Debug ("\u0050\u0044\u0046\u0020\u0049\u006e\u0063o\u006d\u0070\u0061t\u0069\u0062\u0069\u006ci\u0074\u0079\u003a\u0020\u0049\u006e\u0064\u0065\u0078\u0020\u0073\u0074\u0072\u0065\u0061\u006d\u0020\u0074\u006f\u006f\u0020\u0073\u0068\u006f\u0072\u0074");
|
||
_aa .Log .Debug ("\u0046\u0061i\u006c\u002c\u0020\u006c\u0065\u006e\u0028\u0064\u0061\u0074\u0061\u0029\u003a\u0020\u0025\u0064\u002c\u0020\u0063\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074\u0073\u003a\u0020\u0025\u0064\u002c\u0020\u0068\u0069\u0056\u0061\u006c\u003a\u0020\u0025\u0064",len (_eeacg ),_cbadc .Base .GetNumComponents (),_cbadc .HiVal );
|
||
}else {_eeacg =_eeacg [:_cbadc .Base .GetNumComponents ()*(_cbadc .HiVal +1)];};_cbadc ._acce =_eeacg ;return _cbadc ,nil ;};
|
||
|
||
// NewPdfFieldSignature returns an initialized signature field.
|
||
func NewPdfFieldSignature (signature *PdfSignature )*PdfFieldSignature {_deagb :=&PdfFieldSignature {};_deagb .PdfField =NewPdfField ();_deagb .PdfField .SetContext (_deagb );_deagb .PdfAnnotationWidget =NewPdfAnnotationWidget ();_deagb .PdfAnnotationWidget .SetContext (_deagb );
|
||
_deagb .PdfAnnotationWidget ._agb =_deagb .PdfField ._daecc ;_deagb .T =_fg .MakeString ("");_deagb .F =_fg .MakeInteger (132);_deagb .V =signature ;return _deagb ;};
|
||
|
||
// GetOCProperties returns the optional content properties PdfObject.
|
||
func (_bgbef *PdfReader )GetOCProperties ()(_fg .PdfObject ,error ){_daagcd :=_bgbef ._cgegd ;_gacdd :=_daagcd .Get ("\u004f\u0043\u0050r\u006f\u0070\u0065\u0072\u0074\u0069\u0065\u0073");_gacdd =_fg .ResolveReference (_gacdd );if !_bgbef ._beegg {_fcccfb :=_bgbef .traverseObjectData (_gacdd );
|
||
if _fcccfb !=nil {return nil ,_fcccfb ;};};return _gacdd ,nil ;};
|
||
|
||
// PdfWriter handles outputing PDF content.
|
||
type PdfWriter struct{_cegde *_fg .PdfIndirectObject ;_feccd *_fg .PdfIndirectObject ;_cbdbf map[_fg .PdfObject ]struct{};_bbfd []_fg .PdfObject ;_gcbec map[_fg .PdfObject ]struct{};_bccgad []*_fg .PdfIndirectObject ;_baebg *PdfOutlineTreeNode ;_cgacf *_fg .PdfObjectDictionary ;
|
||
_ebedb []_fg .PdfObject ;_deabg *_fg .PdfIndirectObject ;_dbdde *_da .Writer ;_fcgga int64 ;_adgac error ;_bbdbd *_fg .PdfCrypt ;_fagba *_fg .PdfObjectDictionary ;_abgdg *_fg .PdfIndirectObject ;_dadgc *_fg .PdfObjectArray ;_fbbec _fg .Version ;_gefag *bool ;
|
||
_gcafd map[_fg .PdfObject ][]*_fg .PdfObjectDictionary ;_feaea *PdfAcroForm ;_fdgfe Optimizer ;_effb StandardApplier ;_aafgd map[int ]crossReference ;_beddc int64 ;ObjNumOffset int ;_cdafg bool ;_abeeb _fg .XrefTable ;_cgdbf int64 ;_cecef int64 ;_cbeab map[_fg .PdfObject ]int64 ;
|
||
_acccfc map[_fg .PdfObject ]struct{};_dbefbd string ;_adgga []*PdfOutputIntent ;_gaaaab bool ;_deeab ,_ccccb string ;};
|
||
|
||
// AddFont adds a font dictionary to the Font resources.
|
||
func (_badbba *PdfPage )AddFont (name _fg .PdfObjectName ,font _fg .PdfObject )error {if _badbba .Resources ==nil {_badbba .Resources =NewPdfPageResources ();};if _badbba .Resources .Font ==nil {_badbba .Resources .Font =_fg .MakeDict ();};_dadcb ,_bdada :=_fg .TraceToDirectObject (_badbba .Resources .Font ).(*_fg .PdfObjectDictionary );
|
||
if !_bdada {_aa .Log .Debug ("\u0045\u0078\u0070\u0065\u0063\u0074\u0065\u0064 \u0066\u006f\u006et \u0064\u0069\u0063\u0074\u0069\u006fn\u0061\u0072\u0079\u0020\u0069\u0073\u0020\u006e\u006f\u0074\u0020\u0061\u0020\u0064\u0069c\u0074\u0069\u006f\u006e\u0061\u0072\u0079\u003a \u0025\u0076",_fg .TraceToDirectObject (_badbba .Resources .Font ));
|
||
return _ce .New ("\u0074\u0079p\u0065\u0020\u0063h\u0065\u0063\u006b\u0020\u0065\u0072\u0072\u006f\u0072");};_dadcb .Set (name ,font );return nil ;};
|
||
|
||
// SetColorSpace sets `r` colorspace object to `colorspace`.
|
||
func (_acfg *PdfPageResources )SetColorSpace (colorspace *PdfPageResourcesColorspaces ){_acfg ._edbg =colorspace ;};
|
||
|
||
// PdfShadingType3 is a Radial shading.
|
||
type PdfShadingType3 struct{*PdfShading ;Coords *_fg .PdfObjectArray ;Domain *_fg .PdfObjectArray ;Function []PdfFunction ;Extend *_fg .PdfObjectArray ;};
|
||
|
||
// ToPdfObject returns the text field dictionary within an indirect object (container).
|
||
func (_aeeecd *PdfFieldText )ToPdfObject ()_fg .PdfObject {_aeeecd .PdfField .ToPdfObject ();_acfea :=_aeeecd ._daecc ;_ebcc :=_acfea .PdfObject .(*_fg .PdfObjectDictionary );_ebcc .Set ("\u0046\u0054",_fg .MakeName ("\u0054\u0078"));if _aeeecd .DA !=nil {_ebcc .Set ("\u0044\u0041",_aeeecd .DA );
|
||
};if _aeeecd .Q !=nil {_ebcc .Set ("\u0051",_aeeecd .Q );};if _aeeecd .DS !=nil {_ebcc .Set ("\u0044\u0053",_aeeecd .DS );};if _aeeecd .RV !=nil {_ebcc .Set ("\u0052\u0056",_aeeecd .RV );};if _aeeecd .MaxLen !=nil {_ebcc .Set ("\u004d\u0061\u0078\u004c\u0065\u006e",_aeeecd .MaxLen );
|
||
};return _acfea ;};func (_ceea *PdfReader )newPdfOutlineItemFromIndirectObject (_dgbea *_fg .PdfIndirectObject )(*PdfOutlineItem ,error ){_bcae ,_afdgb :=_dgbea .PdfObject .(*_fg .PdfObjectDictionary );if !_afdgb {return nil ,_d .Errorf ("\u006f\u0075\u0074l\u0069\u006e\u0065\u0020o\u0062\u006a\u0065\u0063\u0074\u0020\u006eo\u0074\u0020\u0061\u0020\u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061\u0072\u0079");
|
||
};_bebg :=NewPdfOutlineItem ();_cfcg :=_bcae .Get ("\u0054\u0069\u0074l\u0065");if _cfcg ==nil {return nil ,_d .Errorf ("\u006d\u0069\u0073s\u0069\u006e\u0067\u0020\u0054\u0069\u0074\u006c\u0065\u0020\u0066\u0072\u006f\u006d\u0020\u004f\u0075\u0074\u006c\u0069\u006e\u0065\u0020\u0049\u0074\u0065\u006d\u0020\u0028r\u0065\u0071\u0075\u0069\u0072\u0065\u0064\u0029");
|
||
};_fedge ,_ebgb :=_fg .GetString (_cfcg );if !_ebgb {return nil ,_d .Errorf ("\u0074\u0069\u0074le\u0020\u006e\u006f\u0074\u0020\u0061\u0020\u0073\u0074\u0072\u0069\u006e\u0067\u0020\u0028\u0025\u0054\u0029",_cfcg );};_bebg .Title =_fedge ;if _cfafea :=_bcae .Get ("\u0043\u006f\u0075n\u0074");
|
||
_cfafea !=nil {_fgeef ,_dbgee :=_cfafea .(*_fg .PdfObjectInteger );if !_dbgee {return nil ,_d .Errorf ("\u0063o\u0075\u006e\u0074\u0020n\u006f\u0074\u0020\u0061\u006e \u0069n\u0074e\u0067\u0065\u0072\u0020\u0028\u0025\u0054)",_cfafea );};_fddeb :=int64 (*_fgeef );
|
||
_bebg .Count =&_fddeb ;};if _acccf :=_bcae .Get ("\u0044\u0065\u0073\u0074");_acccf !=nil {_bebg .Dest =_fg .ResolveReference (_acccf );if !_ceea ._beegg {_gdebb :=_ceea .traverseObjectData (_bebg .Dest );if _gdebb !=nil {return nil ,_gdebb ;};};};if _gafdfd :=_bcae .Get ("\u0041");
|
||
_gafdfd !=nil {_bebg .A =_fg .ResolveReference (_gafdfd );if !_ceea ._beegg {_bdcde :=_ceea .traverseObjectData (_bebg .A );if _bdcde !=nil {return nil ,_bdcde ;};};};if _fcff :=_bcae .Get ("\u0053\u0045");_fcff !=nil {_bebg .SE =nil ;};if _cfea :=_bcae .Get ("\u0043");
|
||
_cfea !=nil {_bebg .C =_fg .ResolveReference (_cfea );};if _adfd :=_bcae .Get ("\u0046");_adfd !=nil {_bebg .F =_fg .ResolveReference (_adfd );};return _bebg ,nil ;};
|
||
|
||
// GetPdfVersion gets the version of the PDF used within this document.
|
||
func (_ageee *PdfWriter )GetPdfVersion ()string {return _ageee .getPdfVersion ()};
|
||
|
||
// A PdfPattern can represent a Pattern, either a tiling pattern or a shading pattern.
|
||
// Note that all patterns shall be treated as colours; a Pattern colour space shall be established with the CS or cs
|
||
// operator just like other colour spaces, and a particular pattern shall be installed as the current colour with the
|
||
// SCN or scn operator.
|
||
type PdfPattern struct{
|
||
|
||
// Type: Pattern
|
||
PatternType int64 ;_ccdc PdfModel ;_gaac _fg .PdfObject ;};
|
||
|
||
// ToPdfObject implements model.PdfModel interface.
|
||
func (_fgfbde *PdfOutputIntent )ToPdfObject ()_fg .PdfObject {if _fgfbde ._geaa ==nil {_fgfbde ._geaa =_fg .MakeDict ();};_abgb :=_fgfbde ._geaa ;if _fgfbde .Type !=""{_abgb .Set ("\u0054\u0079\u0070\u0065",_fg .MakeName (_fgfbde .Type ));};_abgb .Set ("\u0053",_fg .MakeName (_fgfbde .S .String ()));
|
||
if _fgfbde .OutputCondition !=""{_abgb .Set ("\u004fu\u0074p\u0075\u0074\u0043\u006f\u006e\u0064\u0069\u0074\u0069\u006f\u006e",_fg .MakeString (_fgfbde .OutputCondition ));};_abgb .Set ("\u004fu\u0074\u0070\u0075\u0074C\u006f\u006e\u0064\u0069\u0074i\u006fn\u0049d\u0065\u006e\u0074\u0069\u0066\u0069\u0065r",_fg .MakeString (_fgfbde .OutputConditionIdentifier ));
|
||
_abgb .Set ("\u0052\u0065\u0067i\u0073\u0074\u0072\u0079\u004e\u0061\u006d\u0065",_fg .MakeString (_fgfbde .RegistryName ));if _fgfbde .Info !=""{_abgb .Set ("\u0049\u006e\u0066\u006f",_fg .MakeString (_fgfbde .Info ));};if len (_fgfbde .DestOutputProfile )!=0{_debba ,_cdgbd :=_fg .MakeStream (_fgfbde .DestOutputProfile ,_fg .NewFlateEncoder ());
|
||
if _cdgbd !=nil {_aa .Log .Error ("\u004d\u0061\u006b\u0065\u0053\u0074\u0072\u0065\u0061\u006d\u0020\u0044\u0065s\u0074\u004f\u0075\u0074\u0070\u0075t\u0050\u0072\u006f\u0066\u0069\u006c\u0065\u0020\u0066\u0061\u0069\u006c\u0065d\u003a\u0020\u0025\u0076",_cdgbd );
|
||
};_debba .PdfObjectDictionary .Set ("\u004e",_fg .MakeInteger (int64 (_fgfbde .ColorComponents )));_ecfcd :=make ([]float64 ,_fgfbde .ColorComponents *2);for _gfdgb :=0;_gfdgb < _fgfbde .ColorComponents *2;_gfdgb ++{_dbgaf :=0.0;if _gfdgb %2!=0{_dbgaf =1.0;
|
||
};_ecfcd [_gfdgb ]=_dbgaf ;};_debba .PdfObjectDictionary .Set ("\u0052\u0061\u006eg\u0065",_fg .MakeArrayFromFloats (_ecfcd ));_abgb .Set ("\u0044\u0065\u0073\u0074\u004f\u0075\u0074\u0070\u0075\u0074\u0050\u0072o\u0066\u0069\u006c\u0065",_debba );};return _abgb ;
|
||
};func _bceb (_cgcb _fg .PdfObject )(*PdfBorderStyle ,error ){_gcae :=&PdfBorderStyle {};_gcae ._ebeb =_cgcb ;var _dgd *_fg .PdfObjectDictionary ;_cgcb =_fg .TraceToDirectObject (_cgcb );_dgd ,_ffcd :=_cgcb .(*_fg .PdfObjectDictionary );if !_ffcd {return nil ,_ce .New ("\u0074\u0079\u0070\u0065\u0020\u0063\u0068\u0065\u0063\u006b");
|
||
};if _ebcdbd :=_dgd .Get ("\u0054\u0079\u0070\u0065");_ebcdbd !=nil {_ecfc ,_ebeg :=_ebcdbd .(*_fg .PdfObjectName );if !_ebeg {_aa .Log .Debug ("I\u006e\u0063\u006f\u006d\u0070\u0061\u0074\u0069\u0062i\u006c\u0069\u0074\u0079\u0020\u0077\u0069th\u0020\u0054\u0079\u0070e\u0020\u006e\u006f\u0074\u0020\u0061\u0020\u006e\u0061me\u0020\u006fb\u006a\u0065\u0063\u0074\u003a\u0020\u0025\u0054",_ebcdbd );
|
||
}else {if *_ecfc !="\u0042\u006f\u0072\u0064\u0065\u0072"{_aa .Log .Debug ("W\u0061\u0072\u006e\u0069\u006e\u0067,\u0020\u0054\u0079\u0070\u0065\u0020\u0021\u003d\u0020B\u006f\u0072\u0064e\u0072:\u0020\u0025\u0073",*_ecfc );};};};if _dgf :=_dgd .Get ("\u0057");
|
||
_dgf !=nil {_dfbga ,_cbac :=_fg .GetNumberAsFloat (_dgf );if _cbac !=nil {_aa .Log .Debug ("\u0045\u0072\u0072\u006fr \u0072\u0065\u0074\u0072\u0069\u0065\u0076\u0069\u006e\u0067\u0020\u0057\u003a\u0020%\u0076",_cbac );return nil ,_cbac ;};_gcae .W =&_dfbga ;
|
||
};if _abb :=_dgd .Get ("\u0053");_abb !=nil {_cbff ,_caaa :=_abb .(*_fg .PdfObjectName );if !_caaa {return nil ,_ce .New ("\u0062\u006f\u0072\u0064\u0065\u0072\u0020\u0053\u0020\u006e\u006ft\u0020\u0061\u0020\u006e\u0061\u006d\u0065\u0020\u006f\u0062j\u0065\u0063\u0074");
|
||
};var _efge BorderStyle ;switch *_cbff {case "\u0053":_efge =BorderStyleSolid ;case "\u0044":_efge =BorderStyleDashed ;case "\u0042":_efge =BorderStyleBeveled ;case "\u0049":_efge =BorderStyleInset ;case "\u0055":_efge =BorderStyleUnderline ;default:_aa .Log .Debug ("I\u006e\u0076\u0061\u006cid\u0020s\u0074\u0079\u006c\u0065\u0020n\u0061\u006d\u0065\u0020\u0025\u0073",*_cbff );
|
||
return nil ,_ce .New ("\u0073\u0074\u0079\u006ce \u0074\u0079\u0070\u0065\u0020\u0072\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065c\u006b");};_gcae .S =&_efge ;};if _edde :=_dgd .Get ("\u0044");_edde !=nil {_cacge ,_dgc :=_edde .(*_fg .PdfObjectArray );
|
||
if !_dgc {_aa .Log .Debug ("\u0042\u006f\u0072\u0064\u0065\u0072\u0020\u0044\u0020\u0064a\u0073\u0068\u0020\u006e\u006f\u0074\u0020a\u006e\u0020\u0061\u0072\u0072\u0061\u0079\u003a\u0020\u0025\u0054",_edde );return nil ,_ce .New ("\u0062o\u0072\u0064\u0065\u0072 \u0044\u0020\u0074\u0079\u0070e\u0020c\u0068e\u0063\u006b\u0020\u0065\u0072\u0072\u006fr");
|
||
};_bcgd ,_edfd :=_cacge .ToIntegerArray ();if _edfd !=nil {_aa .Log .Debug ("\u0042\u006f\u0072\u0064\u0065\u0072\u0020\u0044 \u0050\u0072\u006fbl\u0065\u006d\u0020\u0063\u006f\u006ev\u0065\u0072\u0074\u0069\u006e\u0067\u0020\u0074\u006f\u0020\u0069\u006e\u0074\u0065\u0067e\u0072\u0020\u0061\u0072\u0072\u0061\u0079\u003a \u0025\u0076",_edfd );
|
||
return nil ,_edfd ;};_gcae .D =&_bcgd ;};return _gcae ,nil ;};
|
||
|
||
// String returns a string that describes `font`.
|
||
func (_dacf *PdfFont )String ()string {_dabb :="";if _dacf ._gcaeff .Encoder ()!=nil {_dabb =_dacf ._gcaeff .Encoder ().String ();};return _d .Sprintf ("\u0046\u004f\u004e\u0054\u007b\u0025\u0054\u0020\u0025s\u0020\u0025\u0073\u007d",_dacf ._gcaeff ,_dacf .baseFields ().coreString (),_dabb );
|
||
};
|
||
|
||
// DecodeArray returns the range of color component values in the Lab colorspace.
|
||
func (_feaf *PdfColorspaceLab )DecodeArray ()[]float64 {_fgae :=[]float64 {0,100};if _feaf .Range !=nil &&len (_feaf .Range )==4{_fgae =append (_fgae ,_feaf .Range ...);}else {_fgae =append (_fgae ,-100,100,-100,100);};return _fgae ;};
|
||
|
||
// SetPatternByName sets a pattern resource specified by keyName.
|
||
func (_ecfae *PdfPageResources )SetPatternByName (keyName _fg .PdfObjectName ,pattern _fg .PdfObject )error {if _ecfae .Pattern ==nil {_ecfae .Pattern =_fg .MakeDict ();};_gbdba ,_fdcgb :=_fg .GetDict (_ecfae .Pattern );if !_fdcgb {return _fg .ErrTypeError ;
|
||
};_gbdba .Set (keyName ,pattern );return nil ;};
|
||
|
||
// Val returns the color value.
|
||
func (_cbag *PdfColorDeviceGray )Val ()float64 {return float64 (*_cbag )};
|
||
|
||
// NewPdfReaderFromFile creates a new PdfReader from the speficied PDF file.
|
||
// If ReaderOpts is nil it will be set to default value from NewReaderOpts.
|
||
func NewPdfReaderFromFile (pdfFile string ,opts *ReaderOpts )(*PdfReader ,*_c .File ,error ){const _afce ="\u006d\u006f\u0064\u0065\u006c\u003a\u004e\u0065\u0077\u0050\u0064f\u0052\u0065\u0061\u0064\u0065\u0072\u0046\u0072\u006f\u006dF\u0069\u006c\u0065";
|
||
_ffbaf ,_cbfbb :=_c .Open (pdfFile );if _cbfbb !=nil {return nil ,nil ,_cbfbb ;};_abfgg ,_cbfbb :=_bgdaf (_ffbaf ,opts ,true ,_afce );if _cbfbb !=nil {_ffbaf .Close ();return nil ,nil ,_cbfbb ;};return _abfgg ,_ffbaf ,nil ;};func (_ffgba *PdfWriter )addObject (_cbbba _fg .PdfObject )bool {_fabfa :=_ffgba .hasObject (_cbbba );
|
||
if !_fabfa {_abceg :=_fg .ResolveReferencesDeep (_cbbba ,_ffgba ._acccfc );if _abceg !=nil {_aa .Log .Debug ("E\u0052R\u004f\u0052\u003a\u0020\u0025\u0076\u0020\u002d \u0073\u006b\u0069\u0070pi\u006e\u0067",_abceg );};_ffgba ._bbfd =append (_ffgba ._bbfd ,_cbbba );
|
||
_ffgba ._gcbec [_cbbba ]=struct{}{};return true ;};return false ;};func (_dedbb *fontFile )parseASCIIPart (_gdbcd []byte )error {if len (_gdbcd )< 2||string (_gdbcd [:2])!="\u0025\u0021"{return _ce .New ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0073\u0074a\u0072\u0074\u0020\u006f\u0066\u0020\u0041S\u0043\u0049\u0049\u0020\u0073\u0065\u0067\u006d\u0065\u006e\u0074");
|
||
};_aabg ,_gfeac ,_gggf :=_cbee (_gdbcd );if _gggf !=nil {return _gggf ;};_bffbc :=_agddd (_aabg );_dedbb ._gaefe =_bffbc ["\u0046\u006f\u006e\u0074\u004e\u0061\u006d\u0065"];if _dedbb ._gaefe ==""{_aa .Log .Debug ("\u0020\u0046\u006f\u006e\u0074\u0046\u0069\u006c\u0065\u0020\u0068a\u0073\u0020\u006e\u006f\u0020\u002f\u0046\u006f\u006e\u0074N\u0061\u006d\u0065");
|
||
};if _gfeac !=""{_dagfg ,_aefea :=_gcgcc (_gfeac );if _aefea !=nil {return _aefea ;};_adcgc ,_aefea :=_dg .NewCustomSimpleTextEncoder (_dagfg ,nil );if _aefea !=nil {_aa .Log .Debug ("\u0045\u0052\u0052\u004fR\u0020\u003a\u0055\u004e\u004b\u004e\u004f\u0057\u004e\u0020G\u004cY\u0050\u0048\u003a\u0020\u0065\u0072\u0072=\u0025\u0076",_aefea );
|
||
return nil ;};_dedbb ._ffff =_adcgc ;};return nil ;};
|
||
|
||
// SetFillImage attach a model.Image to push button.
|
||
func (_baga *PdfFieldButton )SetFillImage (image *Image ){if _baga .IsPush (){_baga ._babe =image ;};};
|
||
|
||
// GetNumComponents returns the number of color components.
|
||
func (_bafa *PdfColorspaceICCBased )GetNumComponents ()int {return _bafa .N };
|
||
|
||
// PdfColorspaceCalRGB stores A, B, C components
|
||
type PdfColorspaceCalRGB struct{WhitePoint []float64 ;BlackPoint []float64 ;Gamma []float64 ;Matrix []float64 ;_gage *_fg .PdfObjectDictionary ;_cfcb *_fg .PdfIndirectObject ;};
|
||
|
||
// Encoder returns the font's text encoder.
|
||
func (_decbg *pdfFontSimple )Encoder ()_dg .TextEncoder {if _decbg ._bdgda !=nil {return _decbg ._bdgda ;};if _decbg ._fcad !=nil {return _decbg ._fcad ;};_gbga ,_ :=_dg .NewSimpleTextEncoder ("\u0053\u0074a\u006e\u0064\u0061r\u0064\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067",nil );
|
||
return _gbga ;};
|
||
|
||
// M returns the value of the magenta component of the color.
|
||
func (_fcfg *PdfColorDeviceCMYK )M ()float64 {return _fcfg [1]};
|
||
|
||
// SetPdfProducer sets the Producer attribute of the output PDF.
|
||
func SetPdfProducer (producer string ){_baacg .Lock ();defer _baacg .Unlock ();_egdda =producer };func _gcccf (_agcf ,_afeac string )string {if _dc .Contains (_agcf ,"\u002b"){_aacb :=_dc .Split (_agcf ,"\u002b");if len (_aacb )==2{_agcf =_aacb [1];};};
|
||
return _afeac +"\u002b"+_agcf ;};func _gafdf (_daad _fg .PdfObject )(*_fg .PdfObjectDictionary ,*fontCommon ,error ){_bbcg :=&fontCommon {};if _fbfaa ,_ecfdb :=_daad .(*_fg .PdfIndirectObject );_ecfdb {_bbcg ._dgagb =_fbfaa .ObjectNumber ;};_afgfd ,_eeegg :=_fg .GetDict (_daad );
|
||
if !_eeegg {_aa .Log .Debug ("\u0045\u0052\u0052O\u0052\u003a\u0020\u0046\u006f\u006e\u0074\u0020\u006e\u006f\u0074\u0020\u0067\u0069\u0076\u0065\u006e\u0020\u0062\u0079\u0020\u0061\u0020\u0064\u0069\u0063\u0074\u0069\u006fn\u0061\u0072\u0079\u0020\u0028\u0025\u0054\u0029",_daad );
|
||
return nil ,nil ,ErrFontNotSupported ;};_degf ,_eeegg :=_fg .GetNameVal (_afgfd .Get ("\u0054\u0079\u0070\u0065"));if !_eeegg {_aa .Log .Debug ("\u0045\u0052R\u004f\u0052\u003a\u0020\u0046o\u006e\u0074\u0020\u0049\u006ec\u006f\u006d\u0070\u0061\u0074\u0069\u0062\u0069\u006c\u0069\u0074\u0079\u002e\u0020\u0054\u0079\u0070\u0065\u0020\u0028\u0052\u0065\u0071\u0075\u0069\u0072\u0065\u0064\u0029\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067");
|
||
return nil ,nil ,ErrRequiredAttributeMissing ;};if _degf !="\u0046\u006f\u006e\u0074"{_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052:\u0020\u0046\u006f\u006e\u0074\u0020\u0049\u006e\u0063\u006f\u006d\u0070\u0061t\u0069\u0062\u0069\u006c\u0069\u0074\u0079\u002e\u0020\u0054\u0079\u0070\u0065\u003d\u0025\u0071\u002e\u0020\u0053\u0068\u006f\u0075\u006c\u0064\u0020\u0062\u0065\u0020\u0025\u0071.",_degf ,"\u0046\u006f\u006e\u0074");
|
||
return nil ,nil ,_fg .ErrTypeError ;};_bfddd ,_eeegg :=_fg .GetNameVal (_afgfd .Get ("\u0053u\u0062\u0074\u0079\u0070\u0065"));if !_eeegg {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020F\u006f\u006e\u0074 \u0049\u006e\u0063o\u006d\u0070a\u0074\u0069\u0062\u0069\u006c\u0069t\u0079. \u0053\u0075\u0062\u0074\u0079\u0070\u0065\u0020\u0028\u0052\u0065\u0071\u0075\u0069\u0072\u0065\u0064\u0029\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067");
|
||
return nil ,nil ,ErrRequiredAttributeMissing ;};_bbcg ._ggcfc =_bfddd ;_cbfbc ,_eeegg :=_fg .GetNameVal (_afgfd .Get ("\u004e\u0061\u006d\u0065"));if _eeegg {_bbcg ._edad =_cbfbc ;};_gacdg :=_afgfd .Get ("\u0054o\u0055\u006e\u0069\u0063\u006f\u0064e");
|
||
if _gacdg !=nil {_bbcg ._eggb =_fg .TraceToDirectObject (_gacdg );_gfebc ,_baad :=_facaf (_bbcg ._eggb ,_bbcg );if _baad !=nil {return _afgfd ,_bbcg ,_baad ;};_bbcg ._agab =_gfebc ;}else if _bfddd =="\u0043\u0049\u0044F\u006f\u006e\u0074\u0054\u0079\u0070\u0065\u0030"||_bfddd =="\u0043\u0049\u0044F\u006f\u006e\u0074\u0054\u0079\u0070\u0065\u0032"{_gdeg ,_eegf :=_fc .NewCIDSystemInfo (_afgfd .Get ("\u0043\u0049\u0044\u0053\u0079\u0073\u0074\u0065\u006d\u0049\u006e\u0066\u006f"));
|
||
if _eegf !=nil {return _afgfd ,_bbcg ,_eegf ;};_acdeg :=_d .Sprintf ("\u0025\u0073\u002d\u0025\u0073\u002d\u0055\u0043\u0053\u0032",_gdeg .Registry ,_gdeg .Ordering );if _fc .IsPredefinedCMap (_acdeg ){_bbcg ._agab ,_eegf =_fc .LoadPredefinedCMap (_acdeg );
|
||
if _eegf !=nil {_aa .Log .Debug ("\u0057\u0041\u0052\u004e\u003a\u0020\u0063o\u0075\u006c\u0064 \u006e\u006f\u0074\u0020l\u006f\u0061\u0064\u0020\u0070\u0072\u0065\u0064\u0065\u0066\u0069\u006e\u0065\u0064\u0020\u0043\u004d\u0061\u0070\u0020\u0025\u0073\u003a\u0020\u0025\u0076",_acdeg ,_eegf );
|
||
};};};_gfaec :=_afgfd .Get ("\u0046\u006f\u006e\u0074\u0044\u0065\u0073\u0063\u0072i\u0070\u0074\u006f\u0072");if _gfaec !=nil {_afedb ,_bacab :=_eeceb (_gfaec );if _bacab !=nil {_aa .Log .Debug ("\u0045\u0052\u0052OR\u003a\u0020\u0042\u0061\u0064\u0020\u0066\u006f\u006et\u0020d\u0065s\u0063r\u0069\u0070\u0074\u006f\u0072\u002e\u0020\u0065\u0072\u0072\u003d\u0025\u0076",_bacab );
|
||
return _afgfd ,_bbcg ,_bacab ;};_bbcg ._cdgef =_afedb ;};if _bfddd !="\u0054\u0079\u0070e\u0033"{_ddbed ,_befc :=_fg .GetNameVal (_afgfd .Get ("\u0042\u0061\u0073\u0065\u0046\u006f\u006e\u0074"));if !_befc {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a \u0046\u006f\u006et\u0020\u0049\u006ec\u006f\u006d\u0070\u0061\u0074\u0069\u0062\u0069\u006c\u0069t\u0079\u002e\u0020\u0042\u0061se\u0046\u006f\u006e\u0074\u0020\u0028\u0052\u0065\u0071\u0075\u0069\u0072\u0065\u0064\u0029\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067");
|
||
return _afgfd ,_bbcg ,ErrRequiredAttributeMissing ;};_bbcg ._aefg =_ddbed ;};return _afgfd ,_bbcg ,nil ;};
|
||
|
||
// NewPdfActionTrans returns a new "trans" action.
|
||
func NewPdfActionTrans ()*PdfActionTrans {_bfa :=NewPdfAction ();_ded :=&PdfActionTrans {};_ded .PdfAction =_bfa ;_bfa .SetContext (_ded );return _ded ;};func _ggdd (_gaafe *_fg .PdfObjectArray )(float64 ,error ){_bafg ,_bfee :=_gaafe .ToFloat64Array ();
|
||
if _bfee !=nil {_aa .Log .Debug ("\u0042\u0061\u0064\u0020\u004d\u0061\u0074\u0074\u0065\u0020\u0061\u0072\u0072\u0061\u0079:\u0020m\u0061\u0074\u0074\u0065\u003d\u0025\u0073\u0020\u0065\u0072\u0072\u003d\u0025\u0076",_gaafe ,_bfee );};switch len (_bafg ){case 1:return _bafg [0],nil ;
|
||
case 3:_gfeffb :=PdfColorspaceDeviceRGB {};_bdacc ,_cbbf :=_gfeffb .ColorFromFloats (_bafg );if _cbbf !=nil {return 0.0,_cbbf ;};return _bdacc .(*PdfColorDeviceRGB ).ToGray ().Val (),nil ;case 4:_faedd :=PdfColorspaceDeviceCMYK {};_gcefd ,_ecffd :=_faedd .ColorFromFloats (_bafg );
|
||
if _ecffd !=nil {return 0.0,_ecffd ;};_egbca ,_ecffd :=_faedd .ColorToRGB (_gcefd .(*PdfColorDeviceCMYK ));if _ecffd !=nil {return 0.0,_ecffd ;};return _egbca .(*PdfColorDeviceRGB ).ToGray ().Val (),nil ;};_bfee =_ce .New ("\u0062a\u0064 \u004d\u0061\u0074\u0074\u0065\u0020\u0063\u006f\u006c\u006f\u0072");
|
||
_aa .Log .Error ("\u0074\u006f\u0047ra\u0079\u003a\u0020\u006d\u0061\u0074\u0074\u0065\u003d\u0025\u0073\u0020\u0065\u0072\u0072\u003d\u0025\u0076",_gaafe ,_bfee );return 0.0,_bfee ;};
|
||
|
||
// SetXObjectByName adds the XObject from the passed in stream to the page resources.
|
||
// The added XObject is identified by the specified name.
|
||
func (_dagac *PdfPageResources )SetXObjectByName (keyName _fg .PdfObjectName ,stream *_fg .PdfObjectStream )error {if _dagac .XObject ==nil {_dagac .XObject =_fg .MakeDict ();};_fbfab :=_fg .TraceToDirectObject (_dagac .XObject );_agfcd ,_aecef :=_fbfab .(*_fg .PdfObjectDictionary );
|
||
if !_aecef {_aa .Log .Debug ("\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0058\u004f\u0062j\u0065\u0063\u0074\u002c\u0020\u0067\u006f\u0074\u0020\u0025T\u002f\u0025\u0054",_dagac .XObject ,_fbfab );return _ce .New ("\u0074\u0079p\u0065\u0020\u0063h\u0065\u0063\u006b\u0020\u0065\u0072\u0072\u006f\u0072");
|
||
};_agfcd .Set (keyName ,stream );return nil ;};func _gaaeb (_dbdd *_fg .PdfObjectDictionary )*VRI {_cggde ,_ :=_fg .GetString (_dbdd .Get ("\u0054\u0055"));_fgea ,_ :=_fg .GetString (_dbdd .Get ("\u0054\u0053"));return &VRI {Cert :_gfegc (_dbdd .Get ("\u0043\u0065\u0072\u0074")),OCSP :_gfegc (_dbdd .Get ("\u004f\u0043\u0053\u0050")),CRL :_gfegc (_dbdd .Get ("\u0043\u0052\u004c")),TU :_cggde ,TS :_fgea };
|
||
};var _dcede =map[string ]struct{}{"\u0054\u0069\u0074l\u0065":{},"\u0041\u0075\u0074\u0068\u006f\u0072":{},"\u0053u\u0062\u006a\u0065\u0063\u0074":{},"\u004b\u0065\u0079\u0077\u006f\u0072\u0064\u0073":{},"\u0043r\u0065\u0061\u0074\u006f\u0072":{},"\u0050\u0072\u006f\u0064\u0075\u0063\u0065\u0072":{},"\u0054r\u0061\u0070\u0070\u0065\u0064":{},"\u0043\u0072\u0065a\u0074\u0069\u006f\u006e\u0044\u0061\u0074\u0065":{},"\u004do\u0064\u0044\u0061\u0074\u0065":{}};
|
||
|
||
|
||
// Evaluate runs the function on the passed in slice and returns the results.
|
||
func (_gagb *PdfFunctionType3 )Evaluate (x []float64 )([]float64 ,error ){if len (x )!=1{_aa .Log .Error ("\u004f\u006e\u006c\u0079 o\u006e\u0065\u0020\u0069\u006e\u0070\u0075\u0074\u0020\u0061\u006c\u006c\u006f\u0077e\u0064");return nil ,_ce .New ("r\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b");
|
||
};return nil ,_ce .New ("\u006e\u006f\u0074\u0020im\u0070\u006c\u0065\u006d\u0065\u006e\u0074\u0065\u0064\u0020\u0079\u0065\u0074");};
|
||
|
||
// PdfAnnotationStrikeOut represents StrikeOut annotations.
|
||
// (Section 12.5.6.10).
|
||
type PdfAnnotationStrikeOut struct{*PdfAnnotation ;*PdfAnnotationMarkup ;QuadPoints _fg .PdfObject ;};
|
||
|
||
// GetContext returns a reference to the subpattern entry: either PdfTilingPattern or PdfShadingPattern.
|
||
func (_bcbafe *PdfPattern )GetContext ()PdfModel {return _bcbafe ._ccdc };
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_cbad *PdfActionMovie )ToPdfObject ()_fg .PdfObject {_cbad .PdfAction .ToPdfObject ();_fga :=_cbad ._bda ;_dda :=_fga .PdfObject .(*_fg .PdfObjectDictionary );_dda .SetIfNotNil ("\u0053",_fg .MakeName (string (ActionTypeMovie )));_dda .SetIfNotNil ("\u0041\u006e\u006e\u006f\u0074\u0061\u0074\u0069\u006f\u006e",_cbad .Annotation );
|
||
_dda .SetIfNotNil ("\u0054",_cbad .T );_dda .SetIfNotNil ("\u004fp\u0065\u0072\u0061\u0074\u0069\u006fn",_cbad .Operation );return _fga ;};
|
||
|
||
// ToUnicode returns the name of the font's "ToUnicode" field if there is one, or "" if there isn't.
|
||
func (_ggegc *PdfFont )ToUnicode ()string {if _ggegc .baseFields ()._agab ==nil {return "";};return _ggegc .baseFields ()._agab .Name ();};func (_faeaa *pdfCIDFontType2 )baseFields ()*fontCommon {return &_faeaa .fontCommon };func (_fgac *PdfWriter )checkPendingObjects (){for _fagaec ,_eeee :=range _fgac ._gcafd {if !_fgac .hasObject (_fagaec ){_aa .Log .Debug ("\u0057\u0041\u0052\u004e\u0020\u0050\u0065n\u0064\u0069\u006eg\u0020\u006f\u0062j\u0065\u0063t\u0020\u0025\u002b\u0076\u0020\u0025T\u0020(%\u0070\u0029\u0020\u006e\u0065\u0076\u0065\u0072\u0020\u0061\u0064\u0064\u0065\u0064\u0020\u0066\u006f\u0072\u0020\u0077\u0072\u0069\u0074\u0069\u006e\u0067",_fagaec ,_fagaec ,_fagaec );
|
||
for _ ,_agca :=range _eeee {for _ ,_gacga :=range _agca .Keys (){_cbcf :=_agca .Get (_gacga );if _cbcf ==_fagaec {_aa .Log .Debug ("\u0050e\u006e\u0064i\u006e\u0067\u0020\u006fb\u006a\u0065\u0063t\u0020\u0066\u006f\u0075\u006e\u0064\u0021\u0020\u0061nd\u0020\u0072\u0065p\u006c\u0061c\u0065\u0064\u0020\u0077\u0069\u0074h\u0020\u006eu\u006c\u006c");
|
||
_agca .Set (_gacga ,_fg .MakeNull ());break ;};};};};};};
|
||
|
||
// ColorToRGB converts a CMYK32 color to an RGB color.
|
||
func (_egg *PdfColorspaceDeviceCMYK )ColorToRGB (color PdfColor )(PdfColor ,error ){_acdb ,_dfd :=color .(*PdfColorDeviceCMYK );if !_dfd {_aa .Log .Debug ("I\u006e\u0070\u0075\u0074\u0020\u0063o\u006c\u006f\u0072\u0020\u006e\u006f\u0074\u0020\u0064e\u0076\u0069\u0063e\u0020c\u006d\u0079\u006b");
|
||
return nil ,_ce .New ("\u0074\u0079p\u0065\u0020\u0063h\u0065\u0063\u006b\u0020\u0065\u0072\u0072\u006f\u0072");};_aebg :=_acdb .C ();_aabb :=_acdb .M ();_cdb :=_acdb .Y ();_adeba :=_acdb .K ();_aebg =_aebg *(1-_adeba )+_adeba ;_aabb =_aabb *(1-_adeba )+_adeba ;
|
||
_cdb =_cdb *(1-_adeba )+_adeba ;_ebaa :=1-_aebg ;_acga :=1-_aabb ;_gaag :=1-_cdb ;return NewPdfColorDeviceRGB (_ebaa ,_acga ,_gaag ),nil ;};func _eagac ()string {_baacg .Lock ();defer _baacg .Unlock ();if len (_gfebcg )> 0{return _gfebcg ;};return "\u0055n\u0069\u0044\u006f\u0063 \u002d\u0020\u0068\u0074\u0074p\u003a/\u002fu\u006e\u0069\u0064\u006f\u0063\u002e\u0069o";
|
||
};
|
||
|
||
// PdfRectangle is a definition of a rectangle.
|
||
type PdfRectangle struct{Llx float64 ;Lly float64 ;Urx float64 ;Ury float64 ;};var _ pdfFont =(*pdfFontType3 )(nil );
|
||
|
||
// PdfReader represents a PDF file reader. It is a frontend to the lower level parsing mechanism and provides
|
||
// a higher level access to work with PDF structure and information, such as the page structure etc.
|
||
type PdfReader struct{_ccgg *_fg .PdfParser ;_degeg _fg .PdfObject ;_ecef *_fg .PdfIndirectObject ;_efgae *_fg .PdfObjectDictionary ;_bgce []*_fg .PdfIndirectObject ;PageList []*PdfPage ;_befaa int ;_cgegd *_fg .PdfObjectDictionary ;_cfac *PdfOutlineTreeNode ;
|
||
AcroForm *PdfAcroForm ;DSS *DSS ;Rotate *int64 ;_eadc *Permissions ;_cdecg map[*PdfReader ]*PdfReader ;_fdbdd []*PdfReader ;_edebb *modelManager ;_beegg bool ;_aefbbf map[_fg .PdfObject ]struct{};_daega _ff .ReadSeeker ;_cecbe string ;_gfdd bool ;_aegc *ReaderOpts ;
|
||
_ecgf bool ;};
|
||
|
||
// GetCerts returns the signature certificate chain.
|
||
func (_ceeeb *PdfSignature )GetCerts ()([]*_ge .Certificate ,error ){var _ecgbg []func ()([]*_ge .Certificate ,error );switch _cbcdce ,_ :=_fg .GetNameVal (_ceeeb .SubFilter );_cbcdce {case "\u0061\u0064\u0062\u0065.p\u006b\u0063\u0073\u0037\u002e\u0064\u0065\u0074\u0061\u0063\u0068\u0065\u0064","\u0045\u0054\u0053\u0049.C\u0041\u0064\u0045\u0053\u002e\u0064\u0065\u0074\u0061\u0063\u0068\u0065\u0064":_ecgbg =append (_ecgbg ,_ceeeb .extractChainFromPKCS7 ,_ceeeb .extractChainFromCert );
|
||
case "\u0061d\u0062e\u002e\u0078\u0035\u0030\u0039.\u0072\u0073a\u005f\u0073\u0068\u0061\u0031":_ecgbg =append (_ecgbg ,_ceeeb .extractChainFromCert );case "\u0045\u0054\u0053I\u002e\u0052\u0046\u0043\u0033\u0031\u0036\u0031":_ecgbg =append (_ecgbg ,_ceeeb .extractChainFromPKCS7 );
|
||
default:return nil ,_d .Errorf ("\u0075n\u0073\u0075\u0070\u0070o\u0072\u0074\u0065\u0064\u0020S\u0075b\u0046i\u006c\u0074\u0065\u0072\u003a\u0020\u0025s",_cbcdce );};for _ ,_afaff :=range _ecgbg {_cfbeb ,_ddddg :=_afaff ();if _ddddg !=nil {return nil ,_ddddg ;
|
||
};if len (_cfbeb )> 0{return _cfbeb ,nil ;};};return nil ,ErrSignNoCertificates ;};func (_ggcc *PdfReader )newPdfAnnotationPrinterMarkFromDict (_egde *_fg .PdfObjectDictionary )(*PdfAnnotationPrinterMark ,error ){_gga :=PdfAnnotationPrinterMark {};_gga .MN =_egde .Get ("\u004d\u004e");
|
||
return &_gga ,nil ;};
|
||
|
||
// NewPdfAnnotationRichMedia returns a new rich media annotation.
|
||
func NewPdfAnnotationRichMedia ()*PdfAnnotationRichMedia {_begb :=NewPdfAnnotation ();_gfef :=&PdfAnnotationRichMedia {};_gfef .PdfAnnotation =_begb ;_begb .SetContext (_gfef );return _gfef ;};
|
||
|
||
// SetPageLabels sets the PageLabels entry in the PDF catalog.
|
||
// See section 12.4.2 "Page Labels" (p. 382 PDF32000_2008).
|
||
func (_cegg *PdfWriter )SetPageLabels (pageLabels _fg .PdfObject )error {if pageLabels ==nil {return nil ;};_aa .Log .Trace ("\u0053\u0065t\u0074\u0069\u006e\u0067\u0020\u0063\u0061\u0074\u0061\u006c\u006f\u0067\u0020\u0050\u0061\u0067\u0065\u004c\u0061\u0062\u0065\u006cs.\u002e\u002e");
|
||
_cegg ._cgacf .Set ("\u0050\u0061\u0067\u0065\u004c\u0061\u0062\u0065\u006c\u0073",pageLabels );return _cegg .addObjects (pageLabels );};func (_aggaa *LTV )getCerts (_bfagc []*_ge .Certificate )([][]byte ,error ){_aeaed :=make ([][]byte ,0,len (_bfagc ));
|
||
for _ ,_ddee :=range _bfagc {_aeaed =append (_aeaed ,_ddee .Raw );};return _aeaed ,nil ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_badb *PdfAnnotationHighlight )ToPdfObject ()_fg .PdfObject {_badb .PdfAnnotation .ToPdfObject ();_gdg :=_badb ._agb ;_fcef :=_gdg .PdfObject .(*_fg .PdfObjectDictionary );_badb .PdfAnnotationMarkup .appendToPdfDictionary (_fcef );_fcef .SetIfNotNil ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u0048i\u0067\u0068\u006c\u0069\u0067\u0068t"));
|
||
_fcef .SetIfNotNil ("\u0051\u0075\u0061\u0064\u0050\u006f\u0069\u006e\u0074\u0073",_badb .QuadPoints );return _gdg ;};
|
||
|
||
// ToPdfObject return the CalGray colorspace as a PDF object (name dictionary).
|
||
func (_geca *PdfColorspaceCalGray )ToPdfObject ()_fg .PdfObject {_geef :=&_fg .PdfObjectArray {};_geef .Append (_fg .MakeName ("\u0043a\u006c\u0047\u0072\u0061\u0079"));_eeaf :=_fg .MakeDict ();if _geca .WhitePoint !=nil {_eeaf .Set ("\u0057\u0068\u0069\u0074\u0065\u0050\u006f\u0069\u006e\u0074",_fg .MakeArray (_fg .MakeFloat (_geca .WhitePoint [0]),_fg .MakeFloat (_geca .WhitePoint [1]),_fg .MakeFloat (_geca .WhitePoint [2])));
|
||
}else {_aa .Log .Error ("\u0043\u0061\u006c\u0047\u0072\u0061\u0079\u003a\u0020\u004d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0057\u0068\u0069\u0074\u0065\u0050\u006fi\u006e\u0074\u0020\u0028\u0052e\u0071\u0075i\u0072\u0065\u0064\u0029");};if _geca .BlackPoint !=nil {_eeaf .Set ("\u0042\u006c\u0061\u0063\u006b\u0050\u006f\u0069\u006e\u0074",_fg .MakeArray (_fg .MakeFloat (_geca .BlackPoint [0]),_fg .MakeFloat (_geca .BlackPoint [1]),_fg .MakeFloat (_geca .BlackPoint [2])));
|
||
};_eeaf .Set ("\u0047\u0061\u006dm\u0061",_fg .MakeFloat (_geca .Gamma ));_geef .Append (_eeaf );if _geca ._ffbdb !=nil {_geca ._ffbdb .PdfObject =_geef ;return _geca ._ffbdb ;};return _geef ;};
|
||
|
||
// ToPdfObject returns the PDF representation of the shading dictionary.
|
||
func (_ggbea *PdfShadingType3 )ToPdfObject ()_fg .PdfObject {_ggbea .PdfShading .ToPdfObject ();_febc ,_cccc :=_ggbea .getShadingDict ();if _cccc !=nil {_aa .Log .Error ("\u0055\u006ea\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0061\u0063\u0063\u0065\u0073\u0073\u0020\u0073\u0068\u0061\u0064\u0069\u006e\u0067\u0020di\u0063\u0074");
|
||
return nil ;};if _ggbea .Coords !=nil {_febc .Set ("\u0043\u006f\u006f\u0072\u0064\u0073",_ggbea .Coords );};if _ggbea .Domain !=nil {_febc .Set ("\u0044\u006f\u006d\u0061\u0069\u006e",_ggbea .Domain );};if _ggbea .Function !=nil {if len (_ggbea .Function )==1{_febc .Set ("\u0046\u0075\u006e\u0063\u0074\u0069\u006f\u006e",_ggbea .Function [0].ToPdfObject ());
|
||
}else {_aedff :=_fg .MakeArray ();for _ ,_dcfee :=range _ggbea .Function {_aedff .Append (_dcfee .ToPdfObject ());};_febc .Set ("\u0046\u0075\u006e\u0063\u0074\u0069\u006f\u006e",_aedff );};};if _ggbea .Extend !=nil {_febc .Set ("\u0045\u0078\u0074\u0065\u006e\u0064",_ggbea .Extend );
|
||
};return _ggbea ._cbabf ;};
|
||
|
||
// ReplacePage replaces the original page to a new page.
|
||
func (_agfdc *PdfAppender )ReplacePage (pageNum int ,page *PdfPage ){_gaab :=pageNum -1;for _edee :=range _agfdc ._agbg {if _edee ==_gaab {_fcba :=page .Duplicate ();_dgfg (_fcba );_agfdc ._agbg [_edee ]=_fcba ;};};};func (_abffaa *PdfWriter )setDocumentIDs (_ffefd ,_accfb string ){_abffaa ._dadgc =_fg .MakeArray (_fg .MakeHexString (_ffefd ),_fg .MakeHexString (_accfb ));
|
||
};
|
||
|
||
// ColorFromPdfObjects returns a new PdfColor based on the input slice of color
|
||
// component PDF objects.
|
||
func (_afbcc *PdfColorspaceICCBased )ColorFromPdfObjects (objects []_fg .PdfObject )(PdfColor ,error ){if _afbcc .Alternate ==nil {if _afbcc .N ==1{_defc :=NewPdfColorspaceDeviceGray ();return _defc .ColorFromPdfObjects (objects );}else if _afbcc .N ==3{_dccfg :=NewPdfColorspaceDeviceRGB ();
|
||
return _dccfg .ColorFromPdfObjects (objects );}else if _afbcc .N ==4{_gedf :=NewPdfColorspaceDeviceCMYK ();return _gedf .ColorFromPdfObjects (objects );}else {return nil ,_ce .New ("I\u0043\u0043\u0020\u0042\u0061\u0073\u0065\u0064\u0020\u0063\u006f\u006c\u006f\u0072\u0073\u0070\u0061\u0063e\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0061lt\u0065\u0072\u006ea\u0074i\u0076\u0065");
|
||
};};return _afbcc .Alternate .ColorFromPdfObjects (objects );};func (_eaafg Image )getBase ()_cc .ImageBase {return _cc .NewImageBase (int (_eaafg .Width ),int (_eaafg .Height ),int (_eaafg .BitsPerComponent ),_eaafg .ColorComponents ,_eaafg .Data ,_eaafg ._gccd ,_eaafg ._dbge );
|
||
};const (RC4_128bit =EncryptionAlgorithm (iota );AES_128bit ;AES_256bit ;);func (_cbfaf *pdfCIDFontType0 )getFontDescriptor ()*PdfFontDescriptor {return _cbfaf ._cdgef };
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_acfc *PdfAnnotationSquare )ToPdfObject ()_fg .PdfObject {_acfc .PdfAnnotation .ToPdfObject ();_abc :=_acfc ._agb ;_fba :=_abc .PdfObject .(*_fg .PdfObjectDictionary );if _acfc .PdfAnnotationMarkup !=nil {_acfc .PdfAnnotationMarkup .appendToPdfDictionary (_fba );
|
||
};_fba .SetIfNotNil ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u0053\u0071\u0075\u0061\u0072\u0065"));_fba .SetIfNotNil ("\u0042\u0053",_acfc .BS );_fba .SetIfNotNil ("\u0049\u0043",_acfc .IC );_fba .SetIfNotNil ("\u0042\u0045",_acfc .BE );
|
||
_fba .SetIfNotNil ("\u0052\u0044",_acfc .RD );return _abc ;};
|
||
|
||
// ColorFromFloats returns a new PdfColor based on the input slice of color
|
||
// components. The slice should contain a single element between 0 and 1.
|
||
func (_gfeb *PdfColorspaceDeviceGray )ColorFromFloats (vals []float64 )(PdfColor ,error ){if len (vals )!=1{return nil ,_ce .New ("r\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b");};_bege :=vals [0];if _bege < 0.0||_bege > 1.0{_aa .Log .Debug ("\u0049\u006eco\u006d\u0070\u0061t\u0069\u0062\u0069\u006city\u003a R\u0061\u006e\u0067\u0065\u0020\u006f\u0075ts\u0069\u0064\u0065\u0020\u005b\u0030\u002c1\u005d");
|
||
};if _bege < 0.0{_bege =0.0;}else if _bege > 1.0{_bege =1.0;};return NewPdfColorDeviceGray (_bege ),nil ;};func _fedacb (_fafde []byte )[]byte {const _deabe =52845;const _gebg =22719;_bdea :=55665;for _ ,_ecacea :=range _fafde [:4]{_bdea =(int (_ecacea )+_bdea )*_deabe +_gebg ;
|
||
};_gaed :=make ([]byte ,len (_fafde )-4);for _ddfac ,_cbaae :=range _fafde [4:]{_gaed [_ddfac ]=byte (int (_cbaae )^_bdea >>8);_bdea =(int (_cbaae )+_bdea )*_deabe +_gebg ;};return _gaed ;};func (_cagd *PdfReader )newPdfAnnotationMovieFromDict (_cec *_fg .PdfObjectDictionary )(*PdfAnnotationMovie ,error ){_fcee :=PdfAnnotationMovie {};
|
||
_fcee .T =_cec .Get ("\u0054");_fcee .Movie =_cec .Get ("\u004d\u006f\u0076i\u0065");_fcee .A =_cec .Get ("\u0041");return &_fcee ,nil ;};
|
||
|
||
// NewPdfActionSubmitForm returns a new "submit form" action.
|
||
func NewPdfActionSubmitForm ()*PdfActionSubmitForm {_bggc :=NewPdfAction ();_eea :=&PdfActionSubmitForm {};_eea .PdfAction =_bggc ;_bggc .SetContext (_eea );return _eea ;};
|
||
|
||
// NewOutlineDest returns a new outline destination which can be used
|
||
// with outline items.
|
||
func NewOutlineDest (page int64 ,x ,y float64 )OutlineDest {return OutlineDest {Page :page ,Mode :"\u0058\u0059\u005a",X :x ,Y :y };};
|
||
|
||
// OutlineDest represents the destination of an outline item.
|
||
// It holds the page and the position on the page an outline item points to.
|
||
type OutlineDest struct{PageObj *_fg .PdfIndirectObject `json:"-"`;Page int64 `json:"page"`;Mode string `json:"mode"`;X float64 `json:"x"`;Y float64 `json:"y"`;Zoom float64 `json:"zoom"`;};
|
||
|
||
// BorderStyle defines border type, typically used for annotations.
|
||
type BorderStyle int ;
|
||
|
||
// SetFlag sets the flag for the field.
|
||
func (_feca *PdfField )SetFlag (flag FieldFlag ){_feca .Ff =_fg .MakeInteger (int64 (flag ))};
|
||
|
||
// PdfAnnotationFileAttachment represents FileAttachment annotations.
|
||
// (Section 12.5.6.15).
|
||
type PdfAnnotationFileAttachment struct{*PdfAnnotation ;*PdfAnnotationMarkup ;FS _fg .PdfObject ;Name _fg .PdfObject ;};
|
||
|
||
// ToPdfObject implements interface PdfModel.
|
||
func (_abfb *PdfAnnotationPolygon )ToPdfObject ()_fg .PdfObject {_abfb .PdfAnnotation .ToPdfObject ();_acggc :=_abfb ._agb ;_ddbe :=_acggc .PdfObject .(*_fg .PdfObjectDictionary );_abfb .PdfAnnotationMarkup .appendToPdfDictionary (_ddbe );_ddbe .SetIfNotNil ("\u0053u\u0062\u0074\u0079\u0070\u0065",_fg .MakeName ("\u0050o\u006c\u0079\u0067\u006f\u006e"));
|
||
_ddbe .SetIfNotNil ("\u0056\u0065\u0072\u0074\u0069\u0063\u0065\u0073",_abfb .Vertices );_ddbe .SetIfNotNil ("\u004c\u0045",_abfb .LE );_ddbe .SetIfNotNil ("\u0042\u0053",_abfb .BS );_ddbe .SetIfNotNil ("\u0049\u0043",_abfb .IC );_ddbe .SetIfNotNil ("\u0042\u0045",_abfb .BE );
|
||
_ddbe .SetIfNotNil ("\u0049\u0054",_abfb .IT );_ddbe .SetIfNotNil ("\u004de\u0061\u0073\u0075\u0072\u0065",_abfb .Measure );return _acggc ;};
|
||
|
||
// PdfOutputIntent provides a means for matching the color characteristics of a PDF document with
|
||
// those of a target output device.
|
||
// Multiple PdfOutputIntents allows the production process to be customized to the expected workflow and the specific
|
||
// tools available.
|
||
type PdfOutputIntent struct{
|
||
|
||
// Type is an optional PDF object that this dictionary describes.
|
||
// If present, must be OutputIntent for an output intent dictionary.
|
||
Type string ;
|
||
|
||
// S defines the OutputIntent subtype which should match the standard used in given document i.e:
|
||
// for PDF/X use PdfOutputIntentTypeX.
|
||
S PdfOutputIntentType ;
|
||
|
||
// OutputCondition is an optional field that is identifying the intended output device or production condition in
|
||
// human-readable form. This is preferred method of defining such a string for presentation to the user.
|
||
OutputCondition string ;
|
||
|
||
// OutputConditionIdentifier is a required field identifying the intended output device or production condition in
|
||
// human or machine-readable form. If human-readable, this string may be used
|
||
// in lieu of an OutputCondition for presentation to the user.
|
||
// A typical value for this entry would be the name of a production condition maintained
|
||
// in an industry-standard registry such as the ICC Characterization Data Registry
|
||
// If the intended production condition is not a recognized standard, the value Custom is recommended for this entry.
|
||
// the DestOutputProfile entry defines the ICC profile, and the Info entry is used for further
|
||
// human-readable identification.
|
||
OutputConditionIdentifier string ;
|
||
|
||
// RegistryName is an optional string field (conventionally URI) identifying the registry in which the condition
|
||
// designated by OutputConditionIdentifier is defined.
|
||
RegistryName string ;
|
||
|
||
// Info is a required field if OutputConditionIdentifier does not specify a standard production condition.
|
||
// A human-readable text string containing additional information or comments about intended
|
||
// target device or production condition.
|
||
Info string ;
|
||
|
||
// DestOutputProfile is required if OutputConditionIdentifier does not specify a standard production condition.
|
||
// It is an ICC profile stream defining the transformation from the PDF document's source colors to output device colorants.
|
||
DestOutputProfile []byte ;
|
||
|
||
// ColorComponents is the number of color components supported by given output profile.
|
||
ColorComponents int ;_geaa *_fg .PdfObjectDictionary ;};
|
||
|
||
// NewPdfColorspaceDeviceRGB returns a new RGB colorspace object.
|
||
func NewPdfColorspaceDeviceRGB ()*PdfColorspaceDeviceRGB {return &PdfColorspaceDeviceRGB {}};
|
||
|
||
// GetPageLabels returns the PageLabels entry in the PDF catalog.
|
||
// See section 12.4.2 "Page Labels" (p. 382 PDF32000_2008).
|
||
func (_gedaf *PdfReader )GetPageLabels ()(_fg .PdfObject ,error ){_fbgfcf :=_fg .ResolveReference (_gedaf ._cgegd .Get ("\u0050\u0061\u0067\u0065\u004c\u0061\u0062\u0065\u006c\u0073"));if _fbgfcf ==nil {return nil ,nil ;};if !_gedaf ._beegg {_beafb :=_gedaf .traverseObjectData (_fbgfcf );
|
||
if _beafb !=nil {return nil ,_beafb ;};};return _fbgfcf ,nil ;};
|
||
|
||
// ToPdfObject returns colorspace in a PDF object format [name stream]
|
||
func (_eebg *PdfColorspaceICCBased )ToPdfObject ()_fg .PdfObject {_eadff :=&_fg .PdfObjectArray {};_eadff .Append (_fg .MakeName ("\u0049\u0043\u0043\u0042\u0061\u0073\u0065\u0064"));var _cgfcf *_fg .PdfObjectStream ;if _eebg ._cebf !=nil {_cgfcf =_eebg ._cebf ;
|
||
}else {_cgfcf =&_fg .PdfObjectStream {};};_egge :=_fg .MakeDict ();_egge .Set ("\u004e",_fg .MakeInteger (int64 (_eebg .N )));if _eebg .Alternate !=nil {_egge .Set ("\u0041l\u0074\u0065\u0072\u006e\u0061\u0074e",_eebg .Alternate .ToPdfObject ());};if _eebg .Metadata !=nil {_egge .Set ("\u004d\u0065\u0074\u0061\u0064\u0061\u0074\u0061",_eebg .Metadata );
|
||
};if _eebg .Range !=nil {var _eggf []_fg .PdfObject ;for _ ,_bbcd :=range _eebg .Range {_eggf =append (_eggf ,_fg .MakeFloat (_bbcd ));};_egge .Set ("\u0052\u0061\u006eg\u0065",_fg .MakeArray (_eggf ...));};_egge .Set ("\u004c\u0065\u006e\u0067\u0074\u0068",_fg .MakeInteger (int64 (len (_eebg .Data ))));
|
||
_cgfcf .Stream =_eebg .Data ;_cgfcf .PdfObjectDictionary =_egge ;_eadff .Append (_cgfcf );if _eebg ._dgca !=nil {_eebg ._dgca .PdfObject =_eadff ;return _eebg ._dgca ;};return _eadff ;};
|
||
|
||
// ImageToRGB converts Lab colorspace image to RGB and returns the result.
|
||
func (_afba *PdfColorspaceLab )ImageToRGB (img Image )(Image ,error ){_gebeg :=func (_eae float64 )float64 {if _eae >=6.0/29{return _eae *_eae *_eae ;};return 108.0/841*(_eae -4.0/29.0);};_bbccg :=img ._dbge ;if len (_bbccg )!=6{_aa .Log .Trace ("\u0049\u006d\u0061\u0067\u0065\u0020\u002d\u0020\u004c\u0061\u0062\u0020\u0044e\u0063\u006f\u0064\u0065\u0020\u0072\u0061\u006e\u0067e\u0020\u0021\u003d\u0020\u0036\u002e\u002e\u002e\u0020\u0075\u0073\u0065\u0020\u005b0\u0020\u0031\u0030\u0030\u0020\u0061\u006d\u0069\u006e\u0020\u0061\u006d\u0061\u0078\u0020\u0062\u006d\u0069\u006e\u0020\u0062\u006d\u0061\u0078\u005d\u0020\u0064\u0065\u0066\u0061u\u006c\u0074\u0020\u0064\u0065\u0063\u006f\u0064\u0065 \u0061\u0072r\u0061\u0079");
|
||
_bbccg =_afba .DecodeArray ();};_gdcf :=_ade .NewReader (img .getBase ());_gfgg :=_cc .NewImageBase (int (img .Width ),int (img .Height ),int (img .BitsPerComponent ),3,nil ,img ._gccd ,img ._dbge );_cggc :=_ade .NewWriter (_gfgg );_cgcf :=_ef .Pow (2,float64 (img .BitsPerComponent ))-1;
|
||
_eded :=make ([]uint32 ,3);var (_gcdfa error ;Ls ,As ,Bs ,L ,M ,N ,X ,Y ,Z ,_cgfcd ,_agga ,_ebgg float64 ;);for {_gcdfa =_gdcf .ReadSamples (_eded );if _gcdfa ==_ff .EOF {break ;}else if _gcdfa !=nil {return img ,_gcdfa ;};Ls =float64 (_eded [0])/_cgcf ;
|
||
As =float64 (_eded [1])/_cgcf ;Bs =float64 (_eded [2])/_cgcf ;Ls =_cc .LinearInterpolate (Ls ,0.0,1.0,_bbccg [0],_bbccg [1]);As =_cc .LinearInterpolate (As ,0.0,1.0,_bbccg [2],_bbccg [3]);Bs =_cc .LinearInterpolate (Bs ,0.0,1.0,_bbccg [4],_bbccg [5]);L =(Ls +16)/116+As /500;
|
||
M =(Ls +16)/116;N =(Ls +16)/116-Bs /200;X =_afba .WhitePoint [0]*_gebeg (L );Y =_afba .WhitePoint [1]*_gebeg (M );Z =_afba .WhitePoint [2]*_gebeg (N );_cgfcd =3.240479*X +-1.537150*Y +-0.498535*Z ;_agga =-0.969256*X +1.875992*Y +0.041556*Z ;_ebgg =0.055648*X +-0.204043*Y +1.057311*Z ;
|
||
_cgfcd =_ef .Min (_ef .Max (_cgfcd ,0),1.0);_agga =_ef .Min (_ef .Max (_agga ,0),1.0);_ebgg =_ef .Min (_ef .Max (_ebgg ,0),1.0);_eded [0]=uint32 (_cgfcd *_cgcf );_eded [1]=uint32 (_agga *_cgcf );_eded [2]=uint32 (_ebgg *_cgcf );if _gcdfa =_cggc .WriteSamples (_eded );
|
||
_gcdfa !=nil {return img ,_gcdfa ;};};return _adad (&_gfgg ),nil ;};
|
||
|
||
// ImageToRGB convert 1-component grayscale data to 3-component RGB.
|
||
func (_bcbe *PdfColorspaceDeviceGray )ImageToRGB (img Image )(Image ,error ){if img .ColorComponents !=1{return img ,_ce .New ("\u0074\u0068e \u0070\u0072\u006fv\u0069\u0064\u0065\u0064 im\u0061ge\u0020\u0069\u0073\u0020\u006e\u006f\u0074 g\u0072\u0061\u0079\u0020\u0073\u0063\u0061l\u0065");
|
||
};_aacd ,_aced :=_cc .NewImage (int (img .Width ),int (img .Height ),int (img .BitsPerComponent ),img .ColorComponents ,img .Data ,img ._gccd ,img ._dbge );if _aced !=nil {return img ,_aced ;};_aebb ,_aced :=_cc .NRGBAConverter .Convert (_aacd );if _aced !=nil {return img ,_aced ;
|
||
};_bcbac :=_adad (_aebb .Base ());_aa .Log .Trace ("\u0044\u0065\u0076\u0069\u0063\u0065\u0047\u0072\u0061\u0079\u0020\u002d>\u0020\u0052\u0047\u0042");_aa .Log .Trace ("s\u0061\u006d\u0070\u006c\u0065\u0073\u003a\u0020\u0025\u0076",img .Data );_aa .Log .Trace ("\u0052G\u0042 \u0073\u0061\u006d\u0070\u006c\u0065\u0073\u003a\u0020\u0025\u0076",_bcbac .Data );
|
||
_aa .Log .Trace ("\u0025\u0076\u0020\u002d\u003e\u0020\u0025\u0076",img ,_bcbac );return _bcbac ,nil ;};var _aeagc =map[string ]string {"\u0053\u0079\u006d\u0062\u006f\u006c":"\u0053\u0079\u006d\u0062\u006f\u006c\u0045\u006e\u0063o\u0064\u0069\u006e\u0067","\u005a\u0061\u0070f\u0044\u0069\u006e\u0067\u0062\u0061\u0074\u0073":"Z\u0061p\u0066\u0044\u0069\u006e\u0067\u0062\u0061\u0074s\u0045\u006e\u0063\u006fdi\u006e\u0067"};
|
||
|
||
|
||
// ConvertToBinary converts current image into binary (bi-level) format.
|
||
// Binary images are composed of single bits per pixel (only black or white).
|
||
// If provided image has more color components, then it would be converted into binary image using
|
||
// histogram auto threshold function.
|
||
func (_bbcdg *Image )ConvertToBinary ()error {if _bbcdg .ColorComponents ==1&&_bbcdg .BitsPerComponent ==1{return nil ;};_cafaf ,_eefdc :=_bbcdg .ToGoImage ();if _eefdc !=nil {return _eefdc ;};_bacge ,_eefdc :=_cc .MonochromeConverter .Convert (_cafaf );
|
||
if _eefdc !=nil {return _eefdc ;};_bbcdg .Data =_bacge .Base ().Data ;_bbcdg ._gccd ,_eefdc =_cc .ScaleAlphaToMonochrome (_bbcdg ._gccd ,int (_bbcdg .Width ),int (_bbcdg .Height ));if _eefdc !=nil {return _eefdc ;};_bbcdg .BitsPerComponent =1;_bbcdg .ColorComponents =1;
|
||
_bbcdg ._dbge =nil ;return nil ;};
|
||
|
||
// Decrypt decrypts the PDF file with a specified password. Also tries to
|
||
// decrypt with an empty password. Returns true if successful,
|
||
// false otherwise.
|
||
func (_bfdc *PdfReader )Decrypt (password []byte )(bool ,error ){_bcagc ,_gaffa :=_bfdc ._ccgg .Decrypt (password );if _gaffa !=nil {return false ,_gaffa ;};if !_bcagc {return false ,nil ;};_gaffa =_bfdc .loadStructure ();if _gaffa !=nil {_aa .Log .Debug ("\u0045\u0052\u0052OR\u003a\u0020\u0046\u0061\u0069\u006c\u0020\u0074\u006f \u006co\u0061d\u0020s\u0074\u0072\u0075\u0063\u0074\u0075\u0072\u0065\u0020\u0028\u0025\u0073\u0029",_gaffa );
|
||
return false ,_gaffa ;};return true ,nil ;};
|
||
|
||
// NewPdfAnnotation returns an initialized generic PDF annotation model.
|
||
func NewPdfAnnotation ()*PdfAnnotation {_badf :=&PdfAnnotation {};_badf ._agb =_fg .MakeIndirectObject (_fg .MakeDict ());return _badf ;};
|
||
|
||
// PdfAnnotationRichMedia represents Rich Media annotations.
|
||
type PdfAnnotationRichMedia struct{*PdfAnnotation ;RichMediaSettings _fg .PdfObject ;RichMediaContent _fg .PdfObject ;};func (_ddecg *pdfFontSimple )updateStandard14Font (){_cgad ,_gdacf :=_ddecg .Encoder ().(_dg .SimpleEncoder );if !_gdacf {_aa .Log .Error ("\u0057\u0072\u006f\u006e\u0067\u0020\u0065\u006e\u0063\u006f\u0064\u0065\u0072\u0020\u0074y\u0070e\u003a\u0020\u0025\u0054\u002e\u0020\u0066\u006f\u006e\u0074\u003d\u0025\u0073\u002e",_ddecg .Encoder (),_ddecg );
|
||
return ;};_afgce :=_cgad .Charcodes ();_ddecg ._fcgbd =make (map[_dg .CharCode ]float64 ,len (_afgce ));for _ ,_edfdf :=range _afgce {_becdf ,_ :=_cgad .CharcodeToRune (_edfdf );_dggaf ,_ :=_ddecg ._dacg .Read (_becdf );_ddecg ._fcgbd [_edfdf ]=_dggaf .Wx ;
|
||
};};
|
||
|
||
// ColorToRGB converts a ICCBased color to an RGB color.
|
||
func (_cfff *PdfColorspaceICCBased )ColorToRGB (color PdfColor )(PdfColor ,error ){if _cfff .Alternate ==nil {_aa .Log .Debug ("I\u0043\u0043\u0020\u0042\u0061\u0073\u0065\u0064\u0020\u0063\u006f\u006c\u006f\u0072\u0073\u0070\u0061\u0063e\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0061lt\u0065\u0072\u006ea\u0074i\u0076\u0065");
|
||
if _cfff .N ==1{_aa .Log .Debug ("\u0049\u0043\u0043\u0020\u0042a\u0073\u0065\u0064\u0020\u0063o\u006co\u0072\u0073\u0070\u0061\u0063\u0065\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0061\u006c\u0074\u0065r\u006e\u0061\u0074\u0069\u0076\u0065\u0020\u002d\u0020\u0075\u0073\u0069\u006e\u0067\u0020\u0044\u0065\u0076\u0069\u0063\u0065\u0047\u0072\u0061y\u0020\u0028\u004e\u003d\u0031\u0029");
|
||
_ecfa :=NewPdfColorspaceDeviceGray ();return _ecfa .ColorToRGB (color );}else if _cfff .N ==3{_aa .Log .Debug ("\u0049\u0043\u0043\u0020\u0042\u0061\u0073\u0065\u0064\u0020\u0063\u006f\u006c\u006f\u0072\u0073\u0070a\u0063\u0065\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067 \u0061\u006c\u0074\u0065\u0072\u006e\u0061\u0074\u0069\u0076\u0065\u0020\u002d\u0020\u0075\u0073\u0069\u006eg\u0020\u0044\u0065\u0076\u0069\u0063e\u0052\u0047B\u0020\u0028N\u003d3\u0029");
|
||
return color ,nil ;}else if _cfff .N ==4{_aa .Log .Debug ("\u0049\u0043\u0043\u0020\u0042a\u0073\u0065\u0064\u0020\u0063o\u006co\u0072\u0073\u0070\u0061\u0063\u0065\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0061\u006c\u0074\u0065r\u006e\u0061\u0074\u0069\u0076\u0065\u0020\u002d\u0020\u0075\u0073\u0069\u006e\u0067\u0020\u0044\u0065\u0076\u0069\u0063\u0065\u0043\u004d\u0059K\u0020\u0028\u004e\u003d\u0034\u0029");
|
||
_abeg :=NewPdfColorspaceDeviceCMYK ();return _abeg .ColorToRGB (color );}else {return nil ,_ce .New ("I\u0043\u0043\u0020\u0042\u0061\u0073\u0065\u0064\u0020\u0063\u006f\u006c\u006f\u0072\u0073\u0070\u0061\u0063e\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0061lt\u0065\u0072\u006ea\u0074i\u0076\u0065");
|
||
};};_aa .Log .Trace ("\u0049\u0043\u0043 \u0042\u0061\u0073\u0065\u0064\u0020\u0063\u006f\u006c\u006f\u0072\u0073\u0070\u0061\u0063\u0065\u0020\u0077\u0069\u0074\u0068\u0020\u0061\u006c\u0074\u0065\u0072\u006e\u0061t\u0069\u0076\u0065\u003a\u0020\u0025\u0023\u0076",_cfff );
|
||
return _cfff .Alternate .ColorToRGB (color );};func _ebff (_bccg *_fg .PdfObjectDictionary ,_bcegg *fontCommon )(*pdfCIDFontType0 ,error ){if _bcegg ._ggcfc !="\u0043\u0049\u0044F\u006f\u006e\u0074\u0054\u0079\u0070\u0065\u0030"{_aa .Log .Debug ("\u0045R\u0052\u004fR\u003a\u0020\u0046\u006fn\u0074\u0020\u0053u\u0062\u0054\u0079\u0070\u0065\u0020\u0021\u003d\u0020CI\u0044\u0046\u006fn\u0074\u0054y\u0070\u0065\u0030\u002e\u0020\u0066o\u006e\u0074=\u0025\u0073",_bcegg );
|
||
return nil ,_fg .ErrRangeError ;};_cgeg :=_bcdga (_bcegg );_bdbgb ,_caee :=_fg .GetDict (_bccg .Get ("\u0043\u0049\u0044\u0053\u0079\u0073\u0074\u0065\u006d\u0049\u006e\u0066\u006f"));if !_caee {_aa .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0043I\u0044\u0053\u0079st\u0065\u006d\u0049\u006e\u0066\u006f \u0028\u0052\u0065\u0071\u0075\u0069\u0072\u0065\u0064\u0029\u0020\u006d\u0069\u0073\u0073i\u006e\u0067\u002e\u0020\u0066\u006f\u006e\u0074=\u0025\u0073",_bcegg );
|
||
return nil ,ErrRequiredAttributeMissing ;};_cgeg .CIDSystemInfo =_bdbgb ;_cgeg .DW =_bccg .Get ("\u0044\u0057");_cgeg .W =_bccg .Get ("\u0057");_cgeg .DW2 =_bccg .Get ("\u0044\u0057\u0032");_cgeg .W2 =_bccg .Get ("\u0057\u0032");_cgeg ._cgda =1000.0;if _cacdb ,_eagdc :=_fg .GetNumberAsFloat (_cgeg .DW );
|
||
_eagdc ==nil {_cgeg ._cgda =_cacdb ;};_gaagg ,_aecac :=_bcabg (_cgeg .W );if _aecac !=nil {return nil ,_aecac ;};if _gaagg ==nil {_gaagg =map[_dg .CharCode ]float64 {};};_cgeg ._fceed =_gaagg ;return _cgeg ,nil ;};const (ActionTypeGoTo PdfActionType ="\u0047\u006f\u0054\u006f";
|
||
ActionTypeGoTo3DView PdfActionType ="\u0047\u006f\u0054\u006f\u0033\u0044\u0056\u0069\u0065\u0077";ActionTypeGoToE PdfActionType ="\u0047\u006f\u0054o\u0045";ActionTypeGoToR PdfActionType ="\u0047\u006f\u0054o\u0052";ActionTypeHide PdfActionType ="\u0048\u0069\u0064\u0065";
|
||
ActionTypeImportData PdfActionType ="\u0049\u006d\u0070\u006f\u0072\u0074\u0044\u0061\u0074\u0061";ActionTypeJavaScript PdfActionType ="\u004a\u0061\u0076\u0061\u0053\u0063\u0072\u0069\u0070\u0074";ActionTypeLaunch PdfActionType ="\u004c\u0061\u0075\u006e\u0063\u0068";
|
||
ActionTypeMovie PdfActionType ="\u004d\u006f\u0076i\u0065";ActionTypeNamed PdfActionType ="\u004e\u0061\u006de\u0064";ActionTypeRendition PdfActionType ="\u0052e\u006e\u0064\u0069\u0074\u0069\u006fn";ActionTypeResetForm PdfActionType ="\u0052e\u0073\u0065\u0074\u0046\u006f\u0072m";
|
||
ActionTypeSetOCGState PdfActionType ="S\u0065\u0074\u004f\u0043\u0047\u0053\u0074\u0061\u0074\u0065";ActionTypeSound PdfActionType ="\u0053\u006f\u0075n\u0064";ActionTypeSubmitForm PdfActionType ="\u0053\u0075\u0062\u006d\u0069\u0074\u0046\u006f\u0072\u006d";
|
||
ActionTypeThread PdfActionType ="\u0054\u0068\u0072\u0065\u0061\u0064";ActionTypeTrans PdfActionType ="\u0054\u0072\u0061n\u0073";ActionTypeURI PdfActionType ="\u0055\u0052\u0049";);
|
||
|
||
// ToInteger convert to an integer format.
|
||
func (_dcbfb *PdfColorLab )ToInteger (bits int )[3]uint32 {_bgeg :=_ef .Pow (2,float64 (bits ))-1;return [3]uint32 {uint32 (_bgeg *_dcbfb .L ()),uint32 (_bgeg *_dcbfb .A ()),uint32 (_bgeg *_dcbfb .B ())};};
|
||
|
||
// NewPdfOutlineItem returns an initialized PdfOutlineItem.
|
||
func NewPdfOutlineItem ()*PdfOutlineItem {_ccefb :=&PdfOutlineItem {_aeadb :_fg .MakeIndirectObject (_fg .MakeDict ())};_ccefb ._gfcge =_ccefb ;return _ccefb ;};
|
||
|
||
// PdfAnnotationSound represents Sound annotations.
|
||
// (Section 12.5.6.16).
|
||
type PdfAnnotationSound struct{*PdfAnnotation ;*PdfAnnotationMarkup ;Sound _fg .PdfObject ;Name _fg .PdfObject ;};
|
||
|
||
// CustomKeys returns all custom info keys as list.
|
||
func (_eedbb *PdfInfo )CustomKeys ()[]string {if _eedbb ._aaee ==nil {return nil ;};_ffgg :=make ([]string ,len (_eedbb ._aaee .Keys ()));for _ ,_abge :=range _eedbb ._aaee .Keys (){_ffgg =append (_ffgg ,_abge .String ());};return _ffgg ;};
|
||
|
||
// NewPdfAnnotationHighlight returns a new text highlight annotation.
|
||
func NewPdfAnnotationHighlight ()*PdfAnnotationHighlight {_ggfb :=NewPdfAnnotation ();_ecac :=&PdfAnnotationHighlight {};_ecac .PdfAnnotation =_ggfb ;_ecac .PdfAnnotationMarkup =&PdfAnnotationMarkup {};_ggfb .SetContext (_ecac );return _ecac ;};func _bdfge ()string {_baacg .Lock ();
|
||
defer _baacg .Unlock ();return _ebfgc };
|
||
|
||
// SetDate sets the `M` field of the signature.
|
||
func (_cdcbga *PdfSignature )SetDate (date _g .Time ,format string ){if format ==""{format ="\u0044\u003a\u003200\u0036\u0030\u0031\u0030\u0032\u0031\u0035\u0030\u0034\u0030\u0035\u002d\u0030\u0037\u0027\u0030\u0030\u0027";};_cdcbga .M =_fg .MakeString (date .Format (format ));
|
||
};
|
||
|
||
// NewXObjectFormFromStream builds the Form XObject from a stream object.
|
||
// TODO: Should this be exposed? Consider different access points.
|
||
func NewXObjectFormFromStream (stream *_fg .PdfObjectStream )(*XObjectForm ,error ){_dabddb :=&XObjectForm {};_dabddb ._bdage =stream ;_acegff :=*(stream .PdfObjectDictionary );_dffg ,_ggfcd :=_fg .NewEncoderFromStream (stream );if _ggfcd !=nil {return nil ,_ggfcd ;
|
||
};_dabddb .Filter =_dffg ;if _ceadb :=_acegff .Get ("\u0053u\u0062\u0074\u0079\u0070\u0065");_ceadb !=nil {_eedc ,_eeeac :=_ceadb .(*_fg .PdfObjectName );if !_eeeac {return nil ,_ce .New ("\u0074\u0079\u0070\u0065\u0020\u0065\u0072\u0072\u006f\u0072");
|
||
};if *_eedc !="\u0046\u006f\u0072\u006d"{_aa .Log .Debug ("I\u006ev\u0061\u006c\u0069\u0064\u0020\u0066\u006f\u0072m\u0020\u0073\u0075\u0062ty\u0070\u0065");return nil ,_ce .New ("i\u006ev\u0061\u006c\u0069\u0064\u0020\u0066\u006f\u0072m\u0020\u0073\u0075\u0062ty\u0070\u0065");
|
||
};};if _fegcg :=_acegff .Get ("\u0046\u006f\u0072\u006d\u0054\u0079\u0070\u0065");_fegcg !=nil {_dabddb .FormType =_fegcg ;};if _edddg :=_acegff .Get ("\u0042\u0042\u006f\u0078");_edddg !=nil {_dabddb .BBox =_edddg ;};if _bcfac :=_acegff .Get ("\u004d\u0061\u0074\u0072\u0069\u0078");
|
||
_bcfac !=nil {_dabddb .Matrix =_bcfac ;};if _bcebe :=_acegff .Get ("\u0052e\u0073\u006f\u0075\u0072\u0063\u0065s");_bcebe !=nil {_bcebe =_fg .TraceToDirectObject (_bcebe );_bddbc ,_aeegb :=_bcebe .(*_fg .PdfObjectDictionary );if !_aeegb {_aa .Log .Debug ("\u0049\u006e\u0076\u0061\u006ci\u0064\u0020\u0058\u004f\u0062j\u0065c\u0074\u0020\u0046\u006f\u0072\u006d\u0020\u0052\u0065\u0073\u006f\u0075\u0072\u0063\u0065\u0073\u0020\u006f\u0062j\u0065\u0063\u0074\u002c\u0020\u0070\u006f\u0069\u006e\u0074\u0069\u006e\u0067\u0020\u0074\u006f\u0020\u006e\u006f\u006e\u002d\u0064\u0069\u0063t\u0069\u006f\u006e\u0061\u0072\u0079");
|
||
return nil ,_fg .ErrTypeError ;};_befaf ,_becbb :=NewPdfPageResourcesFromDict (_bddbc );if _becbb !=nil {_aa .Log .Debug ("\u0046\u0061i\u006c\u0065\u0064\u0020\u0067\u0065\u0074\u0074\u0069\u006e\u0067\u0020\u0066\u006f\u0072\u006d\u0020\u0072\u0065\u0073\u006f\u0075rc\u0065\u0073");
|
||
return nil ,_becbb ;};_dabddb .Resources =_befaf ;_aa .Log .Trace ("\u0046\u006f\u0072\u006d r\u0065\u0073\u006f\u0075\u0072\u0063\u0065\u0073\u003a\u0020\u0025\u0023\u0076",_dabddb .Resources );};_dabddb .Group =_acegff .Get ("\u0047\u0072\u006fu\u0070");
|
||
_dabddb .Ref =_acegff .Get ("\u0052\u0065\u0066");_dabddb .MetaData =_acegff .Get ("\u004d\u0065\u0074\u0061\u0044\u0061\u0074\u0061");_dabddb .PieceInfo =_acegff .Get ("\u0050i\u0065\u0063\u0065\u0049\u006e\u0066o");_dabddb .LastModified =_acegff .Get ("\u004c\u0061\u0073t\u004d\u006f\u0064\u0069\u0066\u0069\u0065\u0064");
|
||
_dabddb .StructParent =_acegff .Get ("\u0053\u0074\u0072u\u0063\u0074\u0050\u0061\u0072\u0065\u006e\u0074");_dabddb .StructParents =_acegff .Get ("\u0053\u0074\u0072\u0075\u0063\u0074\u0050\u0061\u0072\u0065\u006e\u0074\u0073");_dabddb .OPI =_acegff .Get ("\u004f\u0050\u0049");
|
||
_dabddb .OC =_acegff .Get ("\u004f\u0043");_dabddb .Name =_acegff .Get ("\u004e\u0061\u006d\u0065");_dabddb .Stream =stream .Stream ;return _dabddb ,nil ;}; |