github.com/unidoc/unipdf/v3@v3.55.0/core/core.go (about) 1 // 2 // Copyright 2020 FoxyUtils ehf. All rights reserved. 3 // 4 // This is a commercial product and requires a license to operate. 5 // A trial license can be obtained at https://unidoc.io 6 // 7 // DO NOT EDIT: generated by unitwist Go source code obfuscator. 8 // 9 // Use of this source code is governed by the UniDoc End User License Agreement 10 // terms that can be accessed at https://unidoc.io/eula/ 11 12 // Package core defines and implements the primitive PDF object types in golang, and provides functionality 13 // for parsing those from a PDF file stream. This includes I/O handling, cross references, repairs, encryption, 14 // encoding and other core capabilities. 15 package core ;import (_fd "bufio";_d "bytes";_ag "compress/lzw";_ecd "compress/zlib";_fff "crypto/md5";_fc "crypto/rand";_ac "encoding/hex";_a "errors";_ea "fmt";_df "github.com/unidoc/unipdf/v3/common";_gb "github.com/unidoc/unipdf/v3/core/security";_gc "github.com/unidoc/unipdf/v3/core/security/crypt"; 16 _dc "github.com/unidoc/unipdf/v3/internal/ccittfax";_cf "github.com/unidoc/unipdf/v3/internal/imageutil";_db "github.com/unidoc/unipdf/v3/internal/jbig2";_dg "github.com/unidoc/unipdf/v3/internal/jbig2/bitmap";_gg "github.com/unidoc/unipdf/v3/internal/jbig2/decoder"; 17 _ecdf "github.com/unidoc/unipdf/v3/internal/jbig2/document";_dd "github.com/unidoc/unipdf/v3/internal/jbig2/errors";_gf "github.com/unidoc/unipdf/v3/internal/strutils";_cd "golang.org/x/image/tiff/lzw";_aa "golang.org/x/xerrors";_ff "image";_fe "image/color"; 18 _bg "image/jpeg";_gd "io";_bc "io/ioutil";_e "reflect";_f "regexp";_g "sort";_be "strconv";_cb "strings";_c "sync";_eca "time";_ec "unicode";); 19 20 // PdfIndirectObject represents the primitive PDF indirect object. 21 type PdfIndirectObject struct{PdfObjectReference ;PdfObject ;};const (_ega =0;_bgec =1;_dace =2;_bfc =3;_agce =4;);const _gfb ="\u0053\u0074\u0064C\u0046";func (_dbcaa *JBIG2Image )toBitmap ()(_cgfe *_dg .Bitmap ,_egc error ){const _aea ="\u004a\u0042\u0049\u00472I\u006d\u0061\u0067\u0065\u002e\u0074\u006f\u0042\u0069\u0074\u006d\u0061\u0070"; 22 if _dbcaa .Data ==nil {return nil ,_dd .Error (_aea ,"\u0069\u006d\u0061\u0067e \u0064\u0061\u0074\u0061\u0020\u006e\u006f\u0074\u0020\u0064\u0065\u0066\u0069\u006ee\u0064");};if _dbcaa .Width ==0||_dbcaa .Height ==0{return nil ,_dd .Error (_aea ,"\u0069\u006d\u0061\u0067\u0065\u0020h\u0065\u0069\u0067\u0068\u0074\u0020\u006f\u0072\u0020\u0077\u0069\u0064\u0074h\u0020\u006e\u006f\u0074\u0020\u0064\u0065f\u0069\u006e\u0065\u0064"); 23 };if _dbcaa .HasPadding {_cgfe ,_egc =_dg .NewWithData (_dbcaa .Width ,_dbcaa .Height ,_dbcaa .Data );}else {_cgfe ,_egc =_dg .NewWithUnpaddedData (_dbcaa .Width ,_dbcaa .Height ,_dbcaa .Data );};if _egc !=nil {return nil ,_dd .Wrap (_egc ,_aea ,"");}; 24 return _cgfe ,nil ;}; 25 26 // NewASCIIHexEncoder makes a new ASCII hex encoder. 27 func NewASCIIHexEncoder ()*ASCIIHexEncoder {_egab :=&ASCIIHexEncoder {};return _egab }; 28 29 // Resolve resolves a PdfObject to direct object, looking up and resolving references as needed (unlike TraceToDirect). 30 func (_ged *PdfParser )Resolve (obj PdfObject )(PdfObject ,error ){_bac ,_dbc :=obj .(*PdfObjectReference );if !_dbc {return obj ,nil ;};_egb :=_ged .GetFileOffset ();defer func (){_ged .SetFileOffset (_egb )}();_gcf ,_deef :=_ged .LookupByReference (*_bac ); 31 if _deef !=nil {return nil ,_deef ;};_gge ,_cde :=_gcf .(*PdfIndirectObject );if !_cde {return _gcf ,nil ;};_gcf =_gge .PdfObject ;_ ,_dbc =_gcf .(*PdfObjectReference );if _dbc {return _gge ,_a .New ("\u006d\u0075lt\u0069\u0020\u0064e\u0070\u0074\u0068\u0020tra\u0063e \u0070\u006f\u0069\u006e\u0074\u0065\u0072 t\u006f\u0020\u0070\u006f\u0069\u006e\u0074e\u0072"); 32 };return _gcf ,nil ;};func _cdacc (_dcagg _gd .ReadSeeker ,_fdbff int64 )(*offsetReader ,error ){_aebe :=&offsetReader {_eacg :_dcagg ,_fefc :_fdbff };_ ,_dbd :=_aebe .Seek (0,_gd .SeekStart );return _aebe ,_dbd ;}; 33 34 // DecodeStream decodes a FlateEncoded stream object and give back decoded bytes. 35 func (_gdaa *FlateEncoder )DecodeStream (streamObj *PdfObjectStream )([]byte ,error ){_df .Log .Trace ("\u0046l\u0061t\u0065\u0044\u0065\u0063\u006fd\u0065\u0020s\u0074\u0072\u0065\u0061\u006d");_df .Log .Trace ("\u0050\u0072\u0065\u0064\u0069\u0063\u0074\u006f\u0072\u003a\u0020\u0025\u0064",_gdaa .Predictor ); 36 if _gdaa .BitsPerComponent !=8{return nil ,_ea .Errorf ("\u0069\u006ev\u0061\u006c\u0069\u0064\u0020\u0042\u0069\u0074\u0073\u0050\u0065\u0072\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074\u003d\u0025\u0064\u0020\u0028\u006f\u006e\u006c\u0079\u0020\u0038\u0020\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u0029",_gdaa .BitsPerComponent ); 37 };_feea ,_ggge :=_gdaa .DecodeBytes (streamObj .Stream );if _ggge !=nil {return nil ,_ggge ;};_feea ,_ggge =_gdaa .postDecodePredict (_feea );if _ggge !=nil {return nil ,_ggge ;};return _feea ,nil ;}; 38 39 // DecodeStream decodes a JBIG2 encoded stream and returns the result as a slice of bytes. 40 func (_gggd *JBIG2Encoder )DecodeStream (streamObj *PdfObjectStream )([]byte ,error ){return _gggd .DecodeBytes (streamObj .Stream );}; 41 42 // DecodeStream implements ASCII85 stream decoding. 43 func (_gfef *ASCII85Encoder )DecodeStream (streamObj *PdfObjectStream )([]byte ,error ){return _gfef .DecodeBytes (streamObj .Stream );}; 44 45 // NewParser creates a new parser for a PDF file via ReadSeeker. Loads the cross reference stream and trailer. 46 // An error is returned on failure. 47 func NewParser (rs _gd .ReadSeeker )(*PdfParser ,error ){_dcbfc :=&PdfParser {_abdga :rs ,ObjCache :make (objectCache ),_dbaad :map[int64 ]bool {},_decff :make ([]int64 ,0),_dgef :make (map[*PdfParser ]*PdfParser )};_gadc ,_bgef ,_gdcc :=_dcbfc .parsePdfVersion (); 48 if _gdcc !=nil {_df .Log .Error ("U\u006e\u0061\u0062\u006c\u0065\u0020t\u006f\u0020\u0070\u0061\u0072\u0073\u0065\u0020\u0076e\u0072\u0073\u0069o\u006e:\u0020\u0025\u0076",_gdcc );return nil ,_gdcc ;};_dcbfc ._bdbfe .Major =_gadc ;_dcbfc ._bdbfe .Minor =_bgef ; 49 if _dcbfc ._aagb ,_gdcc =_dcbfc .loadXrefs ();_gdcc !=nil {_df .Log .Debug ("\u0045\u0052RO\u0052\u003a\u0020F\u0061\u0069\u006c\u0065d t\u006f l\u006f\u0061\u0064\u0020\u0078\u0072\u0065f \u0074\u0061\u0062\u006c\u0065\u0021\u0020%\u0073",_gdcc );return nil ,_gdcc ; 50 };_df .Log .Trace ("T\u0072\u0061\u0069\u006c\u0065\u0072\u003a\u0020\u0025\u0073",_dcbfc ._aagb );_bcfg ,_gdcc :=_dcbfc .parseLinearizedDictionary ();if _gdcc !=nil {return nil ,_gdcc ;};if _bcfg !=nil {_dcbfc ._cegb ,_gdcc =_dcbfc .checkLinearizedInformation (_bcfg ); 51 if _gdcc !=nil {return nil ,_gdcc ;};};if len (_dcbfc ._ggaf .ObjectMap )==0{return nil ,_ea .Errorf ("\u0065\u006d\u0070\u0074\u0079\u0020\u0058\u0052\u0045\u0046\u0020t\u0061\u0062\u006c\u0065\u0020\u002d\u0020\u0049\u006e\u0076a\u006c\u0069\u0064"); 52 };_dcbfc ._eaae =len (_dcbfc ._decff );if _dcbfc ._cegb &&_dcbfc ._eaae !=0{_dcbfc ._eaae --;};_dcbfc ._bddb =make ([]*PdfParser ,_dcbfc ._eaae );return _dcbfc ,nil ;};var _gedee =_f .MustCompile ("\u005b\\\u0072\u005c\u006e\u005d\u005c\u0073\u002a\u0028\u0078\u0072\u0065f\u0029\u005c\u0073\u002a\u005b\u005c\u0072\u005c\u006e\u005d"); 53 54 55 // MakeDecodeParams makes a new instance of an encoding dictionary based on 56 // the current encoder settings. 57 func (_gceg *FlateEncoder )MakeDecodeParams ()PdfObject {if _gceg .Predictor > 1{_eafg :=MakeDict ();_eafg .Set ("\u0050r\u0065\u0064\u0069\u0063\u0074\u006fr",MakeInteger (int64 (_gceg .Predictor )));if _gceg .BitsPerComponent !=8{_eafg .Set ("\u0042\u0069t\u0073\u0050\u0065r\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074",MakeInteger (int64 (_gceg .BitsPerComponent ))); 58 };if _gceg .Columns !=1{_eafg .Set ("\u0043o\u006c\u0075\u006d\u006e\u0073",MakeInteger (int64 (_gceg .Columns )));};if _gceg .Colors !=1{_eafg .Set ("\u0043\u006f\u006c\u006f\u0072\u0073",MakeInteger (int64 (_gceg .Colors )));};return _eafg ;};return nil ; 59 };var _gbaad =[]PdfObjectName {"\u0056","\u0052","\u004f","\u0055","\u0050"};var _aefgf =_f .MustCompile ("\u0028\u005c\u0064\u002b\u0029\u005c\u0073\u002b\u0028\u005c\u0064+\u0029\u005c\u0073\u002b\u0028\u005b\u006e\u0066\u005d\u0029\\\u0073\u002a\u0024"); 60 type objectStreams map[int ]objectStream ; 61 62 // DecodeStream decodes a DCT encoded stream and returns the result as a 63 // slice of bytes. 64 func (_gdb *DCTEncoder )DecodeStream (streamObj *PdfObjectStream )([]byte ,error ){return _gdb .DecodeBytes (streamObj .Stream );}; 65 66 // GetXrefType returns the type of the first xref object (table or stream). 67 func (_fefae *PdfParser )GetXrefType ()*xrefType {return _fefae ._dfbg }; 68 69 // String returns a string describing `d`. 70 func (_aecbe *PdfObjectDictionary )String ()string {var _aegb _cb .Builder ;_aegb .WriteString ("\u0044\u0069\u0063t\u0028");for _ ,_gecfa :=range _aecbe ._aggf {_agbd :=_aecbe ._ccfa [_gecfa ];_aegb .WriteString ("\u0022"+_gecfa .String ()+"\u0022\u003a\u0020"); 71 _aegb .WriteString (_agbd .String ());_aegb .WriteString ("\u002c\u0020");};_aegb .WriteString ("\u0029");return _aegb .String ();}; 72 73 // GetNumberAsInt64 returns the contents of `obj` as an int64 if it is an integer or float, or an 74 // error if it isn't. This is for cases where expecting an integer, but some implementations 75 // actually store the number in a floating point format. 76 func GetNumberAsInt64 (obj PdfObject )(int64 ,error ){switch _gdab :=obj .(type ){case *PdfObjectFloat :_df .Log .Debug ("\u004e\u0075m\u0062\u0065\u0072\u0020\u0065\u0078\u0070\u0065\u0063\u0074\u0065\u0064\u0020\u0061\u0073\u0020\u0069\u006e\u0074e\u0067\u0065\u0072\u0020\u0077\u0061s\u0020\u0073\u0074\u006f\u0072\u0065\u0064\u0020\u0061\u0073\u0020\u0066\u006c\u006fa\u0074\u0020(\u0074\u0079\u0070\u0065 \u0063\u0061\u0073\u0074\u0069n\u0067\u0020\u0075\u0073\u0065\u0064\u0029"); 77 return int64 (*_gdab ),nil ;case *PdfObjectInteger :return int64 (*_gdab ),nil ;case *PdfObjectReference :_ggdf :=TraceToDirectObject (obj );return GetNumberAsInt64 (_ggdf );case *PdfIndirectObject :return GetNumberAsInt64 (_gdab .PdfObject );};return 0,ErrNotANumber ; 78 }; 79 80 // Merge merges in key/values from another dictionary. Overwriting if has same keys. 81 // The mutated dictionary (d) is returned in order to allow method chaining. 82 func (_adbeca *PdfObjectDictionary )Merge (another *PdfObjectDictionary )*PdfObjectDictionary {if another !=nil {for _ ,_bcbdc :=range another .Keys (){_faad :=another .Get (_bcbdc );_adbeca .Set (_bcbdc ,_faad );};};return _adbeca ;};func _dafa ()string {return _df .Version }; 83 84 85 // HasInvalidHexRunes implements core.ParserMetadata interface. 86 func (_ggec ParserMetadata )HasInvalidHexRunes ()bool {return _ggec ._feed }; 87 88 // GetNumberAsFloat returns the contents of `obj` as a float if it is an integer or float, or an 89 // error if it isn't. 90 func GetNumberAsFloat (obj PdfObject )(float64 ,error ){switch _aaea :=obj .(type ){case *PdfObjectFloat :return float64 (*_aaea ),nil ;case *PdfObjectInteger :return float64 (*_aaea ),nil ;case *PdfObjectReference :_ggbeg :=TraceToDirectObject (obj ); 91 return GetNumberAsFloat (_ggbeg );case *PdfIndirectObject :return GetNumberAsFloat (_aaea .PdfObject );};return 0,ErrNotANumber ;};var _dfff =_f .MustCompile ("\u005e\u005b\\\u002b\u002d\u002e\u005d*\u0028\u005b0\u002d\u0039\u002e\u005d\u002b\u0029\u005b\u0065E\u005d\u005b\u005c\u002b\u002d\u002e\u005d\u002a\u0028\u005b\u0030\u002d9\u002e\u005d\u002b\u0029"); 92 func (_adaa *PdfParser )loadXrefs ()(*PdfObjectDictionary ,error ){_adaa ._ggaf .ObjectMap =make (map[int ]XrefObject );_adaa ._aeede =make (objectStreams );_adcf ,_addb :=_adaa ._abdga .Seek (0,_gd .SeekEnd );if _addb !=nil {return nil ,_addb ;};_df .Log .Trace ("\u0066s\u0069\u007a\u0065\u003a\u0020\u0025d",_adcf ); 93 _adaa ._gccgc =_adcf ;_addb =_adaa .seekToEOFMarker (_adcf );if _addb !=nil {_df .Log .Debug ("\u0046\u0061i\u006c\u0065\u0064\u0020\u0073\u0065\u0065\u006b\u0020\u0074\u006f\u0020\u0065\u006f\u0066\u0020\u006d\u0061\u0072\u006b\u0065\u0072: \u0025\u0076",_addb ); 94 return nil ,_addb ;};_efbc ,_addb :=_adaa ._abdga .Seek (0,_gd .SeekCurrent );if _addb !=nil {return nil ,_addb ;};var _ecaa int64 =64;_cffg :=_efbc -_ecaa ;if _cffg < 0{_cffg =0;};_ ,_addb =_adaa ._abdga .Seek (_cffg ,_gd .SeekStart );if _addb !=nil {return nil ,_addb ; 95 };_dgfege :=make ([]byte ,_ecaa );_ ,_addb =_adaa ._abdga .Read (_dgfege );if _addb !=nil {_df .Log .Debug ("\u0046\u0061i\u006c\u0065\u0064\u0020\u0072\u0065\u0061\u0064\u0069\u006e\u0067\u0020\u0077\u0068\u0069\u006c\u0065\u0020\u006c\u006f\u006f\u006b\u0069\u006e\u0067\u0020\u0066\u006f\u0072\u0020\u0073\u0074\u0061\u0072\u0074\u0078\u0072\u0065\u0066\u003a\u0020\u0025\u0076",_addb ); 96 return nil ,_addb ;};_efbgd :=_gagg .FindStringSubmatch (string (_dgfege ));if len (_efbgd )< 2{_df .Log .Debug ("E\u0072\u0072\u006f\u0072\u003a\u0020s\u0074\u0061\u0072\u0074\u0078\u0072\u0065\u0066\u0020n\u006f\u0074\u0020f\u006fu\u006e\u0064\u0021"); 97 return nil ,_a .New ("\u0073\u0074\u0061\u0072tx\u0072\u0065\u0066\u0020\u006e\u006f\u0074\u0020\u0066\u006f\u0075\u006e\u0064");};if len (_efbgd )> 2{_df .Log .Debug ("\u0045\u0052\u0052O\u0052\u003a\u0020\u004du\u006c\u0074\u0069\u0070\u006c\u0065\u0020s\u0074\u0061\u0072\u0074\u0078\u0072\u0065\u0066\u0020\u0028\u0025\u0073\u0029\u0021",_dgfege ); 98 return nil ,_a .New ("m\u0075\u006c\u0074\u0069\u0070\u006ce\u0020\u0073\u0074\u0061\u0072\u0074\u0078\u0072\u0065f\u0020\u0065\u006et\u0072i\u0065\u0073\u003f");};_gece ,_ :=_be .ParseInt (_efbgd [1],10,64);_df .Log .Trace ("\u0073t\u0061r\u0074\u0078\u0072\u0065\u0066\u0020\u0061\u0074\u0020\u0025\u0064",_gece ); 99 if _gece > _adcf {_df .Log .Debug ("\u0045\u0052\u0052OR\u003a\u0020\u0058\u0072\u0065\u0066\u0020\u006f\u0066f\u0073e\u0074 \u006fu\u0074\u0073\u0069\u0064\u0065\u0020\u006f\u0066\u0020\u0066\u0069\u006c\u0065");_df .Log .Debug ("\u0041\u0074\u0074\u0065\u006d\u0070\u0074\u0069\u006e\u0067\u0020\u0072e\u0070\u0061\u0069\u0072"); 100 _gece ,_addb =_adaa .repairLocateXref ();if _addb !=nil {_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a \u0052\u0065\u0070\u0061\u0069\u0072\u0020\u0061\u0074\u0074\u0065\u006d\u0070t\u0020\u0066\u0061\u0069\u006c\u0065\u0064 \u0028\u0025\u0073\u0029"); 101 return nil ,_addb ;};};_adaa ._abdga .Seek (_gece ,_gd .SeekStart );_adaa ._gcec =_fd .NewReader (_adaa ._abdga );_ffee ,_addb :=_adaa .parseXref ();if _addb !=nil {return nil ,_addb ;};_aefc :=_ffee .Get ("\u0058R\u0065\u0066\u0053\u0074\u006d");if _aefc !=nil {_ecdb ,_cgbd :=_aefc .(*PdfObjectInteger ); 102 if !_cgbd {return nil ,_a .New ("\u0058\u0052\u0065\u0066\u0053\u0074\u006d\u0020\u0021=\u0020\u0069\u006e\u0074");};_ ,_addb =_adaa .parseXrefStream (_ecdb );if _addb !=nil {return nil ,_addb ;};};var _gaff []int64 ;_cfaac :=func (_egeb int64 ,_adg []int64 )bool {for _ ,_afcb :=range _adg {if _afcb ==_egeb {return true ; 103 };};return false ;};_aefc =_ffee .Get ("\u0050\u0072\u0065\u0076");for _aefc !=nil {_gbgf ,_fdcfb :=_aefc .(*PdfObjectInteger );if !_fdcfb {_df .Log .Debug ("\u0049\u006ev\u0061\u006c\u0069\u0064\u0020P\u0072\u0065\u0076\u0020\u0072e\u0066\u0065\u0072\u0065\u006e\u0063\u0065\u003a\u0020\u004e\u006f\u0074\u0020\u0061\u0020\u002a\u0050\u0064\u0066\u004f\u0062\u006a\u0065\u0063\u0074\u0049\u006e\u0074\u0065\u0067\u0065\u0072\u0020\u0028\u0025\u0054\u0029",_aefc ); 104 return _ffee ,nil ;};_ddafa :=*_gbgf ;_df .Log .Trace ("\u0041\u006eot\u0068\u0065\u0072 \u0050\u0072\u0065\u0076 xr\u0065f \u0074\u0061\u0062\u006c\u0065\u0020\u006fbj\u0065\u0063\u0074\u0020\u0061\u0074\u0020%\u0064",_ddafa );_adaa ._abdga .Seek (int64 (_ddafa ),_gd .SeekStart ); 105 _adaa ._gcec =_fd .NewReader (_adaa ._abdga );_cdfg ,_gdbed :=_adaa .parseXref ();if _gdbed !=nil {_df .Log .Debug ("\u0057\u0061\u0072\u006e\u0069\u006e\u0067\u003a\u0020\u0045\u0072\u0072\u006f\u0072\u0020-\u0020\u0046\u0061\u0069\u006c\u0065\u0064\u0020\u006c\u006f\u0061\u0064\u0069n\u0067\u0020\u0061\u006e\u006f\u0074\u0068\u0065\u0072\u0020\u0028\u0050re\u0076\u0029\u0020\u0074\u0072\u0061\u0069\u006c\u0065\u0072"); 106 _df .Log .Debug ("\u0041\u0074t\u0065\u006d\u0070\u0074i\u006e\u0067 \u0074\u006f\u0020\u0063\u006f\u006e\u0074\u0069n\u0075\u0065\u0020\u0062\u0079\u0020\u0069\u0067\u006e\u006f\u0072\u0069n\u0067\u0020\u0069\u0074");break ;};_adaa ._decff =append (_adaa ._decff ,int64 (_ddafa )); 107 _aefc =_cdfg .Get ("\u0050\u0072\u0065\u0076");if _aefc !=nil {_cgbde :=*(_aefc .(*PdfObjectInteger ));if _cfaac (int64 (_cgbde ),_gaff ){_df .Log .Debug ("\u0050\u0072ev\u0065\u006e\u0074i\u006e\u0067\u0020\u0063irc\u0075la\u0072\u0020\u0078\u0072\u0065\u0066\u0020re\u0066\u0065\u0072\u0065\u006e\u0063\u0069n\u0067"); 108 break ;};_gaff =append (_gaff ,int64 (_cgbde ));};};return _ffee ,nil ;}; 109 110 // MakeDecodeParams makes a new instance of an encoding dictionary based on 111 // the current encoder settings. 112 func (_ggeg *DCTEncoder )MakeDecodeParams ()PdfObject {return nil }; 113 114 // MakeFloat creates an PdfObjectFloat from a float64. 115 func MakeFloat (val float64 )*PdfObjectFloat {_bcbaf :=PdfObjectFloat (val );return &_bcbaf }; 116 117 // HasInvalidSubsectionHeader implements core.ParserMetadata interface. 118 func (_cbe ParserMetadata )HasInvalidSubsectionHeader ()bool {return _cbe ._bfa }; 119 120 // ParserMetadata is the parser based metadata information about document. 121 // The data here could be used on document verification. 122 type ParserMetadata struct{_ecef int ;_eddgg bool ;_cdef [4]byte ;_dacf bool ;_faae bool ;_feed bool ;_ecg bool ;_bfa bool ;_fdg bool ;}; 123 124 // Decrypt an object with specified key. For numbered objects, 125 // the key argument is not used and a new one is generated based 126 // on the object and generation number. 127 // Traverses through all the subobjects (recursive). 128 // 129 // Does not look up references.. That should be done prior to calling. 130 func (_ada *PdfCrypt )Decrypt (obj PdfObject ,parentObjNum ,parentGenNum int64 )error {if _ada .isDecrypted (obj ){return nil ;};switch _fgab :=obj .(type ){case *PdfIndirectObject :_ada ._gee [_fgab ]=true ;_df .Log .Trace ("\u0044\u0065\u0063\u0072\u0079\u0070\u0074\u0069\u006e\u0067 \u0069\u006e\u0064\u0069\u0072\u0065\u0063t\u0020\u0025\u0064\u0020\u0025\u0064\u0020\u006f\u0062\u006a\u0021",_fgab .ObjectNumber ,_fgab .GenerationNumber ); 131 _fgb :=_fgab .ObjectNumber ;_cffc :=_fgab .GenerationNumber ;_dge :=_ada .Decrypt (_fgab .PdfObject ,_fgb ,_cffc );if _dge !=nil {return _dge ;};return nil ;case *PdfObjectStream :_ada ._gee [_fgab ]=true ;_ggbg :=_fgab .PdfObjectDictionary ;if _ada ._bga .R !=5{if _ede ,_cag :=_ggbg .Get ("\u0054\u0079\u0070\u0065").(*PdfObjectName ); 132 _cag &&*_ede =="\u0058\u0052\u0065\u0066"{return nil ;};};_ffefd :=_fgab .ObjectNumber ;_gea :=_fgab .GenerationNumber ;_df .Log .Trace ("\u0044e\u0063\u0072\u0079\u0070t\u0069\u006e\u0067\u0020\u0073t\u0072e\u0061m\u0020\u0025\u0064\u0020\u0025\u0064\u0020!",_ffefd ,_gea ); 133 _egbb :=_gfb ;if _ada ._dgc .V >=4{_egbb =_ada ._ddfb ;_df .Log .Trace ("\u0074\u0068\u0069\u0073.s\u0074\u0072\u0065\u0061\u006d\u0046\u0069\u006c\u0074\u0065\u0072\u0020\u003d\u0020%\u0073",_ada ._ddfb );if _gcaf ,_fgac :=_ggbg .Get ("\u0046\u0069\u006c\u0074\u0065\u0072").(*PdfObjectArray ); 134 _fgac {if _aaf ,_faf :=GetName (_gcaf .Get (0));_faf {if *_aaf =="\u0043\u0072\u0079p\u0074"{_egbb ="\u0049\u0064\u0065\u006e\u0074\u0069\u0074\u0079";if _gdc ,_dfdb :=_ggbg .Get ("D\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0072\u006d\u0073").(*PdfObjectDictionary ); 135 _dfdb {if _febc ,_fdeg :=_gdc .Get ("\u004e\u0061\u006d\u0065").(*PdfObjectName );_fdeg {if _ ,_adea :=_ada ._bde [string (*_febc )];_adea {_df .Log .Trace ("\u0055\u0073\u0069\u006eg \u0073\u0074\u0072\u0065\u0061\u006d\u0020\u0066\u0069\u006c\u0074\u0065\u0072\u0020%\u0073",*_febc ); 136 _egbb =string (*_febc );};};};};};};_df .Log .Trace ("\u0077\u0069\u0074\u0068\u0020\u0025\u0073\u0020\u0066i\u006c\u0074\u0065\u0072",_egbb );if _egbb =="\u0049\u0064\u0065\u006e\u0074\u0069\u0074\u0079"{return nil ;};};_dda :=_ada .Decrypt (_ggbg ,_ffefd ,_gea ); 137 if _dda !=nil {return _dda ;};_bbb ,_dda :=_ada .makeKey (_egbb ,uint32 (_ffefd ),uint32 (_gea ),_ada ._edb );if _dda !=nil {return _dda ;};_fgab .Stream ,_dda =_ada .decryptBytes (_fgab .Stream ,_egbb ,_bbb );if _dda !=nil {return _dda ;};_ggbg .Set ("\u004c\u0065\u006e\u0067\u0074\u0068",MakeInteger (int64 (len (_fgab .Stream )))); 138 return nil ;case *PdfObjectString :_df .Log .Trace ("\u0044e\u0063r\u0079\u0070\u0074\u0069\u006eg\u0020\u0073t\u0072\u0069\u006e\u0067\u0021");_bfeg :=_gfb ;if _ada ._dgc .V >=4{_df .Log .Trace ("\u0077\u0069\u0074\u0068\u0020\u0025\u0073\u0020\u0066i\u006c\u0074\u0065\u0072",_ada ._fbe ); 139 if _ada ._fbe =="\u0049\u0064\u0065\u006e\u0074\u0069\u0074\u0079"{return nil ;};_bfeg =_ada ._fbe ;};_egd ,_bggd :=_ada .makeKey (_bfeg ,uint32 (parentObjNum ),uint32 (parentGenNum ),_ada ._edb );if _bggd !=nil {return _bggd ;};_gcg :=_fgab .Str ();_bcb :=make ([]byte ,len (_gcg )); 140 for _aafc :=0;_aafc < len (_gcg );_aafc ++{_bcb [_aafc ]=_gcg [_aafc ];};if len (_bcb )> 0{_df .Log .Trace ("\u0044e\u0063\u0072\u0079\u0070\u0074\u0020\u0073\u0074\u0072\u0069\u006eg\u003a\u0020\u0025\u0073\u0020\u003a\u0020\u0025\u0020\u0078",_bcb ,_bcb ); 141 _bcb ,_bggd =_ada .decryptBytes (_bcb ,_bfeg ,_egd );if _bggd !=nil {return _bggd ;};};_fgab ._bcfef =string (_bcb );return nil ;case *PdfObjectArray :for _ ,_efe :=range _fgab .Elements (){_dagg :=_ada .Decrypt (_efe ,parentObjNum ,parentGenNum );if _dagg !=nil {return _dagg ; 142 };};return nil ;case *PdfObjectDictionary :_fcb :=false ;if _dcec :=_fgab .Get ("\u0054\u0079\u0070\u0065");_dcec !=nil {_bbae ,_adab :=_dcec .(*PdfObjectName );if _adab &&*_bbae =="\u0053\u0069\u0067"{_fcb =true ;};};for _ ,_dbgf :=range _fgab .Keys (){_fagd :=_fgab .Get (_dbgf ); 143 if _fcb &&string (_dbgf )=="\u0043\u006f\u006e\u0074\u0065\u006e\u0074\u0073"{continue ;};if string (_dbgf )!="\u0050\u0061\u0072\u0065\u006e\u0074"&&string (_dbgf )!="\u0050\u0072\u0065\u0076"&&string (_dbgf )!="\u004c\u0061\u0073\u0074"{_adfe :=_ada .Decrypt (_fagd ,parentObjNum ,parentGenNum ); 144 if _adfe !=nil {return _adfe ;};};};return nil ;};return nil ;};func (_gedg *limitedReadSeeker )getError (_cgefe int64 )error {switch {case _cgefe < 0:return _ea .Errorf ("\u0075\u006e\u0065\u0078\u0070\u0065\u0063\u0074\u0065\u0064 \u006e\u0065\u0067\u0061\u0074\u0069\u0076e\u0020\u006f\u0066\u0066\u0073\u0065\u0074\u003a\u0020\u0025\u0064",_cgefe ); 145 case _cgefe > _gedg ._dgfg :return _ea .Errorf ("u\u006e\u0065\u0078\u0070ec\u0074e\u0064\u0020\u006f\u0066\u0066s\u0065\u0074\u003a\u0020\u0025\u0064",_cgefe );};return nil ;}; 146 147 // DecodeStream decodes the stream data and returns the decoded data. 148 // An error is returned upon failure. 149 func DecodeStream (streamObj *PdfObjectStream )([]byte ,error ){_df .Log .Trace ("\u0044\u0065\u0063\u006f\u0064\u0065\u0020\u0073\u0074\u0072\u0065\u0061\u006d");_cbcg ,_fbec :=NewEncoderFromStream (streamObj );if _fbec !=nil {_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a \u0053\u0074\u0072\u0065\u0061\u006d\u0020\u0064\u0065\u0063\u006f\u0064\u0069n\u0067\u0020\u0066\u0061\u0069\u006c\u0065d\u003a\u0020\u0025\u0076",_fbec ); 150 return nil ,_fbec ;};_df .Log .Trace ("\u0045\u006e\u0063\u006f\u0064\u0065\u0072\u003a\u0020\u0025\u0023\u0076\u000a",_cbcg );_fbfe ,_fbec :=_cbcg .DecodeStream (streamObj );if _fbec !=nil {_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a \u0053\u0074\u0072\u0065\u0061\u006d\u0020\u0064\u0065\u0063\u006f\u0064\u0069n\u0067\u0020\u0066\u0061\u0069\u006c\u0065d\u003a\u0020\u0025\u0076",_fbec ); 151 return nil ,_fbec ;};return _fbfe ,nil ;};func _daee (_dfdf *PdfObjectStream )(*MultiEncoder ,error ){_aggg :=NewMultiEncoder ();_egfb :=_dfdf .PdfObjectDictionary ;if _egfb ==nil {return _aggg ,nil ;};var _egga *PdfObjectDictionary ;var _dgff []PdfObject ; 152 _fefb :=_egfb .Get ("D\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0072\u006d\u0073");if _fefb !=nil {_fbad ,_bbde :=_fefb .(*PdfObjectDictionary );if _bbde {_egga =_fbad ;};_ecac ,_dffe :=_fefb .(*PdfObjectArray );if _dffe {for _ ,_fadb :=range _ecac .Elements (){_fadb =TraceToDirectObject (_fadb ); 153 if _dcgb ,_gcdd :=_fadb .(*PdfObjectDictionary );_gcdd {_dgff =append (_dgff ,_dcgb );}else {_dgff =append (_dgff ,MakeDict ());};};};};_fefb =_egfb .Get ("\u0046\u0069\u006c\u0074\u0065\u0072");if _fefb ==nil {return nil ,_ea .Errorf ("\u0066\u0069\u006c\u0074\u0065\u0072\u0020\u006d\u0069s\u0073\u0069\u006e\u0067"); 154 };_abbb ,_eabac :=_fefb .(*PdfObjectArray );if !_eabac {return nil ,_ea .Errorf ("m\u0075\u006c\u0074\u0069\u0020\u0066\u0069\u006c\u0074\u0065\u0072\u0020\u0063\u0061\u006e\u0020\u006f\u006el\u0079\u0020\u0062\u0065\u0020\u006d\u0061\u0064\u0065\u0020fr\u006f\u006d\u0020a\u0072r\u0061\u0079"); 155 };for _eccdb ,_feba :=range _abbb .Elements (){_beaf ,_gefa :=_feba .(*PdfObjectName );if !_gefa {return nil ,_ea .Errorf ("\u006d\u0075l\u0074\u0069\u0020\u0066i\u006c\u0074e\u0072\u0020\u0061\u0072\u0072\u0061\u0079\u0020e\u006c\u0065\u006d\u0065\u006e\u0074\u0020\u006e\u006f\u0074\u0020\u0061 \u006e\u0061\u006d\u0065"); 156 };var _eafa PdfObject ;if _egga !=nil {_eafa =_egga ;}else {if len (_dgff )> 0{if _eccdb >=len (_dgff ){return nil ,_ea .Errorf ("\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0065\u006c\u0065\u006d\u0065n\u0074\u0073\u0020\u0069\u006e\u0020d\u0065\u0063\u006f\u0064\u0065\u0020\u0070\u0061\u0072\u0061\u006d\u0073\u0020a\u0072\u0072\u0061\u0079"); 157 };_eafa =_dgff [_eccdb ];};};var _bfeb *PdfObjectDictionary ;if _bded ,_ddcge :=_eafa .(*PdfObjectDictionary );_ddcge {_bfeb =_bded ;};_df .Log .Trace ("\u004e\u0065\u0078t \u006e\u0061\u006d\u0065\u003a\u0020\u0025\u0073\u002c \u0064p\u003a \u0025v\u002c\u0020\u0064\u0050\u0061\u0072\u0061\u006d\u0073\u003a\u0020\u0025\u0076",*_beaf ,_eafa ,_bfeb ); 158 if *_beaf ==StreamEncodingFilterNameFlate {_cege ,_gdgdb :=_daca (_dfdf ,_bfeb );if _gdgdb !=nil {return nil ,_gdgdb ;};_aggg .AddEncoder (_cege );}else if *_beaf ==StreamEncodingFilterNameLZW {_efbg ,_abdc :=_bdbf (_dfdf ,_bfeb );if _abdc !=nil {return nil ,_abdc ; 159 };_aggg .AddEncoder (_efbg );}else if *_beaf ==StreamEncodingFilterNameASCIIHex {_dbcb :=NewASCIIHexEncoder ();_aggg .AddEncoder (_dbcb );}else if *_beaf ==StreamEncodingFilterNameASCII85 {_gbaaab :=NewASCII85Encoder ();_aggg .AddEncoder (_gbaaab );}else if *_beaf ==StreamEncodingFilterNameDCT {_beee ,_gegb :=_defa (_dfdf ,_aggg ); 160 if _gegb !=nil {return nil ,_gegb ;};_aggg .AddEncoder (_beee );_df .Log .Trace ("A\u0064d\u0065\u0064\u0020\u0044\u0043\u0054\u0020\u0065n\u0063\u006f\u0064\u0065r.\u002e\u002e");_df .Log .Trace ("\u004du\u006ct\u0069\u0020\u0065\u006e\u0063o\u0064\u0065r\u003a\u0020\u0025\u0023\u0076",_aggg ); 161 }else if *_beaf ==StreamEncodingFilterNameCCITTFax {_dfee ,_dggg :=_dbad (_dfdf ,_bfeb );if _dggg !=nil {return nil ,_dggg ;};_aggg .AddEncoder (_dfee );}else {_df .Log .Error ("U\u006e\u0073\u0075\u0070po\u0072t\u0065\u0064\u0020\u0066\u0069l\u0074\u0065\u0072\u0020\u0025\u0073",*_beaf ); 162 return nil ,_ea .Errorf ("\u0069\u006eva\u006c\u0069\u0064 \u0066\u0069\u006c\u0074er \u0069n \u006d\u0075\u006c\u0074\u0069\u0020\u0066il\u0074\u0065\u0072\u0020\u0061\u0072\u0072a\u0079");};};return _aggg ,nil ;}; 163 164 // MakeStreamDict makes a new instance of an encoding dictionary for a stream object. 165 // Has the Filter set and the DecodeParms. 166 func (_ege *FlateEncoder )MakeStreamDict ()*PdfObjectDictionary {_abde :=MakeDict ();_abde .Set ("\u0046\u0069\u006c\u0074\u0065\u0072",MakeName (_ege .GetFilterName ()));_ecag :=_ege .MakeDecodeParams ();if _ecag !=nil {_abde .Set ("D\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0072\u006d\u0073",_ecag ); 167 };return _abde ;}; 168 169 // GetFilterName returns the name of the encoding filter. 170 func (_cdgf *LZWEncoder )GetFilterName ()string {return StreamEncodingFilterNameLZW }; 171 172 // EqualObjects returns true if `obj1` and `obj2` have the same contents. 173 // 174 // NOTE: It is a good idea to flatten obj1 and obj2 with FlattenObject before calling this function 175 // so that contents, rather than references, can be compared. 176 func EqualObjects (obj1 ,obj2 PdfObject )bool {return _edege (obj1 ,obj2 ,0)}; 177 178 // PdfObjectInteger represents the primitive PDF integer numerical object. 179 type PdfObjectInteger int64 ; 180 181 // Keys returns the list of keys in the dictionary. 182 // If `d` is nil returns a nil slice. 183 func (_abee *PdfObjectDictionary )Keys ()[]PdfObjectName {if _abee ==nil {return nil ;};return _abee ._aggf ;}; 184 185 // IsDelimiter checks if a character represents a delimiter. 186 func IsDelimiter (c byte )bool {return c =='('||c ==')'||c =='<'||c =='>'||c =='['||c ==']'||c =='{'||c =='}'||c =='/'||c =='%';}; 187 188 // MakeInteger creates a PdfObjectInteger from an int64. 189 func MakeInteger (val int64 )*PdfObjectInteger {_cgcc :=PdfObjectInteger (val );return &_cgcc }; 190 191 // UpdateParams updates the parameter values of the encoder. 192 func (_gae *ASCIIHexEncoder )UpdateParams (params *PdfObjectDictionary ){};func _cecd (_deag ,_bbef ,_dcbf uint8 )uint8 {_acebc :=int (_dcbf );_ccaa :=int (_bbef )-_acebc ;_gbcd :=int (_deag )-_acebc ;_acebc =_bca (_ccaa +_gbcd );_ccaa =_bca (_ccaa );_gbcd =_bca (_gbcd ); 193 if _ccaa <=_gbcd &&_ccaa <=_acebc {return _deag ;}else if _gbcd <=_acebc {return _bbef ;};return _dcbf ;}; 194 195 // EncodeImage encodes 'img' golang image.Image into jbig2 encoded bytes document using default encoder settings. 196 func (_daac *JBIG2Encoder )EncodeImage (img _ff .Image )([]byte ,error ){return _daac .encodeImage (img )}; 197 198 // IsFloatDigit checks if a character can be a part of a float number string. 199 func IsFloatDigit (c byte )bool {return ('0'<=c &&c <='9')||c =='.'};func (_afc *PdfParser )readComment ()(string ,error ){var _dffb _d .Buffer ;_ ,_ddaf :=_afc .skipSpaces ();if _ddaf !=nil {return _dffb .String (),_ddaf ;};_fgbb :=true ;for {_gbda ,_dcde :=_afc ._gcec .Peek (1); 200 if _dcde !=nil {_df .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0025\u0073",_dcde .Error ());return _dffb .String (),_dcde ;};if _fgbb &&_gbda [0]!='%'{return _dffb .String (),_a .New ("c\u006f\u006d\u006d\u0065\u006e\u0074 \u0073\u0068\u006f\u0075\u006c\u0064\u0020\u0073\u0074a\u0072\u0074\u0020w\u0069t\u0068\u0020\u0025"); 201 };_fgbb =false ;if (_gbda [0]!='\r')&&(_gbda [0]!='\n'){_dfcb ,_ :=_afc ._gcec .ReadByte ();_dffb .WriteByte (_dfcb );}else {break ;};};return _dffb .String (),nil ;}; 202 203 // DecodeStream decodes the stream containing CCITTFax encoded image data. 204 func (_ceac *CCITTFaxEncoder )DecodeStream (streamObj *PdfObjectStream )([]byte ,error ){return _ceac .DecodeBytes (streamObj .Stream );}; 205 206 // JBIG2Image is the image structure used by the jbig2 encoder. Its Data must be in a 207 // 1 bit per component and 1 component per pixel (1bpp). In order to create binary image 208 // use GoImageToJBIG2 function. If the image data contains the row bytes padding set the HasPadding to true. 209 type JBIG2Image struct{ 210 211 // Width and Height defines the image boundaries. 212 Width ,Height int ; 213 214 // Data is the byte slice data for the input image 215 Data []byte ; 216 217 // HasPadding is the attribute that defines if the last byte of the data in the row contains 218 // 0 bits padding. 219 HasPadding bool ;};func (_efbge *JBIG2Encoder )encodeImage (_aebb _ff .Image )([]byte ,error ){const _gfeff ="e\u006e\u0063\u006f\u0064\u0065\u0049\u006d\u0061\u0067\u0065";_fdfe ,_fbga :=GoImageToJBIG2 (_aebb ,JB2ImageAutoThreshold );if _fbga !=nil {return nil ,_dd .Wrap (_fbga ,_gfeff ,"\u0063\u006f\u006e\u0076\u0065\u0072\u0074\u0020\u0069\u006e\u0070\u0075\u0074\u0020\u0069m\u0061g\u0065\u0020\u0074\u006f\u0020\u006a\u0062\u0069\u0067\u0032\u0020\u0069\u006d\u0067"); 220 };if _fbga =_efbge .AddPageImage (_fdfe ,&_efbge .DefaultPageSettings );_fbga !=nil {return nil ,_dd .Wrap (_fbga ,_gfeff ,"");};return _efbge .Encode ();}; 221 222 // Str returns the string value of the PdfObjectString. Defined in addition to String() function to clarify that 223 // this function returns the underlying string directly, whereas the String function technically could include 224 // debug info. 225 func (_edgb *PdfObjectString )Str ()string {return _edgb ._bcfef }; 226 227 // UpdateParams updates the parameter values of the encoder. 228 func (_ffb *DCTEncoder )UpdateParams (params *PdfObjectDictionary ){_ecea ,_ccgd :=GetNumberAsInt64 (params .Get ("\u0043o\u006co\u0072\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074\u0073"));if _ccgd ==nil {_ffb .ColorComponents =int (_ecea );}; 229 _aefa ,_ccgd :=GetNumberAsInt64 (params .Get ("\u0042\u0069t\u0073\u0050\u0065r\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074"));if _ccgd ==nil {_ffb .BitsPerComponent =int (_aefa );};_bdc ,_ccgd :=GetNumberAsInt64 (params .Get ("\u0057\u0069\u0064t\u0068")); 230 if _ccgd ==nil {_ffb .Width =int (_bdc );};_dcce ,_ccgd :=GetNumberAsInt64 (params .Get ("\u0048\u0065\u0069\u0067\u0068\u0074"));if _ccgd ==nil {_ffb .Height =int (_dcce );};_ffde ,_ccgd :=GetNumberAsInt64 (params .Get ("\u0051u\u0061\u006c\u0069\u0074\u0079")); 231 if _ccgd ==nil {_ffb .Quality =int (_ffde );};_bgbb ,_gdgf :=GetArray (params .Get ("\u0044\u0065\u0063\u006f\u0064\u0065"));if _gdgf {_ffb .Decode ,_ccgd =_bgbb .ToFloat64Array ();if _ccgd !=nil {_df .Log .Error ("F\u0061\u0069\u006c\u0065\u0064\u0020\u0063\u006f\u006ev\u0065\u0072\u0074\u0069\u006e\u0067\u0020de\u0063\u006f\u0064\u0065 \u006f\u0062\u006a\u0065\u0063\u0074\u0020\u0069\u006eto\u0020\u0061r\u0072\u0061\u0079\u0073\u003a\u0020\u0025\u0076",_ccgd ); 232 };};}; 233 234 // Resolve resolves the reference and returns the indirect or stream object. 235 // If the reference cannot be resolved, a *PdfObjectNull object is returned. 236 func (_gaece *PdfObjectReference )Resolve ()PdfObject {if _gaece ._egcg ==nil {return MakeNull ();};_dgde ,_ ,_daadb :=_gaece ._egcg .resolveReference (_gaece );if _daadb !=nil {_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u0020\u0072\u0065\u0073\u006f\u006cv\u0069\u006e\u0067\u0020\u0072\u0065\u0066\u0065r\u0065n\u0063\u0065\u003a\u0020\u0025\u0076\u0020\u002d\u0020\u0072\u0065\u0074\u0075\u0072\u006e\u0069\u006e\u0067 \u006e\u0075\u006c\u006c\u0020\u006f\u0062\u006a\u0065\u0063\u0074",_daadb ); 237 return MakeNull ();};if _dgde ==nil {_df .Log .Debug ("\u0045R\u0052\u004f\u0052\u0020\u0072\u0065\u0073ol\u0076\u0069\u006e\u0067\u0020\u0072\u0065\u0066\u0065\u0072\u0065\u006e\u0063\u0065:\u0020\u006ei\u006c\u0020\u006fb\u006a\u0065\u0063\u0074\u0020\u002d\u0020\u0072\u0065\u0074\u0075\u0072\u006e\u0069\u006e\u0067 \u0061\u0020nu\u006c\u006c\u0020o\u0062\u006a\u0065\u0063\u0074"); 238 return MakeNull ();};return _dgde ;}; 239 240 // LookupByNumber looks up a PdfObject by object number. Returns an error on failure. 241 func (_gdg *PdfParser )LookupByNumber (objNumber int )(PdfObject ,error ){_eg ,_ ,_abcg :=_gdg .lookupByNumberWrapper (objNumber ,true );return _eg ,_abcg ;}; 242 243 // DecodeBytes decodes a slice of Flate encoded bytes and returns the result. 244 func (_agaa *FlateEncoder )DecodeBytes (encoded []byte )([]byte ,error ){_df .Log .Trace ("\u0046\u006c\u0061\u0074\u0065\u0044\u0065\u0063\u006f\u0064\u0065\u0020b\u0079\u0074\u0065\u0073");if len (encoded )==0{_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0065\u006d\u0070\u0074\u0079\u0020\u0046\u006c\u0061\u0074\u0065 e\u006ec\u006f\u0064\u0065\u0064\u0020\u0062\u0075\u0066\u0066\u0065\u0072\u002e \u0052\u0065\u0074\u0075\u0072\u006e\u0069\u006e\u0067\u0020\u0065\u006d\u0070\u0074\u0079\u0020\u0062y\u0074\u0065\u0020\u0073\u006c\u0069\u0063\u0065\u002e"); 245 return []byte {},nil ;};_fbbf :=_d .NewReader (encoded );_baeb ,_degeb :=_ecd .NewReader (_fbbf );if _degeb !=nil {_df .Log .Debug ("\u0044e\u0063o\u0064\u0069\u006e\u0067\u0020e\u0072\u0072o\u0072\u0020\u0025\u0076\u000a",_degeb );_df .Log .Debug ("\u0053t\u0072e\u0061\u006d\u0020\u0028\u0025\u0064\u0029\u0020\u0025\u0020\u0078",len (encoded ),encoded ); 246 return nil ,_degeb ;};defer _baeb .Close ();var _fbc _d .Buffer ;_fbc .ReadFrom (_baeb );return _fbc .Bytes (),nil ;}; 247 248 // String returns a string describing `ind`. 249 func (_gfacc *PdfIndirectObject )String ()string {return _ea .Sprintf ("\u0049\u004f\u0062\u006a\u0065\u0063\u0074\u003a\u0025\u0064",(*_gfacc ).ObjectNumber );}; 250 251 // GetUpdatedObjects returns pdf objects which were updated from the specific version (from prevParser). 252 func (_fceb *PdfParser )GetUpdatedObjects (prevParser *PdfParser )(map[int64 ]PdfObject ,error ){if prevParser ==nil {return nil ,_a .New ("\u0070\u0072e\u0076\u0069\u006f\u0075\u0073\u0020\u0070\u0061\u0072\u0073\u0065\u0072\u0020\u0063\u0061\u006e\u0027\u0074\u0020\u0062\u0065\u0020nu\u006c\u006c"); 253 };_gebed ,_gfbbf :=_fceb .getNumbersOfUpdatedObjects (prevParser );if _gfbbf !=nil {return nil ,_gfbbf ;};_efbe :=make (map[int64 ]PdfObject );for _ ,_dcfe :=range _gebed {if _begb ,_gdbc :=_fceb .LookupByNumber (_dcfe );_gdbc ==nil {_efbe [int64 (_dcfe )]=_begb ; 254 }else {return nil ,_gdbc ;};};return _efbe ,nil ;}; 255 256 // IsAuthenticated returns true if the PDF has already been authenticated for accessing. 257 func (_ccf *PdfParser )IsAuthenticated ()bool {return _ccf ._acg ._age };func (_dacad *PdfParser )inspect ()(map[string ]int ,error ){_df .Log .Trace ("\u002d\u002d\u002d\u002d\u002d\u002d\u002d\u002d\u0049\u004e\u0053P\u0045\u0043\u0054\u0020\u002d\u002d\u002d\u002d\u002d\u002d-\u002d\u002d\u002d"); 258 _df .Log .Trace ("X\u0072\u0065\u0066\u0020\u0074\u0061\u0062\u006c\u0065\u003a");_fbeaa :=map[string ]int {};_ggcb :=0;_fgce :=0;var _cgab []int ;for _dfgd :=range _dacad ._ggaf .ObjectMap {_cgab =append (_cgab ,_dfgd );};_g .Ints (_cgab );_egag :=0;for _ ,_fcfe :=range _cgab {_cgeac :=_dacad ._ggaf .ObjectMap [_fcfe ]; 259 if _cgeac .ObjectNumber ==0{continue ;};_ggcb ++;_df .Log .Trace ("\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d");_df .Log .Trace ("\u004c\u006f\u006f\u006bi\u006e\u0067\u0020\u0075\u0070\u0020\u006f\u0062\u006a\u0065c\u0074 \u006e\u0075\u006d\u0062\u0065\u0072\u003a \u0025\u0064",_cgeac .ObjectNumber ); 260 _gbdgf ,_egdae :=_dacad .LookupByNumber (_cgeac .ObjectNumber );if _egdae !=nil {_df .Log .Trace ("\u0045\u0052\u0052\u004f\u0052\u003a \u0046\u0061\u0069\u006c\u0020\u0074\u006f\u0020\u006c\u006f\u006f\u006b\u0075p\u0020\u006f\u0062\u006a\u0020\u0025\u0064 \u0028\u0025\u0073\u0029",_cgeac .ObjectNumber ,_egdae ); 261 _fgce ++;continue ;};_df .Log .Trace ("\u006fb\u006a\u003a\u0020\u0025\u0073",_gbdgf );_ffdd ,_bccc :=_gbdgf .(*PdfIndirectObject );if _bccc {_df .Log .Trace ("\u0049N\u0044 \u004f\u004f\u0042\u004a\u0020\u0025\u0064\u003a\u0020\u0025\u0073",_cgeac .ObjectNumber ,_ffdd ); 262 _cdfbg ,_gacc :=_ffdd .PdfObject .(*PdfObjectDictionary );if _gacc {if _gaaca ,_gddg :=_cdfbg .Get ("\u0054\u0079\u0070\u0065").(*PdfObjectName );_gddg {_deca :=string (*_gaaca );_df .Log .Trace ("\u002d\u002d\u002d\u003e\u0020\u004f\u0062\u006a\u0020\u0074\u0079\u0070e\u003a\u0020\u0025\u0073",_deca ); 263 _ ,_bffc :=_fbeaa [_deca ];if _bffc {_fbeaa [_deca ]++;}else {_fbeaa [_deca ]=1;};}else if _geea ,_aceg :=_cdfbg .Get ("\u0053u\u0062\u0074\u0079\u0070\u0065").(*PdfObjectName );_aceg {_fcba :=string (*_geea );_df .Log .Trace ("-\u002d-\u003e\u0020\u004f\u0062\u006a\u0020\u0073\u0075b\u0074\u0079\u0070\u0065: \u0025\u0073",_fcba ); 264 _ ,_dcbbg :=_fbeaa [_fcba ];if _dcbbg {_fbeaa [_fcba ]++;}else {_fbeaa [_fcba ]=1;};};if _eaaa ,_fbgg :=_cdfbg .Get ("\u0053").(*PdfObjectName );_fbgg &&*_eaaa =="\u004a\u0061\u0076\u0061\u0053\u0063\u0072\u0069\u0070\u0074"{_ ,_bcdeeb :=_fbeaa ["\u004a\u0061\u0076\u0061\u0053\u0063\u0072\u0069\u0070\u0074"]; 265 if _bcdeeb {_fbeaa ["\u004a\u0061\u0076\u0061\u0053\u0063\u0072\u0069\u0070\u0074"]++;}else {_fbeaa ["\u004a\u0061\u0076\u0061\u0053\u0063\u0072\u0069\u0070\u0074"]=1;};};};}else if _eafd ,_bebb :=_gbdgf .(*PdfObjectStream );_bebb {if _gfffg ,_efbgeb :=_eafd .PdfObjectDictionary .Get ("\u0054\u0079\u0070\u0065").(*PdfObjectName ); 266 _efbgeb {_df .Log .Trace ("\u002d\u002d\u003e\u0020\u0053\u0074\u0072\u0065\u0061\u006d\u0020o\u0062\u006a\u0065\u0063\u0074\u0020\u0074\u0079\u0070\u0065:\u0020\u0025\u0073",*_gfffg );_aefd :=string (*_gfffg );_fbeaa [_aefd ]++;};}else {_degg ,_bebba :=_gbdgf .(*PdfObjectDictionary ); 267 if _bebba {_fgdea ,_bafea :=_degg .Get ("\u0054\u0079\u0070\u0065").(*PdfObjectName );if _bafea {_bdee :=string (*_fgdea );_df .Log .Trace ("\u002d-\u002d \u006f\u0062\u006a\u0020\u0074\u0079\u0070\u0065\u0020\u0025\u0073",_bdee );_fbeaa [_bdee ]++;};}; 268 _df .Log .Trace ("\u0044\u0049\u0052\u0045\u0043\u0054\u0020\u004f\u0042\u004a\u0020\u0025d\u003a\u0020\u0025\u0073",_cgeac .ObjectNumber ,_gbdgf );};_egag ++;};_df .Log .Trace ("\u002d\u002d\u002d\u002d\u002d\u002d\u002d\u002d\u0045\u004fF\u0020\u0049\u004e\u0053\u0050\u0045\u0043T\u0020\u002d\u002d\u002d\u002d\u002d\u002d\u002d\u002d\u002d\u002d"); 269 _df .Log .Trace ("\u003d=\u003d\u003d\u003d\u003d\u003d");_df .Log .Trace ("\u004f\u0062j\u0065\u0063\u0074 \u0063\u006f\u0075\u006e\u0074\u003a\u0020\u0025\u0064",_ggcb );_df .Log .Trace ("\u0046\u0061\u0069\u006c\u0065\u0064\u0020\u006c\u006f\u006f\u006b\u0075p\u003a\u0020\u0025\u0064",_fgce ); 270 for _fagce ,_agcg :=range _fbeaa {_df .Log .Trace ("\u0025\u0073\u003a\u0020\u0025\u0064",_fagce ,_agcg );};_df .Log .Trace ("\u003d=\u003d\u003d\u003d\u003d\u003d");if len (_dacad ._ggaf .ObjectMap )< 1{_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0054\u0068\u0069\u0073 \u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074 \u0069s\u0020\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0028\u0078\u0072\u0065\u0066\u0020\u0074\u0061\u0062l\u0065\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0021\u0029"); 271 return nil ,_ea .Errorf ("\u0069\u006ev\u0061\u006c\u0069\u0064 \u0064\u006fc\u0075\u006d\u0065\u006e\u0074\u0020\u0028\u0078r\u0065\u0066\u0020\u0074\u0061\u0062\u006c\u0065\u0020\u006d\u0069\u0073s\u0069\u006e\u0067\u0029");};_dedf ,_caeb :=_fbeaa ["\u0046\u006f\u006e\u0074"]; 272 if !_caeb ||_dedf < 2{_df .Log .Trace ("\u0054\u0068\u0069s \u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u0020i\u0073 \u0070r\u006fb\u0061\u0062\u006c\u0079\u0020\u0073\u0063\u0061\u006e\u006e\u0065\u0064\u0021");}else {_df .Log .Trace ("\u0054\u0068\u0069\u0073\u0020\u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u0020\u0069\u0073\u0020\u0076\u0061\u006c\u0069\u0064\u0020\u0066o\u0072\u0020\u0065\u0078\u0074r\u0061\u0063t\u0069\u006f\u006e\u0021"); 273 };return _fbeaa ,nil ;}; 274 275 // WriteString outputs the object as it is to be written to file. 276 func (_cdfe *PdfObjectArray )WriteString ()string {var _dgbde _cb .Builder ;_dgbde .WriteString ("\u005b");for _gdbda ,_cgbf :=range _cdfe .Elements (){_dgbde .WriteString (_cgbf .WriteString ());if _gdbda < (_cdfe .Len ()-1){_dgbde .WriteString ("\u0020"); 277 };};_dgbde .WriteString ("\u005d");return _dgbde .String ();}; 278 279 // NewDCTEncoder makes a new DCT encoder with default parameters. 280 func NewDCTEncoder ()*DCTEncoder {_cfe :=&DCTEncoder {};_cfe .ColorComponents =3;_cfe .BitsPerComponent =8;_cfe .Quality =DefaultJPEGQuality ;_cfe .Decode =[]float64 {0.0,1.0,0.0,1.0,0.0,1.0};return _cfe ;}; 281 282 // PdfObjectStream represents the primitive PDF Object stream. 283 type PdfObjectStream struct{PdfObjectReference ;*PdfObjectDictionary ;Stream []byte ;}; 284 285 // EncodeBytes implements support for LZW encoding. Currently not supporting predictors (raw compressed data only). 286 // Only supports the Early change = 1 algorithm (compress/lzw) as the other implementation 287 // does not have a write method. 288 // TODO: Consider refactoring compress/lzw to allow both. 289 func (_aab *LZWEncoder )EncodeBytes (data []byte )([]byte ,error ){if _aab .Predictor !=1{return nil ,_ea .Errorf ("\u004c\u005aW \u0050\u0072\u0065d\u0069\u0063\u0074\u006fr =\u00201 \u006f\u006e\u006c\u0079\u0020\u0073\u0075pp\u006f\u0072\u0074\u0065\u0064\u0020\u0079e\u0074"); 290 };if _aab .EarlyChange ==1{return nil ,_ea .Errorf ("\u004c\u005a\u0057\u0020\u0045\u0061\u0072\u006c\u0079\u0020\u0043\u0068\u0061n\u0067\u0065\u0020\u003d\u0020\u0030 \u006f\u006e\u006c\u0079\u0020\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065d\u0020\u0079\u0065\u0074"); 291 };var _dde _d .Buffer ;_dbf :=_ag .NewWriter (&_dde ,_ag .MSB ,8);_dbf .Write (data );_dbf .Close ();return _dde .Bytes (),nil ;}; 292 293 // RunLengthEncoder represents Run length encoding. 294 type RunLengthEncoder struct{}; 295 296 // ReadAtLeast reads at least n bytes into slice p. 297 // Returns the number of bytes read (should always be == n), and an error on failure. 298 func (_ebb *PdfParser )ReadAtLeast (p []byte ,n int )(int ,error ){_agad :=n ;_efeff :=0;_dcac :=0;for _agad > 0{_aff ,_fggg :=_ebb ._gcec .Read (p [_efeff :]);if _fggg !=nil {_df .Log .Debug ("\u0045\u0052\u0052O\u0052\u0020\u0046\u0061i\u006c\u0065\u0064\u0020\u0072\u0065\u0061d\u0069\u006e\u0067\u0020\u0028\u0025\u0064\u003b\u0025\u0064\u0029\u0020\u0025\u0073",_aff ,_dcac ,_fggg .Error ()); 299 return _efeff ,_a .New ("\u0066\u0061\u0069\u006c\u0065\u0064\u0020\u0072\u0065a\u0064\u0069\u006e\u0067");};_dcac ++;_efeff +=_aff ;_agad -=_aff ;};return _efeff ,nil ;}; 300 301 // DecodeStream returns the passed in stream as a slice of bytes. 302 // The purpose of the method is to satisfy the StreamEncoder interface. 303 func (_cagfd *RawEncoder )DecodeStream (streamObj *PdfObjectStream )([]byte ,error ){return streamObj .Stream ,nil ;}; 304 305 // PdfObject is an interface which all primitive PDF objects must implement. 306 type PdfObject interface{ 307 308 // String outputs a string representation of the primitive (for debugging). 309 String ()string ; 310 311 // WriteString outputs the PDF primitive as written to file as expected by the standard. 312 // TODO(dennwc): it should return a byte slice, or accept a writer 313 WriteString ()string ;}; 314 315 // SetIfNotNil sets the dictionary's key -> val mapping entry -IF- val is not nil. 316 // Note that we take care to perform a type switch. Otherwise if we would supply a nil value 317 // of another type, e.g. (PdfObjectArray*)(nil), then it would not be a PdfObject(nil) and thus 318 // would get set. 319 func (_abaec *PdfObjectDictionary )SetIfNotNil (key PdfObjectName ,val PdfObject ){if val !=nil {switch _ggeae :=val .(type ){case *PdfObjectName :if _ggeae !=nil {_abaec .Set (key ,val );};case *PdfObjectDictionary :if _ggeae !=nil {_abaec .Set (key ,val ); 320 };case *PdfObjectStream :if _ggeae !=nil {_abaec .Set (key ,val );};case *PdfObjectString :if _ggeae !=nil {_abaec .Set (key ,val );};case *PdfObjectNull :if _ggeae !=nil {_abaec .Set (key ,val );};case *PdfObjectInteger :if _ggeae !=nil {_abaec .Set (key ,val ); 321 };case *PdfObjectArray :if _ggeae !=nil {_abaec .Set (key ,val );};case *PdfObjectBool :if _ggeae !=nil {_abaec .Set (key ,val );};case *PdfObjectFloat :if _ggeae !=nil {_abaec .Set (key ,val );};case *PdfObjectReference :if _ggeae !=nil {_abaec .Set (key ,val ); 322 };case *PdfIndirectObject :if _ggeae !=nil {_abaec .Set (key ,val );};default:_df .Log .Error ("\u0045\u0052R\u004f\u0052\u003a\u0020\u0055\u006e\u006b\u006e\u006f\u0077\u006e\u0020\u0074\u0079\u0070\u0065\u003a\u0020\u0025\u0054\u0020\u002d\u0020\u0073\u0068\u006f\u0075\u006c\u0064\u0020\u006e\u0065\u0076\u0065\u0072\u0020\u0068\u0061\u0070\u0070\u0065\u006e\u0021",val ); 323 };};}; 324 325 // PdfObjectNull represents the primitive PDF null object. 326 type PdfObjectNull struct{};func (_cgf *PdfParser )lookupByNumber (_ef int ,_dce bool )(PdfObject ,bool ,error ){_eb ,_ced :=_cgf .ObjCache [_ef ];if _ced {_df .Log .Trace ("\u0052\u0065\u0074\u0075\u0072\u006e\u0069\u006e\u0067\u0020\u0063a\u0063\u0068\u0065\u0064\u0020\u006f\u0062\u006a\u0065\u0063t\u0020\u0025\u0064",_ef ); 327 return _eb ,false ,nil ;};if _cgf ._dbeed ==nil {_cgf ._dbeed =map[int ]bool {};};if _cgf ._dbeed [_ef ]{_df .Log .Debug ("ER\u0052\u004f\u0052\u003a\u0020\u004c\u006fok\u0075\u0070\u0020\u006f\u0066\u0020\u0025\u0064\u0020\u0069\u0073\u0020\u0061\u006c\u0072e\u0061\u0064\u0079\u0020\u0069\u006e\u0020\u0070\u0072\u006f\u0067\u0072\u0065\u0073\u0073\u0020\u002d\u0020\u0072\u0065c\u0075\u0072\u0073\u0069\u0076\u0065 \u006c\u006f\u006f\u006b\u0075\u0070\u0020\u0061\u0074t\u0065m\u0070\u0074\u0020\u0062\u006c\u006f\u0063\u006b\u0065\u0064",_ef ); 328 return nil ,false ,_a .New ("\u0072\u0065\u0063\u0075\u0072\u0073\u0069\u0076\u0065\u0020\u006c\u006f\u006f\u006b\u0075p\u0020a\u0074\u0074\u0065\u006d\u0070\u0074\u0020\u0062\u006c\u006f\u0063\u006b\u0065\u0064");};_cgf ._dbeed [_ef ]=true ;defer delete (_cgf ._dbeed ,_ef ); 329 _fad ,_ced :=_cgf ._ggaf .ObjectMap [_ef ];if !_ced {_df .Log .Trace ("\u0055\u006e\u0061\u0062l\u0065\u0020\u0074\u006f\u0020\u006c\u006f\u0063\u0061t\u0065\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u0020\u0069\u006e\u0020\u0078\u0072\u0065\u0066\u0073\u0021 \u002d\u0020\u0052\u0065\u0074u\u0072\u006e\u0069\u006e\u0067\u0020\u006e\u0075\u006c\u006c\u0020\u006f\u0062\u006a\u0065\u0063\u0074"); 330 var _dcb PdfObjectNull ;return &_dcb ,false ,nil ;};_df .Log .Trace ("L\u006fo\u006b\u0075\u0070\u0020\u006f\u0062\u006a\u0020n\u0075\u006d\u0062\u0065r \u0025\u0064",_ef );if _fad .XType ==XrefTypeTableEntry {_df .Log .Trace ("\u0078r\u0065f\u006f\u0062\u006a\u0020\u006fb\u006a\u0020n\u0075\u006d\u0020\u0025\u0064",_fad .ObjectNumber ); 331 _df .Log .Trace ("\u0078\u0072\u0065\u0066\u006f\u0062\u006a\u0020\u0067e\u006e\u0020\u0025\u0064",_fad .Generation );_df .Log .Trace ("\u0078\u0072\u0065\u0066\u006f\u0062\u006a\u0020\u006f\u0066\u0066\u0073e\u0074\u0020\u0025\u0064",_fad .Offset );_cgf ._abdga .Seek (_fad .Offset ,_gd .SeekStart ); 332 _cgf ._gcec =_fd .NewReader (_cgf ._abdga );_cce ,_dfe :=_cgf .ParseIndirectObject ();if _dfe !=nil {_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u0020\u0046\u0061\u0069\u006ce\u0064\u0020\u0072\u0065\u0061\u0064\u0069n\u0067\u0020\u0078\u0072\u0065\u0066\u0020\u0028\u0025\u0073\u0029",_dfe ); 333 if _dce {_df .Log .Debug ("\u0041\u0074t\u0065\u006d\u0070\u0074i\u006e\u0067 \u0074\u006f\u0020\u0072\u0065\u0070\u0061\u0069r\u0020\u0078\u0072\u0065\u0066\u0073\u0020\u0028\u0074\u006f\u0070\u0020d\u006f\u0077\u006e\u0029");_fdc ,_fgc :=_cgf .repairRebuildXrefsTopDown (); 334 if _fgc !=nil {_df .Log .Debug ("\u0045R\u0052\u004f\u0052\u0020\u0046\u0061\u0069\u006c\u0065\u0064\u0020r\u0065\u0070\u0061\u0069\u0072\u0020\u0028\u0025\u0073\u0029",_fgc );return nil ,false ,_fgc ;};_cgf ._ggaf =*_fdc ;return _cgf .lookupByNumber (_ef ,false ); 335 };return nil ,false ,_dfe ;};if _dce {_ad ,_ ,_ :=_ffe (_cce );if int (_ad )!=_ef {_df .Log .Debug ("\u0049n\u0076\u0061\u006c\u0069d\u0020\u0078\u0072\u0065\u0066s\u003a \u0052e\u0062\u0075\u0069\u006c\u0064\u0069\u006eg");_fadf :=_cgf .rebuildXrefTable (); 336 if _fadf !=nil {return nil ,false ,_fadf ;};_cgf .ObjCache =objectCache {};return _cgf .lookupByNumberWrapper (_ef ,false );};};_df .Log .Trace ("\u0052\u0065\u0074\u0075\u0072\u006e\u0069\u006e\u0067\u0020\u006f\u0062\u006a");_cgf .ObjCache [_ef ]=_cce ; 337 return _cce ,false ,nil ;}else if _fad .XType ==XrefTypeObjectStream {_df .Log .Trace ("\u0078r\u0065\u0066\u0020\u0066\u0072\u006f\u006d\u0020\u006f\u0062\u006ae\u0063\u0074\u0020\u0073\u0074\u0072\u0065\u0061\u006d\u0021");_df .Log .Trace ("\u003e\u004c\u006f\u0061\u0064\u0020\u0076\u0069\u0061\u0020\u004f\u0053\u0021"); 338 _df .Log .Trace ("\u004f\u0062\u006a\u0065\u0063\u0074\u0020\u0073\u0074\u0072\u0065\u0061\u006d \u0061\u0076\u0061\u0069\u006c\u0061b\u006c\u0065\u0020\u0069\u006e\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u0020%\u0064\u002f\u0025\u0064",_fad .OsObjNumber ,_fad .OsObjIndex ); 339 if _fad .OsObjNumber ==_ef {_df .Log .Debug ("E\u0052\u0052\u004f\u0052\u0020\u0043i\u0072\u0063\u0075\u006c\u0061\u0072\u0020\u0072\u0065f\u0065\u0072\u0065n\u0063e\u0021\u003f\u0021");return nil ,true ,_a .New ("\u0078\u0072\u0065f \u0063\u0069\u0072\u0063\u0075\u006c\u0061\u0072\u0020\u0072\u0065\u0066\u0065\u0072\u0065\u006e\u0063\u0065"); 340 };if _ ,_fga :=_cgf ._ggaf .ObjectMap [_fad .OsObjNumber ];_fga {_bf ,_ace :=_cgf .lookupObjectViaOS (_fad .OsObjNumber ,_ef );if _ace !=nil {_df .Log .Debug ("\u0045R\u0052\u004f\u0052\u0020\u0052\u0065\u0074\u0075\u0072\u006e\u0069n\u0067\u0020\u0045\u0052\u0052\u0020\u0028\u0025\u0073\u0029",_ace ); 341 return nil ,true ,_ace ;};_df .Log .Trace ("\u003c\u004c\u006f\u0061\u0064\u0065\u0064\u0020\u0076i\u0061\u0020\u004f\u0053");_cgf .ObjCache [_ef ]=_bf ;if _cgf ._acg !=nil {_cgf ._acg ._gee [_bf ]=true ;};return _bf ,true ,nil ;};_df .Log .Debug ("\u003f\u003f\u0020\u0042\u0065\u006c\u006f\u006eg\u0073\u0020\u0074o \u0061\u0020\u006e\u006f\u006e\u002dc\u0072\u006f\u0073\u0073\u0020\u0072\u0065\u0066\u0065\u0072\u0065\u006e\u0063\u0065\u0064 \u006f\u0062\u006a\u0065\u0063\u0074\u0020\u002e.\u002e\u0021"); 342 return nil ,true ,_a .New ("\u006f\u0073\u0020\u0062\u0065\u006c\u006fn\u0067\u0073\u0020t\u006f\u0020\u0061\u0020n\u006f\u006e\u0020\u0063\u0072\u006f\u0073\u0073\u0020\u0072\u0065\u0066\u0065\u0072\u0065\u006e\u0063\u0065\u0064\u0020\u006f\u0062\u006a\u0065\u0063\u0074"); 343 };return nil ,false ,_a .New ("\u0075\u006e\u006b\u006e\u006f\u0077\u006e\u0020\u0078\u0072\u0065\u0066 \u0074\u0079\u0070\u0065");}; 344 345 // UpdateParams updates the parameter values of the encoder. 346 func (_cfce *JPXEncoder )UpdateParams (params *PdfObjectDictionary ){};func (_egcf *PdfParser )repairSeekXrefMarker ()error {_fedg ,_fgbcf :=_egcf ._abdga .Seek (0,_gd .SeekEnd );if _fgbcf !=nil {return _fgbcf ;};_cddcgd :=_f .MustCompile ("\u005cs\u0078\u0072\u0065\u0066\u005c\u0073*"); 347 var _eeec int64 ;var _edggg int64 =1000;for _eeec < _fedg {if _fedg <=(_edggg +_eeec ){_edggg =_fedg -_eeec ;};_ ,_ddbbe :=_egcf ._abdga .Seek (-_eeec -_edggg ,_gd .SeekEnd );if _ddbbe !=nil {return _ddbbe ;};_ebgf :=make ([]byte ,_edggg );_egcf ._abdga .Read (_ebgf ); 348 _df .Log .Trace ("\u004c\u006f\u006fki\u006e\u0067\u0020\u0066\u006f\u0072\u0020\u0078\u0072\u0065\u0066\u0020\u003a\u0020\u0022\u0025\u0073\u0022",string (_ebgf ));_cdebf :=_cddcgd .FindAllStringIndex (string (_ebgf ),-1);if _cdebf !=nil {_cagea :=_cdebf [len (_cdebf )-1]; 349 _df .Log .Trace ("\u0049\u006e\u0064\u003a\u0020\u0025\u0020\u0064",_cdebf );_egcf ._abdga .Seek (-_eeec -_edggg +int64 (_cagea [0]),_gd .SeekEnd );_egcf ._gcec =_fd .NewReader (_egcf ._abdga );for {_acfe ,_abfb :=_egcf ._gcec .Peek (1);if _abfb !=nil {return _abfb ; 350 };_df .Log .Trace ("\u0042\u003a\u0020\u0025\u0064\u0020\u0025\u0063",_acfe [0],_acfe [0]);if !IsWhiteSpace (_acfe [0]){break ;};_egcf ._gcec .Discard (1);};return nil ;};_df .Log .Debug ("\u0057\u0061\u0072\u006e\u0069\u006eg\u003a\u0020\u0045\u004f\u0046\u0020\u006d\u0061\u0072\u006b\u0065\u0072\u0020\u006e\u006f\u0074\u0020\u0066\u006f\u0075n\u0064\u0021\u0020\u002d\u0020\u0063\u006f\u006e\u0074\u0069\u006e\u0075\u0065\u0020s\u0065e\u006b\u0069\u006e\u0067"); 351 _eeec +=_edggg ;};_df .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u003a\u0020\u0058\u0072\u0065\u0066\u0020\u0074a\u0062\u006c\u0065\u0020\u006d\u0061r\u006b\u0065\u0072\u0020\u0077\u0061\u0073\u0020\u006e\u006f\u0074\u0020\u0066o\u0075\u006e\u0064\u002e"); 352 return _a .New ("\u0078r\u0065f\u0020\u006e\u006f\u0074\u0020\u0066\u006f\u0075\u006e\u0064\u0020");}; 353 354 // String returns a string describing `ref`. 355 func (_fgdf *PdfObjectReference )String ()string {return _ea .Sprintf ("\u0052\u0065\u0066\u0028\u0025\u0064\u0020\u0025\u0064\u0029",_fgdf .ObjectNumber ,_fgdf .GenerationNumber );}; 356 357 // Set sets the PdfObject at index i of the streams. An error is returned if the index is outside bounds. 358 func (_edff *PdfObjectStreams )Set (i int ,obj PdfObject )error {if i < 0||i >=len (_edff ._dgbb ){return _a .New ("\u004f\u0075\u0074\u0073\u0069\u0064\u0065\u0020\u0062o\u0075\u006e\u0064\u0073");};_edff ._dgbb [i ]=obj ;return nil ;}; 359 360 // CCITTFaxEncoder implements Group3 and Group4 facsimile (fax) encoder/decoder. 361 type CCITTFaxEncoder struct{K int ;EndOfLine bool ;EncodedByteAlign bool ;Columns int ;Rows int ;EndOfBlock bool ;BlackIs1 bool ;DamagedRowsBeforeError int ;};func _daca (_aacd *PdfObjectStream ,_aca *PdfObjectDictionary )(*FlateEncoder ,error ){_gadd :=NewFlateEncoder (); 362 _cabf :=_aacd .PdfObjectDictionary ;if _cabf ==nil {return _gadd ,nil ;};_gadd ._dade =_cfcd (_cabf );if _aca ==nil {_ggbe :=TraceToDirectObject (_cabf .Get ("D\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0072\u006d\u0073"));switch _dgfb :=_ggbe .(type ){case *PdfObjectArray :if _dgfb .Len ()!=1{_df .Log .Debug ("\u0045\u0072\u0072\u006f\u0072:\u0020\u0044\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0072\u006d\u0073\u0020a\u0072\u0072\u0061\u0079\u0020\u006c\u0065\u006e\u0067\u0074\u0068\u0020\u0021\u003d\u0020\u0031\u0020\u0028\u0025\u0064\u0029",_dgfb .Len ()); 363 return nil ,_a .New ("\u0072\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b\u0020e\u0072\u0072\u006f\u0072");};if _gegd ,_eafe :=GetDict (_dgfb .Get (0));_eafe {_aca =_gegd ;};case *PdfObjectDictionary :_aca =_dgfb ;case *PdfObjectNull ,nil :default:_df .Log .Debug ("E\u0072\u0072\u006f\u0072\u003a\u0020\u0044\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0072\u006d\u0073\u0020n\u006f\u0074\u0020\u0061\u0020\u0064\u0069\u0063\u0074\u0069on\u0061\u0072\u0079 \u0028%\u0054\u0029",_ggbe ); 364 return nil ,_ea .Errorf ("\u0069\u006e\u0076\u0061li\u0064\u0020\u0044\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0072\u006d\u0073");};};if _aca ==nil {return _gadd ,nil ;};_df .Log .Trace ("\u0064\u0065\u0063\u006f\u0064\u0065\u0020\u0070\u0061\u0072\u0061\u006ds\u003a\u0020\u0025\u0073",_aca .String ()); 365 _gfg :=_aca .Get ("\u0050r\u0065\u0064\u0069\u0063\u0074\u006fr");if _gfg ==nil {_df .Log .Debug ("E\u0072\u0072o\u0072\u003a\u0020\u0050\u0072\u0065\u0064\u0069\u0063\u0074\u006f\u0072\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067 \u0066\u0072\u006f\u006d\u0020\u0044\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0072\u006d\u0073 \u002d\u0020\u0043\u006f\u006e\u0074\u0069\u006e\u0075\u0065\u0020\u0077\u0069t\u0068\u0020\u0064\u0065\u0066\u0061\u0075\u006c\u0074\u0020\u00281\u0029"); 366 }else {_dba ,_daa :=_gfg .(*PdfObjectInteger );if !_daa {_df .Log .Debug ("E\u0072\u0072\u006f\u0072\u003a\u0020\u0050\u0072\u0065d\u0069\u0063\u0074\u006f\u0072\u0020\u0073pe\u0063\u0069\u0066\u0069e\u0064\u0020\u0062\u0075\u0074\u0020\u006e\u006f\u0074 n\u0075\u006de\u0072\u0069\u0063\u0020\u0028\u0025\u0054\u0029",_gfg ); 367 return nil ,_ea .Errorf ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0050\u0072\u0065\u0064i\u0063\u0074\u006f\u0072");};_gadd .Predictor =int (*_dba );};_gfg =_aca .Get ("\u0042\u0069t\u0073\u0050\u0065r\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074"); 368 if _gfg !=nil {_baf ,_gag :=_gfg .(*PdfObjectInteger );if !_gag {_df .Log .Debug ("\u0045\u0052\u0052O\u0052\u003a\u0020\u0049n\u0076\u0061\u006c\u0069\u0064\u0020\u0042i\u0074\u0073\u0050\u0065\u0072\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074"); 369 return nil ,_ea .Errorf ("\u0069n\u0076\u0061\u006c\u0069\u0064\u0020\u0042\u0069\u0074\u0073\u0050e\u0072\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074");};_gadd .BitsPerComponent =int (*_baf );};if _gadd .Predictor > 1{_gadd .Columns =1;_gfg =_aca .Get ("\u0043o\u006c\u0075\u006d\u006e\u0073"); 370 if _gfg !=nil {_cfff ,_dafg :=_gfg .(*PdfObjectInteger );if !_dafg {return nil ,_ea .Errorf ("\u0070r\u0065\u0064\u0069\u0063\u0074\u006f\u0072\u0020\u0063\u006f\u006cu\u006d\u006e\u0020\u0069\u006e\u0076\u0061\u006c\u0069\u0064");};_gadd .Columns =int (*_cfff ); 371 };_gadd .Colors =1;_gfg =_aca .Get ("\u0043\u006f\u006c\u006f\u0072\u0073");if _gfg !=nil {_fbb ,_gadb :=_gfg .(*PdfObjectInteger );if !_gadb {return nil ,_ea .Errorf ("\u0070\u0072\u0065d\u0069\u0063\u0074\u006fr\u0020\u0063\u006f\u006c\u006f\u0072\u0073 \u006e\u006f\u0074\u0020\u0061\u006e\u0020\u0069\u006e\u0074\u0065\u0067\u0065\u0072"); 372 };_gadd .Colors =int (*_fbb );};};return _gadd ,nil ;}; 373 374 // GetStream returns the *PdfObjectStream represented by the PdfObject. On type mismatch the found bool flag is 375 // false and a nil pointer is returned. 376 func GetStream (obj PdfObject )(_bdgbd *PdfObjectStream ,_fbddf bool ){obj =ResolveReference (obj );_bdgbd ,_fbddf =obj .(*PdfObjectStream );return _bdgbd ,_fbddf ;}; 377 378 // WriteString outputs the object as it is to be written to file. 379 func (_dbcag *PdfObjectInteger )WriteString ()string {return _be .FormatInt (int64 (*_dbcag ),10)}; 380 381 // PdfCryptNewEncrypt makes the document crypt handler based on a specified crypt filter. 382 func PdfCryptNewEncrypt (cf _gc .Filter ,userPass ,ownerPass []byte ,perm _gb .Permissions )(*PdfCrypt ,*EncryptInfo ,error ){_ddf :=&PdfCrypt {_fag :make (map[PdfObject ]bool ),_bde :make (cryptFilters ),_bga :_gb .StdEncryptDict {P :perm ,EncryptMetadata :true }}; 383 var _bdg Version ;if cf !=nil {_bef :=cf .PDFVersion ();_bdg .Major ,_bdg .Minor =_bef [0],_bef [1];V ,R :=cf .HandlerVersion ();_ddf ._dgc .V =V ;_ddf ._bga .R =R ;_ddf ._dgc .Length =cf .KeyLength ()*8;};const (_cdb =_gfb ;);_ddf ._bde [_cdb ]=cf ;if _ddf ._dgc .V >=4{_ddf ._ddfb =_cdb ; 384 _ddf ._fbe =_cdb ;};_bbd :=_ddf .newEncryptDict ();_ee :=_fff .Sum ([]byte (_eca .Now ().Format (_eca .RFC850 )));_ffef :=string (_ee [:]);_dcf :=make ([]byte ,100);_fc .Read (_dcf );_ee =_fff .Sum (_dcf );_fbd :=string (_ee [:]);_df .Log .Trace ("\u0052\u0061\u006e\u0064\u006f\u006d\u0020\u0062\u003a\u0020\u0025\u0020\u0078",_dcf ); 385 _df .Log .Trace ("\u0047\u0065\u006e\u0020\u0049\u0064\u0020\u0030\u003a\u0020\u0025\u0020\u0078",_ffef );_ddf ._geg =_ffef ;_cdeb :=_ddf .generateParams (userPass ,ownerPass );if _cdeb !=nil {return nil ,nil ,_cdeb ;};_ggd (&_ddf ._bga ,_bbd );if _ddf ._dgc .V >=4{if _ccd :=_ddf .saveCryptFilters (_bbd ); 386 _ccd !=nil {return nil ,nil ,_ccd ;};};return _ddf ,&EncryptInfo {Version :_bdg ,Encrypt :_bbd ,ID0 :_ffef ,ID1 :_fbd },nil ;}; 387 388 // MakeArrayFromIntegers64 creates an PdfObjectArray from a slice of int64s, where each array element 389 // is an PdfObjectInteger. 390 func MakeArrayFromIntegers64 (vals []int64 )*PdfObjectArray {_dgdf :=MakeArray ();for _ ,_fdabe :=range vals {_dgdf .Append (MakeInteger (_fdabe ));};return _dgdf ;};func _edege (_eaaef ,_degebc PdfObject ,_aece int )bool {if _aece > _abedf {_df .Log .Error ("\u0054\u0072ac\u0065\u0020\u0064e\u0070\u0074\u0068\u0020lev\u0065l \u0062\u0065\u0079\u006f\u006e\u0064\u0020%d\u0020\u002d\u0020\u0065\u0072\u0072\u006fr\u0021",_abedf ); 391 return false ;};if _eaaef ==nil &&_degebc ==nil {return true ;}else if _eaaef ==nil ||_degebc ==nil {return false ;};if _e .TypeOf (_eaaef )!=_e .TypeOf (_degebc ){return false ;};switch _gfcb :=_eaaef .(type ){case *PdfObjectNull ,*PdfObjectReference :return true ; 392 case *PdfObjectName :return *_gfcb ==*(_degebc .(*PdfObjectName ));case *PdfObjectString :return *_gfcb ==*(_degebc .(*PdfObjectString ));case *PdfObjectInteger :return *_gfcb ==*(_degebc .(*PdfObjectInteger ));case *PdfObjectBool :return *_gfcb ==*(_degebc .(*PdfObjectBool )); 393 case *PdfObjectFloat :return *_gfcb ==*(_degebc .(*PdfObjectFloat ));case *PdfIndirectObject :return _edege (TraceToDirectObject (_eaaef ),TraceToDirectObject (_degebc ),_aece +1);case *PdfObjectArray :_ddab :=_degebc .(*PdfObjectArray );if len ((*_gfcb )._cdea )!=len ((*_ddab )._cdea ){return false ; 394 };for _eged ,_bcbafe :=range (*_gfcb )._cdea {if !_edege (_bcbafe ,(*_ddab )._cdea [_eged ],_aece +1){return false ;};};return true ;case *PdfObjectDictionary :_cdeggg :=_degebc .(*PdfObjectDictionary );_fbac ,_cbbg :=(*_gfcb )._ccfa ,(*_cdeggg )._ccfa ; 395 if len (_fbac )!=len (_cbbg ){return false ;};for _cfdb ,_ccee :=range _fbac {_cbfdc ,_ffca :=_cbbg [_cfdb ];if !_ffca ||!_edege (_ccee ,_cbfdc ,_aece +1){return false ;};};return true ;case *PdfObjectStream :_eabaf :=_degebc .(*PdfObjectStream );return _edege ((*_gfcb ).PdfObjectDictionary ,(*_eabaf ).PdfObjectDictionary ,_aece +1); 396 default:_df .Log .Error ("\u0045\u0052R\u004f\u0052\u003a\u0020\u0055\u006e\u006b\u006e\u006f\u0077\u006e\u0020\u0074\u0079\u0070\u0065\u003a\u0020\u0025\u0054\u0020\u002d\u0020\u0073\u0068\u006f\u0075\u006c\u0064\u0020\u006e\u0065\u0076\u0065\u0072\u0020\u0068\u0061\u0070\u0070\u0065\u006e\u0021",_eaaef ); 397 };return false ;};func (_bec *PdfParser )lookupObjectViaOS (_dff int ,_ab int )(PdfObject ,error ){var _ge *_d .Reader ;var _dgg objectStream ;var _ce bool ;_dgg ,_ce =_bec ._aeede [_dff ];if !_ce {_gca ,_cdc :=_bec .LookupByNumber (_dff );if _cdc !=nil {_df .Log .Debug ("\u004d\u0069ss\u0069\u006e\u0067 \u006f\u0062\u006a\u0065ct \u0073tr\u0065\u0061\u006d\u0020\u0077\u0069\u0074h \u006e\u0075\u006d\u0062\u0065\u0072\u0020%\u0064",_dff ); 398 return nil ,_cdc ;};_fee ,_da :=_gca .(*PdfObjectStream );if !_da {return nil ,_a .New ("i\u006e\u0076\u0061\u006cid\u0020o\u0062\u006a\u0065\u0063\u0074 \u0073\u0074\u0072\u0065\u0061\u006d");};if _bec ._acg !=nil &&!_bec ._acg .isDecrypted (_fee ){return nil ,_a .New ("\u006e\u0065\u0065\u0064\u0020\u0074\u006f\u0020\u0064\u0065\u0063r\u0079\u0070\u0074\u0020\u0074\u0068\u0065\u0020\u0073\u0074r\u0065\u0061\u006d"); 399 };_aaa :=_fee .PdfObjectDictionary ;_df .Log .Trace ("\u0073o\u0020\u0064\u003a\u0020\u0025\u0073\n",_aaa .String ());_dfd ,_da :=_aaa .Get ("\u0054\u0079\u0070\u0065").(*PdfObjectName );if !_da {_df .Log .Debug ("\u0045\u0052R\u004f\u0052\u003a\u0020\u004f\u0062\u006a\u0065\u0063\u0074\u0020\u0073\u0074\u0072\u0065\u0061\u006d\u0020\u0073\u0068\u006f\u0075\u006c\u0064\u0020\u0061\u006c\u0077\u0061\u0079\u0073\u0020\u0068\u0061\u0076\u0065\u0020\u0061\u0020\u0054\u0079\u0070\u0065"); 400 return nil ,_a .New ("\u006f\u0062\u006a\u0065\u0063\u0074\u0020\u0073\u0074\u0072\u0065a\u006d\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020T\u0079\u0070\u0065");};if _cb .ToLower (string (*_dfd ))!="\u006f\u0062\u006a\u0073\u0074\u006d"{_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u004f\u0062\u006a\u0065\u0063\u0074\u0020\u0073\u0074\u0072\u0065a\u006d\u0020\u0074\u0079\u0070\u0065\u0020s\u0068\u0061\u006c\u006c\u0020\u0061\u006c\u0077\u0061\u0079\u0073 \u0062\u0065\u0020\u004f\u0062\u006a\u0053\u0074\u006d\u0020\u0021"); 401 return nil ,_a .New ("\u006f\u0062\u006a\u0065c\u0074\u0020\u0073\u0074\u0072\u0065\u0061\u006d\u0020\u0074y\u0070e\u0020\u0021\u003d\u0020\u004f\u0062\u006aS\u0074\u006d");};N ,_da :=_aaa .Get ("\u004e").(*PdfObjectInteger );if !_da {return nil ,_a .New ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u004e\u0020i\u006e\u0020\u0073\u0074\u0072\u0065\u0061m\u0020\u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061\u0072\u0079"); 402 };_fa ,_da :=_aaa .Get ("\u0046\u0069\u0072s\u0074").(*PdfObjectInteger );if !_da {return nil ,_a .New ("\u0069\u006e\u0076al\u0069\u0064\u0020\u0046\u0069\u0072\u0073\u0074\u0020i\u006e \u0073t\u0072e\u0061\u006d\u0020\u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061\u0072\u0079"); 403 };_df .Log .Trace ("\u0074\u0079\u0070\u0065\u003a\u0020\u0025\u0073\u0020\u006eu\u006d\u0062\u0065\u0072\u0020\u006f\u0066 \u006f\u0062\u006a\u0065\u0063\u0074\u0073\u003a\u0020\u0025\u0064",_dfd ,*N );_abc ,_cdc :=DecodeStream (_fee );if _cdc !=nil {return nil ,_cdc ; 404 };_df .Log .Trace ("D\u0065\u0063\u006f\u0064\u0065\u0064\u003a\u0020\u0025\u0073",_abc );_acf :=_bec .GetFileOffset ();defer func (){_bec .SetFileOffset (_acf )}();_ge =_d .NewReader (_abc );_bec ._gcec =_fd .NewReader (_ge );_df .Log .Trace ("\u0050a\u0072s\u0069\u006e\u0067\u0020\u006ff\u0066\u0073e\u0074\u0020\u006d\u0061\u0070"); 405 _dad :=map[int ]int64 {};for _aac :=0;_aac < int (*N );_aac ++{_bec .skipSpaces ();_ecaf ,_dbg :=_bec .parseNumber ();if _dbg !=nil {return nil ,_dbg ;};_ecf ,_abd :=_ecaf .(*PdfObjectInteger );if !_abd {return nil ,_a .New ("\u0069\u006e\u0076al\u0069\u0064\u0020\u006f\u0062\u006a\u0065\u0063\u0074 \u0073t\u0072e\u0061m\u0020\u006f\u0066\u0066\u0073\u0065\u0074\u0020\u0074\u0061\u0062\u006c\u0065"); 406 };_bec .skipSpaces ();_ecaf ,_dbg =_bec .parseNumber ();if _dbg !=nil {return nil ,_dbg ;};_ffd ,_abd :=_ecaf .(*PdfObjectInteger );if !_abd {return nil ,_a .New ("\u0069\u006e\u0076al\u0069\u0064\u0020\u006f\u0062\u006a\u0065\u0063\u0074 \u0073t\u0072e\u0061m\u0020\u006f\u0066\u0066\u0073\u0065\u0074\u0020\u0074\u0061\u0062\u006c\u0065"); 407 };_df .Log .Trace ("\u006f\u0062j\u0020\u0025\u0064 \u006f\u0066\u0066\u0073\u0065\u0074\u0020\u0025\u0064",*_ecf ,*_ffd );_dad [int (*_ecf )]=int64 (*_fa +*_ffd );};_dgg =objectStream {N :int (*N ),_dcc :_abc ,_ece :_dad };_bec ._aeede [_dff ]=_dgg ;}else {_beca :=_bec .GetFileOffset (); 408 defer func (){_bec .SetFileOffset (_beca )}();_ge =_d .NewReader (_dgg ._dcc );_bec ._gcec =_fd .NewReader (_ge );};_beb :=_dgg ._ece [_ab ];_df .Log .Trace ("\u0041\u0043\u0054\u0055AL\u0020\u006f\u0066\u0066\u0073\u0065\u0074\u005b\u0025\u0064\u005d\u0020\u003d\u0020%\u0064",_ab ,_beb ); 409 _ge .Seek (_beb ,_gd .SeekStart );_bec ._gcec =_fd .NewReader (_ge );_gcc ,_ :=_bec ._gcec .Peek (100);_df .Log .Trace ("\u004f\u0042\u004a\u0020\u0070\u0065\u0065\u006b\u0020\u0022\u0025\u0073\u0022",string (_gcc ));_cec ,_bb :=_bec .parseObject ();if _bb !=nil {_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u0020\u0046\u0061\u0069\u006c \u0074\u006f\u0020\u0072\u0065\u0061\u0064 \u006f\u0062\u006a\u0065\u0063\u0074\u0020\u0028\u0025\u0073\u0029",_bb ); 410 return nil ,_bb ;};if _cec ==nil {return nil ,_a .New ("o\u0062\u006a\u0065\u0063t \u0063a\u006e\u006e\u006f\u0074\u0020b\u0065\u0020\u006e\u0075\u006c\u006c");};_fda :=PdfIndirectObject {};_fda .ObjectNumber =int64 (_ab );_fda .PdfObject =_cec ;_fda ._egcg =_bec ; 411 return &_fda ,nil ;}; 412 413 // MakeStreamDict makes a new instance of an encoding dictionary for a stream object. 414 func (_cebe *ASCIIHexEncoder )MakeStreamDict ()*PdfObjectDictionary {_cdcb :=MakeDict ();_cdcb .Set ("\u0046\u0069\u006c\u0074\u0065\u0072",MakeName (_cebe .GetFilterName ()));return _cdcb ;};func _cgc (_gccg *_gc .FilterDict ,_ebf *PdfObjectDictionary )error {if _bgae ,_bgf :=_ebf .Get ("\u0054\u0079\u0070\u0065").(*PdfObjectName ); 415 _bgf {if _abdg :=string (*_bgae );_abdg !="C\u0072\u0079\u0070\u0074\u0046\u0069\u006c\u0074\u0065\u0072"{_df .Log .Debug ("\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020C\u0046\u0020\u0064ic\u0074\u0020\u0074\u0079\u0070\u0065:\u0020\u0025\u0073\u0020\u0028\u0073\u0068\u006f\u0075\u006c\u0064\u0020\u0062\u0065\u0020C\u0072\u0079\u0070\u0074\u0046\u0069\u006c\u0074e\u0072\u0029",_abdg ); 416 };};_bge ,_eag :=_ebf .Get ("\u0043\u0046\u004d").(*PdfObjectName );if !_eag {return _ea .Errorf ("\u0075\u006e\u0073u\u0070\u0070\u006f\u0072t\u0065\u0064\u0020\u0063\u0072\u0079\u0070t\u0020\u0066\u0069\u006c\u0074\u0065\u0072\u0020\u0028\u004e\u006f\u006e\u0065\u0029"); 417 };_gccg .CFM =string (*_bge );if _egbd ,_cga :=_ebf .Get ("\u0041u\u0074\u0068\u0045\u0076\u0065\u006et").(*PdfObjectName );_cga {_gccg .AuthEvent =_gb .AuthEvent (*_egbd );}else {_gccg .AuthEvent =_gb .EventDocOpen ;};if _ffc ,_eee :=_ebf .Get ("\u004c\u0065\u006e\u0067\u0074\u0068").(*PdfObjectInteger ); 418 _eee {_gccg .Length =int (*_ffc );};return nil ;}; 419 420 // XrefObject defines a cross reference entry which is a map between object number (with generation number) and the 421 // location of the actual object, either as a file offset (xref table entry), or as a location within an xref 422 // stream object (xref object stream). 423 type XrefObject struct{XType xrefType ;ObjectNumber int ;Generation int ; 424 425 // For normal xrefs (defined by OFFSET) 426 Offset int64 ; 427 428 // For xrefs to object streams. 429 OsObjNumber int ;OsObjIndex int ;};func (_gffe *PdfParser )parseHexString ()(*PdfObjectString ,error ){_gffe ._gcec .ReadByte ();var _cecgd _d .Buffer ;for {_eecd ,_cgeg :=_gffe ._gcec .Peek (1);if _cgeg !=nil {return MakeString (""),_cgeg ;};if _eecd [0]=='>'{_gffe ._gcec .ReadByte (); 430 break ;};_dagd ,_ :=_gffe ._gcec .ReadByte ();if _gffe ._dcad {if _d .IndexByte (_dfde ,_dagd )==-1{_gffe ._ffge ._feed =true ;};};if !IsWhiteSpace (_dagd ){_cecgd .WriteByte (_dagd );};};if _cecgd .Len ()%2==1{_gffe ._ffge ._faae =true ;_cecgd .WriteRune ('0'); 431 };_afegc ,_ :=_ac .DecodeString (_cecgd .String ());return MakeHexString (string (_afegc )),nil ;};func (_gfdg *PdfParser )parseNumber ()(PdfObject ,error ){return ParseNumber (_gfdg ._gcec )}; 432 433 // GetEncryptObj returns the PdfIndirectObject which has information about the PDFs encryption details. 434 func (_ggcg *PdfParser )GetEncryptObj ()*PdfIndirectObject {return _ggcg ._bgafa };func _defa (_bad *PdfObjectStream ,_gbgb *MultiEncoder )(*DCTEncoder ,error ){_fcd :=NewDCTEncoder ();_bbg :=_bad .PdfObjectDictionary ;if _bbg ==nil {return _fcd ,nil ; 435 };_gagf :=_bad .Stream ;if _gbgb !=nil {_faac ,_dgdc :=_gbgb .DecodeBytes (_gagf );if _dgdc !=nil {return nil ,_dgdc ;};_gagf =_faac ;};_gbbc :=_d .NewReader (_gagf );_baag ,_bgaae :=_bg .DecodeConfig (_gbbc );if _bgaae !=nil {_df .Log .Debug ("\u0045\u0072\u0072or\u0020\u0064\u0065\u0063\u006f\u0064\u0069\u006e\u0067\u0020\u0066\u0069\u006c\u0065\u003a\u0020\u0025\u0073",_bgaae ); 436 return nil ,_bgaae ;};switch _baag .ColorModel {case _fe .RGBAModel :_fcd .BitsPerComponent =8;_fcd .ColorComponents =3;_fcd .Decode =[]float64 {0.0,1.0,0.0,1.0,0.0,1.0};case _fe .RGBA64Model :_fcd .BitsPerComponent =16;_fcd .ColorComponents =3;_fcd .Decode =[]float64 {0.0,1.0,0.0,1.0,0.0,1.0}; 437 case _fe .GrayModel :_fcd .BitsPerComponent =8;_fcd .ColorComponents =1;_fcd .Decode =[]float64 {0.0,1.0};case _fe .Gray16Model :_fcd .BitsPerComponent =16;_fcd .ColorComponents =1;_fcd .Decode =[]float64 {0.0,1.0};case _fe .CMYKModel :_fcd .BitsPerComponent =8; 438 _fcd .ColorComponents =4;_fcd .Decode =[]float64 {0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0};case _fe .YCbCrModel :_fcd .BitsPerComponent =8;_fcd .ColorComponents =3;_fcd .Decode =[]float64 {0.0,1.0,0.0,1.0,0.0,1.0};default:return nil ,_a .New ("\u0075\u006e\u0073up\u0070\u006f\u0072\u0074\u0065\u0064\u0020\u0063\u006f\u006c\u006f\u0072\u0020\u006d\u006f\u0064\u0065\u006c"); 439 };_fcd .Width =_baag .Width ;_fcd .Height =_baag .Height ;_df .Log .Trace ("\u0044\u0043T\u0020\u0045\u006ec\u006f\u0064\u0065\u0072\u003a\u0020\u0025\u002b\u0076",_fcd );_fcd .Quality =DefaultJPEGQuality ;_eaea ,_gde :=GetArray (_bbg .Get ("\u0044\u0065\u0063\u006f\u0064\u0065")); 440 if _gde {_geag ,_dfea :=_eaea .ToFloat64Array ();if _dfea !=nil {return _fcd ,_dfea ;};_fcd .Decode =_geag ;};return _fcd ,nil ;};func _bdbf (_cfaa *PdfObjectStream ,_ead *PdfObjectDictionary )(*LZWEncoder ,error ){_ebgef :=NewLZWEncoder ();_bgag :=_cfaa .PdfObjectDictionary ; 441 if _bgag ==nil {return _ebgef ,nil ;};if _ead ==nil {_gdge :=TraceToDirectObject (_bgag .Get ("D\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0072\u006d\u0073"));if _gdge !=nil {if _agcc ,_fce :=_gdge .(*PdfObjectDictionary );_fce {_ead =_agcc ;}else if _dfa ,_fcef :=_gdge .(*PdfObjectArray ); 442 _fcef {if _dfa .Len ()==1{if _gcag ,_cgfa :=GetDict (_dfa .Get (0));_cgfa {_ead =_gcag ;};};};if _ead ==nil {_df .Log .Error ("\u0044\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0072\u006d\u0073\u0020\u006e\u006f\u0074 \u0061 \u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061\u0072\u0079\u0020\u0025\u0023\u0076",_gdge ); 443 return nil ,_ea .Errorf ("\u0069\u006e\u0076\u0061li\u0064\u0020\u0044\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0072\u006d\u0073");};};};_dgfe :=_bgag .Get ("E\u0061\u0072\u006c\u0079\u0043\u0068\u0061\u006e\u0067\u0065");if _dgfe !=nil {_eddag ,_eea :=_dgfe .(*PdfObjectInteger ); 444 if !_eea {_df .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u003a \u0045\u0061\u0072\u006c\u0079\u0043\u0068\u0061\u006e\u0067\u0065\u0020\u0073\u0070\u0065\u0063\u0069\u0066\u0069\u0065d\u0020\u0062\u0075\u0074\u0020\u006e\u006f\u0074\u0020\u006e\u0075\u006d\u0065\u0072i\u0063 \u0028\u0025\u0054\u0029",_dgfe ); 445 return nil ,_ea .Errorf ("\u0069\u006e\u0076\u0061li\u0064\u0020\u0045\u0061\u0072\u006c\u0079\u0043\u0068\u0061\u006e\u0067\u0065");};if *_eddag !=0&&*_eddag !=1{return nil ,_ea .Errorf ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0045\u0061\u0072\u006c\u0079\u0043\u0068\u0061\u006e\u0067\u0065\u0020\u0076\u0061\u006c\u0075e\u0020\u0028\u006e\u006f\u0074 \u0030\u0020o\u0072\u0020\u0031\u0029"); 446 };_ebgef .EarlyChange =int (*_eddag );}else {_ebgef .EarlyChange =1;};if _ead ==nil {return _ebgef ,nil ;};if _geafb ,_cfca :=GetIntVal (_ead .Get ("E\u0061\u0072\u006c\u0079\u0043\u0068\u0061\u006e\u0067\u0065"));_cfca {if _geafb ==0||_geafb ==1{_ebgef .EarlyChange =_geafb ; 447 }else {_df .Log .Debug ("W\u0041\u0052\u004e\u003a\u0020\u0069n\u0076\u0061\u006c\u0069\u0064\u0020E\u0061\u0072\u006c\u0079\u0043\u0068\u0061n\u0067\u0065\u0020\u0076\u0061\u006c\u0075\u0065\u003a\u0020%\u0064",_geafb );};};_dgfe =_ead .Get ("\u0050r\u0065\u0064\u0069\u0063\u0074\u006fr"); 448 if _dgfe !=nil {_fdabf ,_gbbe :=_dgfe .(*PdfObjectInteger );if !_gbbe {_df .Log .Debug ("E\u0072\u0072\u006f\u0072\u003a\u0020\u0050\u0072\u0065d\u0069\u0063\u0074\u006f\u0072\u0020\u0073pe\u0063\u0069\u0066\u0069e\u0064\u0020\u0062\u0075\u0074\u0020\u006e\u006f\u0074 n\u0075\u006de\u0072\u0069\u0063\u0020\u0028\u0025\u0054\u0029",_dgfe ); 449 return nil ,_ea .Errorf ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0050\u0072\u0065\u0064i\u0063\u0074\u006f\u0072");};_ebgef .Predictor =int (*_fdabf );};_dgfe =_ead .Get ("\u0042\u0069t\u0073\u0050\u0065r\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074"); 450 if _dgfe !=nil {_bcgf ,_cebc :=_dgfe .(*PdfObjectInteger );if !_cebc {_df .Log .Debug ("\u0045\u0052\u0052O\u0052\u003a\u0020\u0049n\u0076\u0061\u006c\u0069\u0064\u0020\u0042i\u0074\u0073\u0050\u0065\u0072\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074"); 451 return nil ,_ea .Errorf ("\u0069n\u0076\u0061\u006c\u0069\u0064\u0020\u0042\u0069\u0074\u0073\u0050e\u0072\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074");};_ebgef .BitsPerComponent =int (*_bcgf );};if _ebgef .Predictor > 1{_ebgef .Columns =1;_dgfe =_ead .Get ("\u0043o\u006c\u0075\u006d\u006e\u0073"); 452 if _dgfe !=nil {_gfab ,_dbec :=_dgfe .(*PdfObjectInteger );if !_dbec {return nil ,_ea .Errorf ("\u0070r\u0065\u0064\u0069\u0063\u0074\u006f\u0072\u0020\u0063\u006f\u006cu\u006d\u006e\u0020\u0069\u006e\u0076\u0061\u006c\u0069\u0064");};_ebgef .Columns =int (*_gfab ); 453 };_ebgef .Colors =1;_dgfe =_ead .Get ("\u0043\u006f\u006c\u006f\u0072\u0073");if _dgfe !=nil {_eaba ,_cad :=_dgfe .(*PdfObjectInteger );if !_cad {return nil ,_ea .Errorf ("\u0070\u0072\u0065d\u0069\u0063\u0074\u006fr\u0020\u0063\u006f\u006c\u006f\u0072\u0073 \u006e\u006f\u0074\u0020\u0061\u006e\u0020\u0069\u006e\u0074\u0065\u0067\u0065\u0072"); 454 };_ebgef .Colors =int (*_eaba );};};_df .Log .Trace ("\u0064\u0065\u0063\u006f\u0064\u0065\u0020\u0070\u0061\u0072\u0061\u006ds\u003a\u0020\u0025\u0073",_ead .String ());return _ebgef ,nil ;};func _bca (_gfgc int )int {_edbee :=_gfgc >>(_dffc -1);return (_gfgc ^_edbee )-_edbee }; 455 456 457 // MakeDecodeParams makes a new instance of an encoding dictionary based on 458 // the current encoder settings. 459 func (_dfcg *MultiEncoder )MakeDecodeParams ()PdfObject {if len (_dfcg ._gbgba )==0{return nil ;};if len (_dfcg ._gbgba )==1{return _dfcg ._gbgba [0].MakeDecodeParams ();};_fgcb :=MakeArray ();_gaeg :=true ;for _ ,_dcfg :=range _dfcg ._gbgba {_cggb :=_dcfg .MakeDecodeParams (); 460 if _cggb ==nil {_fgcb .Append (MakeNull ());}else {_gaeg =false ;_fgcb .Append (_cggb );};};if _gaeg {return nil ;};return _fgcb ;}; 461 462 // NewJBIG2Encoder creates a new JBIG2Encoder. 463 func NewJBIG2Encoder ()*JBIG2Encoder {return &JBIG2Encoder {_efaa :_ecdf .InitEncodeDocument (false )}}; 464 465 // Set sets the dictionary's key -> val mapping entry. Overwrites if key already set. 466 func (_abdgf *PdfObjectDictionary )Set (key PdfObjectName ,val PdfObject ){_abdgf .setWithLock (key ,val ,true );}; 467 468 // FlateEncoder represents Flate encoding. 469 type FlateEncoder struct{Predictor int ;BitsPerComponent int ; 470 471 // For predictors 472 Columns int ;Rows int ;Colors int ;_dade *_cf .ImageBase ;}; 473 474 // EncodeBytes encodes a bytes array and return the encoded value based on the encoder parameters. 475 func (_ddd *FlateEncoder )EncodeBytes (data []byte )([]byte ,error ){if _ddd .Predictor !=1&&_ddd .Predictor !=11{_df .Log .Debug ("E\u006e\u0063\u006f\u0064\u0069\u006e\u0067\u0020\u0065\u0072\u0072\u006f\u0072\u003a\u0020\u0046\u006c\u0061\u0074\u0065\u0045\u006e\u0063\u006f\u0064\u0065r\u0020P\u0072\u0065\u0064\u0069c\u0074\u006fr\u0020\u003d\u0020\u0031\u002c\u0020\u0031\u0031\u0020\u006f\u006e\u006c\u0079\u0020\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064"); 476 return nil ,ErrUnsupportedEncodingParameters ;};if _ddd .Predictor ==11{_eage :=_ddd .Columns ;_acfb :=len (data )/_eage ;if len (data )%_eage !=0{_df .Log .Error ("\u0049n\u0076a\u006c\u0069\u0064\u0020\u0072o\u0077\u0020l\u0065\u006e\u0067\u0074\u0068"); 477 return nil ,_a .New ("\u0069n\u0076a\u006c\u0069\u0064\u0020\u0072o\u0077\u0020l\u0065\u006e\u0067\u0074\u0068");};_cgef :=_d .NewBuffer (nil );_cgca :=make ([]byte ,_eage );for _faef :=0;_faef < _acfb ;_faef ++{_gabd :=data [_eage *_faef :_eage *(_faef +1)]; 478 _cgca [0]=_gabd [0];for _aeee :=1;_aeee < _eage ;_aeee ++{_cgca [_aeee ]=byte (int (_gabd [_aeee ]-_gabd [_aeee -1])%256);};_cgef .WriteByte (1);_cgef .Write (_cgca );};data =_cgef .Bytes ();};var _abf _d .Buffer ;_egbf :=_ecd .NewWriter (&_abf );_egbf .Write (data ); 479 _egbf .Close ();return _abf .Bytes (),nil ;}; 480 481 // GetFilterName returns the name of the encoding filter. 482 func (_bdgf *CCITTFaxEncoder )GetFilterName ()string {return StreamEncodingFilterNameCCITTFax }; 483 484 // DecodeBytes returns the passed in slice of bytes. 485 // The purpose of the method is to satisfy the StreamEncoder interface. 486 func (_ddbe *RawEncoder )DecodeBytes (encoded []byte )([]byte ,error ){return encoded ,nil }; 487 488 // Inspect analyzes the document object structure. Returns a map of object types (by name) with the instance count 489 // as value. 490 func (_bgcf *PdfParser )Inspect ()(map[string ]int ,error ){return _bgcf .inspect ()}; 491 492 // String returns a string describing `streams`. 493 func (_fbgfa *PdfObjectStreams )String ()string {return _ea .Sprintf ("\u004f\u0062j\u0065\u0063\u0074 \u0073\u0074\u0072\u0065\u0061\u006d\u0020\u0025\u0064",_fbgfa .ObjectNumber );};func (_dac *PdfCrypt )newEncryptDict ()*PdfObjectDictionary {_egf :=MakeDict (); 494 _egf .Set ("\u0046\u0069\u006c\u0074\u0065\u0072",MakeName ("\u0053\u0074\u0061\u006e\u0064\u0061\u0072\u0064"));_egf .Set ("\u0056",MakeInteger (int64 (_dac ._dgc .V )));_egf .Set ("\u004c\u0065\u006e\u0067\u0074\u0068",MakeInteger (int64 (_dac ._dgc .Length ))); 495 return _egf ;};var _cadf =_f .MustCompile ("\u005e\u005b\u005c\u002b\u002d\u002e\u005d\u002a\u0028\u005b\u0030\u002d9\u002e\u005d\u002b\u0029");func (_agf *PdfParser )skipSpaces ()(int ,error ){_cabc :=0;for {_afga ,_dfba :=_agf ._gcec .ReadByte ();if _dfba !=nil {return 0,_dfba ; 496 };if IsWhiteSpace (_afga ){_cabc ++;}else {_agf ._gcec .UnreadByte ();break ;};};return _cabc ,nil ;};func (_dfb *PdfCrypt )generateParams (_eaf ,_acb []byte )error {_eeg :=_dfb .securityHandler ();_fae ,_cage :=_eeg .GenerateParams (&_dfb ._bga ,_acb ,_eaf ); 497 if _cage !=nil {return _cage ;};_dfb ._edb =_fae ;return nil ;}; 498 499 // EncodeBytes DCT encodes the passed in slice of bytes. 500 func (_dedb *DCTEncoder )EncodeBytes (data []byte )([]byte ,error ){var _ccdd _ff .Image ;if _dedb .ColorComponents ==1&&_dedb .BitsPerComponent ==8{_ccdd =&_ff .Gray {Rect :_ff .Rect (0,0,_dedb .Width ,_dedb .Height ),Pix :data ,Stride :_cf .BytesPerLine (_dedb .Width ,_dedb .BitsPerComponent ,_dedb .ColorComponents )}; 501 }else {var _bfab error ;_ccdd ,_bfab =_cf .NewImage (_dedb .Width ,_dedb .Height ,_dedb .BitsPerComponent ,_dedb .ColorComponents ,data ,nil ,nil );if _bfab !=nil {return nil ,_bfab ;};};_bcfd :=_bg .Options {};_bcfd .Quality =_dedb .Quality ;var _bdca _d .Buffer ; 502 if _bcfa :=_bg .Encode (&_bdca ,_ccdd ,&_bcfd );_bcfa !=nil {return nil ,_bcfa ;};return _bdca .Bytes (),nil ;}; 503 504 // String returns a descriptive information string about the encryption method used. 505 func (_agc *PdfCrypt )String ()string {if _agc ==nil {return "";};_fde :=_agc ._dgc .Filter +"\u0020\u002d\u0020";if _agc ._dgc .V ==0{_fde +="\u0055\u006e\u0064\u006fcu\u006d\u0065\u006e\u0074\u0065\u0064\u0020\u0061\u006c\u0067\u006f\u0072\u0069\u0074h\u006d"; 506 }else if _agc ._dgc .V ==1{_fde +="\u0052\u0043\u0034:\u0020\u0034\u0030\u0020\u0062\u0069\u0074\u0073";}else if _agc ._dgc .V ==2{_fde +=_ea .Sprintf ("\u0052\u0043\u0034:\u0020\u0025\u0064\u0020\u0062\u0069\u0074\u0073",_agc ._dgc .Length );}else if _agc ._dgc .V ==3{_fde +="U\u006e\u0070\u0075\u0062li\u0073h\u0065\u0064\u0020\u0061\u006cg\u006f\u0072\u0069\u0074\u0068\u006d"; 507 }else if _agc ._dgc .V >=4{_fde +=_ea .Sprintf ("\u0053\u0074r\u0065\u0061\u006d\u0020f\u0069\u006ct\u0065\u0072\u003a\u0020\u0025\u0073\u0020\u002d \u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0066\u0069\u006c\u0074\u0065r\u003a\u0020\u0025\u0073",_agc ._ddfb ,_agc ._fbe ); 508 _fde +="\u003b\u0020C\u0072\u0079\u0070t\u0020\u0066\u0069\u006c\u0074\u0065\u0072\u0073\u003a";for _fbf ,_cbf :=range _agc ._bde {_fde +=_ea .Sprintf ("\u0020\u002d\u0020\u0025\u0073\u003a\u0020\u0025\u0073 \u0028\u0025\u0064\u0029",_fbf ,_cbf .Name (),_cbf .KeyLength ()); 509 };};_cdcc :=_agc .GetAccessPermissions ();_fde +=_ea .Sprintf ("\u0020\u002d\u0020\u0025\u0023\u0076",_cdcc );return _fde ;}; 510 511 // MakeString creates an PdfObjectString from a string. 512 // NOTE: PDF does not use utf-8 string encoding like Go so `s` will often not be a utf-8 encoded 513 // string. 514 func MakeString (s string )*PdfObjectString {_egffg :=PdfObjectString {_bcfef :s };return &_egffg }; 515 516 // UpdateParams updates the parameter values of the encoder. 517 func (_adde *FlateEncoder )UpdateParams (params *PdfObjectDictionary ){_aee ,_bgba :=GetNumberAsInt64 (params .Get ("\u0050r\u0065\u0064\u0069\u0063\u0074\u006fr"));if _bgba ==nil {_adde .Predictor =int (_aee );};_abeg ,_bgba :=GetNumberAsInt64 (params .Get ("\u0042\u0069t\u0073\u0050\u0065r\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074")); 518 if _bgba ==nil {_adde .BitsPerComponent =int (_abeg );};_ggfb ,_bgba :=GetNumberAsInt64 (params .Get ("\u0057\u0069\u0064t\u0068"));if _bgba ==nil {_adde .Columns =int (_ggfb );};_dbcg ,_bgba :=GetNumberAsInt64 (params .Get ("\u0043o\u006co\u0072\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074\u0073")); 519 if _bgba ==nil {_adde .Colors =int (_dbcg );};}; 520 521 // GetFilterName returns the name of the encoding filter. 522 func (_ggfe *ASCII85Encoder )GetFilterName ()string {return StreamEncodingFilterNameASCII85 };func _fcfa (_gefe PdfObject ,_aafdc int ,_fcbfd map[PdfObject ]struct{})error {_df .Log .Trace ("\u0054\u0072\u0061\u0076\u0065\u0072s\u0065\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u0020\u0064\u0061\u0074\u0061 \u0028\u0064\u0065\u0070\u0074\u0068\u0020=\u0020\u0025\u0064\u0029",_aafdc ); 523 if _ ,_gffb :=_fcbfd [_gefe ];_gffb {_df .Log .Trace ("-\u0041\u006c\u0072\u0065ad\u0079 \u0074\u0072\u0061\u0076\u0065r\u0073\u0065\u0064\u002e\u002e\u002e");return nil ;};_fcbfd [_gefe ]=struct{}{};switch _gbgd :=_gefe .(type ){case *PdfIndirectObject :_aebeg :=_gbgd ; 524 _df .Log .Trace ("\u0069\u006f\u003a\u0020\u0025\u0073",_aebeg );_df .Log .Trace ("\u002d\u0020\u0025\u0073",_aebeg .PdfObject );return _fcfa (_aebeg .PdfObject ,_aafdc +1,_fcbfd );case *PdfObjectStream :_egcb :=_gbgd ;return _fcfa (_egcb .PdfObjectDictionary ,_aafdc +1,_fcbfd ); 525 case *PdfObjectDictionary :_ebab :=_gbgd ;_df .Log .Trace ("\u002d\u0020\u0064\u0069\u0063\u0074\u003a\u0020\u0025\u0073",_ebab );for _ ,_fecd :=range _ebab .Keys (){_egbe :=_ebab .Get (_fecd );if _abeba ,_fabb :=_egbe .(*PdfObjectReference );_fabb {_decd :=_abeba .Resolve (); 526 _ebab .Set (_fecd ,_decd );_efcff :=_fcfa (_decd ,_aafdc +1,_fcbfd );if _efcff !=nil {return _efcff ;};}else {_bfca :=_fcfa (_egbe ,_aafdc +1,_fcbfd );if _bfca !=nil {return _bfca ;};};};return nil ;case *PdfObjectArray :_bbaea :=_gbgd ;_df .Log .Trace ("-\u0020\u0061\u0072\u0072\u0061\u0079\u003a\u0020\u0025\u0073",_bbaea ); 527 for _acbd ,_fcaa :=range _bbaea .Elements (){if _adbf ,_ecdbd :=_fcaa .(*PdfObjectReference );_ecdbd {_bfdbd :=_adbf .Resolve ();_bbaea .Set (_acbd ,_bfdbd );_ddgc :=_fcfa (_bfdbd ,_aafdc +1,_fcbfd );if _ddgc !=nil {return _ddgc ;};}else {_fabea :=_fcfa (_fcaa ,_aafdc +1,_fcbfd ); 528 if _fabea !=nil {return _fabea ;};};};return nil ;case *PdfObjectReference :_df .Log .Debug ("E\u0052\u0052\u004f\u0052\u003a\u0020T\u0072\u0061\u0063\u0069\u006e\u0067\u0020\u0061\u0020r\u0065\u0066\u0065r\u0065n\u0063\u0065\u0021");return _a .New ("\u0065r\u0072\u006f\u0072\u0020t\u0072\u0061\u0063\u0069\u006eg\u0020a\u0020r\u0065\u0066\u0065\u0072\u0065\u006e\u0063e"); 529 };return nil ;}; 530 531 // MakeStreamDict makes a new instance of an encoding dictionary for a stream object. 532 func (_dcea *RunLengthEncoder )MakeStreamDict ()*PdfObjectDictionary {_egeg :=MakeDict ();_egeg .Set ("\u0046\u0069\u006c\u0074\u0065\u0072",MakeName (_dcea .GetFilterName ()));return _egeg ;}; 533 534 // GetAccessPermissions returns the PDF access permissions as an AccessPermissions object. 535 func (_dege *PdfCrypt )GetAccessPermissions ()_gb .Permissions {return _dege ._bga .P };type cryptFilters map[string ]_gc .Filter ; 536 537 // MakeStreamDict makes a new instance of an encoding dictionary for a stream object. 538 func (_eecg *MultiEncoder )MakeStreamDict ()*PdfObjectDictionary {_dgfc :=MakeDict ();_dgfc .Set ("\u0046\u0069\u006c\u0074\u0065\u0072",_eecg .GetFilterArray ());for _ ,_cbfe :=range _eecg ._gbgba {_aeed :=_cbfe .MakeStreamDict ();for _ ,_aag :=range _aeed .Keys (){_ffdb :=_aeed .Get (_aag ); 539 if _aag !="\u0046\u0069\u006c\u0074\u0065\u0072"&&_aag !="D\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0072\u006d\u0073"{_dgfc .Set (_aag ,_ffdb );};};};_fdbd :=_eecg .MakeDecodeParams ();if _fdbd !=nil {_dgfc .Set ("D\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0072\u006d\u0073",_fdbd ); 540 };return _dgfc ;}; 541 542 // GetDict returns the *PdfObjectDictionary represented by the PdfObject directly or indirectly within an indirect 543 // object. On type mismatch the found bool flag is false and a nil pointer is returned. 544 func GetDict (obj PdfObject )(_agdb *PdfObjectDictionary ,_acae bool ){_agdb ,_acae =TraceToDirectObject (obj ).(*PdfObjectDictionary );return _agdb ,_acae ;}; 545 546 // GetFilterName returns the names of the underlying encoding filters, 547 // separated by spaces. 548 // Note: This is just a string, should not be used in /Filter dictionary entry. Use GetFilterArray for that. 549 // TODO(v4): Refactor to GetFilter() which can be used for /Filter (either Name or Array), this can be 550 // renamed to String() as a pretty string to use in debugging etc. 551 func (_cdab *MultiEncoder )GetFilterName ()string {_cdac :="";for _fcge ,_cagfc :=range _cdab ._gbgba {_cdac +=_cagfc .GetFilterName ();if _fcge < len (_cdab ._gbgba )-1{_cdac +="\u0020";};};return _cdac ;}; 552 553 // DCTEncoder provides a DCT (JPG) encoding/decoding functionality for images. 554 type DCTEncoder struct{ColorComponents int ;BitsPerComponent int ;Width int ;Height int ;Quality int ;Decode []float64 ;};func _gcda (_fdcaba *PdfObjectStream ,_cggc *PdfObjectDictionary )(*JBIG2Encoder ,error ){const _fbfa ="\u006ee\u0077\u004a\u0042\u0049G\u0032\u0044\u0065\u0063\u006fd\u0065r\u0046r\u006f\u006d\u0053\u0074\u0072\u0065\u0061m"; 555 _faaef :=NewJBIG2Encoder ();_eggf :=_fdcaba .PdfObjectDictionary ;if _eggf ==nil {return _faaef ,nil ;};if _cggc ==nil {_dgbf :=_eggf .Get ("D\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0072\u006d\u0073");if _dgbf !=nil {switch _cfeeg :=_dgbf .(type ){case *PdfObjectDictionary :_cggc =_cfeeg ; 556 case *PdfObjectArray :if _cfeeg .Len ()==1{if _ecfb ,_febb :=GetDict (_cfeeg .Get (0));_febb {_cggc =_ecfb ;};};default:_df .Log .Error ("\u0044\u0065\u0063\u006f\u0064\u0065P\u0061\u0072\u0061\u006d\u0073\u0020\u006e\u006f\u0074\u0020\u0061\u0020\u0064i\u0063\u0074\u0069\u006f\u006e\u0061\u0072y\u0020\u0025\u0023\u0076",_dgbf ); 557 return nil ,_dd .Errorf (_fbfa ,"\u0069\u006e\u0076\u0061l\u0069\u0064\u0020\u0044\u0065\u0063\u006f\u0064\u0065\u0050a\u0072m\u0073\u0020\u0074\u0079\u0070\u0065\u003a \u0025\u0054",_cfeeg );};};};if _cggc ==nil {return _faaef ,nil ;};_faaef .UpdateParams (_cggc ); 558 _dbbb ,_bfda :=GetStream (_cggc .Get ("\u004a\u0042\u0049G\u0032\u0047\u006c\u006f\u0062\u0061\u006c\u0073"));if !_bfda {return _faaef ,nil ;};var _aefac error ;_faaef .Globals ,_aefac =_db .DecodeGlobals (_dbbb .Stream );if _aefac !=nil {_aefac =_dd .Wrap (_aefac ,_fbfa ,"\u0063\u006f\u0072\u0072u\u0070\u0074\u0065\u0064\u0020\u006a\u0062\u0069\u0067\u0032 \u0065n\u0063\u006f\u0064\u0065\u0064\u0020\u0064a\u0074\u0061"); 559 _df .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_aefac );return nil ,_aefac ;};return _faaef ,nil ;}; 560 561 // GetFilterName returns the name of the encoding filter. 562 func (_efcd *ASCIIHexEncoder )GetFilterName ()string {return StreamEncodingFilterNameASCIIHex };func (_geac *PdfParser )parseLinearizedDictionary ()(*PdfObjectDictionary ,error ){_ceae ,_ffgab :=_geac ._abdga .Seek (0,_gd .SeekEnd );if _ffgab !=nil {return nil ,_ffgab ; 563 };var _bafg int64 ;var _gfcfd int64 =2048;for _bafg < _ceae -4{if _ceae <=(_gfcfd +_bafg ){_gfcfd =_ceae -_bafg ;};_ ,_gfda :=_geac ._abdga .Seek (_bafg ,_gd .SeekStart );if _gfda !=nil {return nil ,_gfda ;};_fcdf :=make ([]byte ,_gfcfd );_ ,_gfda =_geac ._abdga .Read (_fcdf ); 564 if _gfda !=nil {return nil ,_gfda ;};_df .Log .Trace ("\u004c\u006f\u006f\u006b\u0069\u006e\u0067\u0020\u0066\u006f\u0072\u0020\u0066i\u0072\u0073\u0074\u0020\u0069\u006ed\u0069\u0072\u0065\u0063\u0074\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u003a \u0022\u0025\u0073\u0022",string (_fcdf )); 565 _fgda :=_bfdf .FindAllStringIndex (string (_fcdf ),-1);if _fgda !=nil {_dgbdb :=_fgda [0];_df .Log .Trace ("\u0049\u006e\u0064\u003a\u0020\u0025\u0020\u0064",_fgda );_ ,_deeg :=_geac ._abdga .Seek (int64 (_dgbdb [0]),_gd .SeekStart );if _deeg !=nil {return nil ,_deeg ; 566 };_geac ._gcec =_fd .NewReader (_geac ._abdga );_bcae ,_deeg :=_geac .ParseIndirectObject ();if _deeg !=nil {return nil ,nil ;};if _eeaa ,_ffbc :=GetIndirect (_bcae );_ffbc {if _aafcc ,_gadge :=GetDict (_eeaa .PdfObject );_gadge {if _ecdc :=_aafcc .Get ("\u004c\u0069\u006e\u0065\u0061\u0072\u0069\u007a\u0065\u0064"); 567 _ecdc !=nil {return _aafcc ,nil ;};return nil ,nil ;};};return nil ,nil ;};_bafg +=_gfcfd -4;};return nil ,_a .New ("\u0074\u0068\u0065\u0020\u0066\u0069\u0072\u0073\u0074\u0020\u006fb\u006a\u0065\u0063\u0074\u0020\u006e\u006f\u0074\u0020\u0066o\u0075\u006e\u0064"); 568 }; 569 570 // Encode encodes previously prepare jbig2 document and stores it as the byte slice. 571 func (_eaab *JBIG2Encoder )Encode ()(_agac []byte ,_ddg error ){const _cgcb ="J\u0042I\u0047\u0032\u0044\u006f\u0063\u0075\u006d\u0065n\u0074\u002e\u0045\u006eco\u0064\u0065";if _eaab ._efaa ==nil {return nil ,_dd .Errorf (_cgcb ,"\u0064\u006f\u0063u\u006d\u0065\u006e\u0074 \u0069\u006e\u0070\u0075\u0074\u0020\u0064a\u0074\u0061\u0020\u006e\u006f\u0074\u0020\u0064\u0065\u0066\u0069\u006e\u0065\u0064"); 572 };_eaab ._efaa .FullHeaders =_eaab .DefaultPageSettings .FileMode ;_agac ,_ddg =_eaab ._efaa .Encode ();if _ddg !=nil {return nil ,_dd .Wrap (_ddg ,_cgcb ,"");};return _agac ,nil ;}; 573 574 // SetPredictor sets the predictor function. Specify the number of columns per row. 575 // The columns indicates the number of samples per row. 576 // Used for grouping data together for compression. 577 func (_add *FlateEncoder )SetPredictor (columns int ){_add .Predictor =11;_add .Columns =columns }; 578 579 // JBIG2EncoderSettings contains the parameters and settings used by the JBIG2Encoder. 580 // Current version works only on JB2Generic compression. 581 type JBIG2EncoderSettings struct{ 582 583 // FileMode defines if the jbig2 encoder should return full jbig2 file instead of 584 // shortened pdf mode. This adds the file header to the jbig2 definition. 585 FileMode bool ; 586 587 // Compression is the setting that defines the compression type used for encoding the page. 588 Compression JBIG2CompressionType ; 589 590 // DuplicatedLinesRemoval code generic region in a way such that if the lines are duplicated the encoder 591 // doesn't store it twice. 592 DuplicatedLinesRemoval bool ; 593 594 // DefaultPixelValue is the bit value initial for every pixel in the page. 595 DefaultPixelValue uint8 ; 596 597 // ResolutionX optional setting that defines the 'x' axis input image resolution - used for single page encoding. 598 ResolutionX int ; 599 600 // ResolutionY optional setting that defines the 'y' axis input image resolution - used for single page encoding. 601 ResolutionY int ; 602 603 // Threshold defines the threshold of the image correlation for 604 // non Generic compression. 605 // User only for JB2SymbolCorrelation and JB2SymbolRankHaus methods. 606 // Best results in range [0.7 - 0.98] - the less the better the compression would be 607 // but the more lossy. 608 // Default value: 0.95 609 Threshold float64 ;}; 610 611 // DecodeGlobals decodes 'encoded' byte stream and returns their Globally defined segments ('Globals'). 612 func (_fbaf *JBIG2Encoder )DecodeGlobals (encoded []byte )(_db .Globals ,error ){return _db .DecodeGlobals (encoded );};func _ccdddf (_bfaeb ,_caga ,_bdea int )error {if _caga < 0||_caga > _bfaeb {return _a .New ("s\u006c\u0069\u0063\u0065\u0020\u0069n\u0064\u0065\u0078\u0020\u0061\u0020\u006f\u0075\u0074 \u006f\u0066\u0020b\u006fu\u006e\u0064\u0073"); 613 };if _bdea < _caga {return _a .New ("\u0069n\u0076\u0061\u006c\u0069d\u0020\u0073\u006c\u0069\u0063e\u0020i\u006ed\u0065\u0078\u0020\u0062\u0020\u003c\u0020a");};if _bdea > _bfaeb {return _a .New ("s\u006c\u0069\u0063\u0065\u0020\u0069n\u0064\u0065\u0078\u0020\u0062\u0020\u006f\u0075\u0074 \u006f\u0066\u0020b\u006fu\u006e\u0064\u0073"); 614 };return nil ;}; 615 616 // MakeStreamDict makes a new instance of an encoding dictionary for a stream object. 617 // Has the Filter set and the DecodeParms. 618 func (_aef *LZWEncoder )MakeStreamDict ()*PdfObjectDictionary {_ffg :=MakeDict ();_ffg .Set ("\u0046\u0069\u006c\u0074\u0065\u0072",MakeName (_aef .GetFilterName ()));_adee :=_aef .MakeDecodeParams ();if _adee !=nil {_ffg .Set ("D\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0072\u006d\u0073",_adee ); 619 };_ffg .Set ("E\u0061\u0072\u006c\u0079\u0043\u0068\u0061\u006e\u0067\u0065",MakeInteger (int64 (_aef .EarlyChange )));return _ffg ;};func (_agb *PdfParser )parseBool ()(PdfObjectBool ,error ){_cadc ,_defc :=_agb ._gcec .Peek (4);if _defc !=nil {return PdfObjectBool (false ),_defc ; 620 };if (len (_cadc )>=4)&&(string (_cadc [:4])=="\u0074\u0072\u0075\u0065"){_agb ._gcec .Discard (4);return PdfObjectBool (true ),nil ;};_cadc ,_defc =_agb ._gcec .Peek (5);if _defc !=nil {return PdfObjectBool (false ),_defc ;};if (len (_cadc )>=5)&&(string (_cadc [:5])=="\u0066\u0061\u006cs\u0065"){_agb ._gcec .Discard (5); 621 return PdfObjectBool (false ),nil ;};return PdfObjectBool (false ),_a .New ("\u0075n\u0065\u0078\u0070\u0065c\u0074\u0065\u0064\u0020\u0062o\u006fl\u0065a\u006e\u0020\u0073\u0074\u0072\u0069\u006eg");}; 622 623 // DecodeImages decodes the page images from the jbig2 'encoded' data input. 624 // The jbig2 document may contain multiple pages, thus the function can return multiple 625 // images. The images order corresponds to the page number. 626 func (_daggc *JBIG2Encoder )DecodeImages (encoded []byte )([]_ff .Image ,error ){const _cbfc ="\u004aB\u0049\u0047\u0032\u0045n\u0063\u006f\u0064\u0065\u0072.\u0044e\u0063o\u0064\u0065\u0049\u006d\u0061\u0067\u0065s";_ecgbg ,_afge :=_gg .Decode (encoded ,_gg .Parameters {},_daggc .Globals .ToDocumentGlobals ()); 627 if _afge !=nil {return nil ,_dd .Wrap (_afge ,_cbfc ,"");};_eaca ,_afge :=_ecgbg .PageNumber ();if _afge !=nil {return nil ,_dd .Wrap (_afge ,_cbfc ,"");};_faba :=[]_ff .Image {};var _agdc _ff .Image ;for _gfd :=1;_gfd <=_eaca ;_gfd ++{_agdc ,_afge =_ecgbg .DecodePageImage (_gfd ); 628 if _afge !=nil {return nil ,_dd .Wrapf (_afge ,_cbfc ,"\u0070\u0061\u0067\u0065\u003a\u0020\u0027\u0025\u0064\u0027",_gfd );};_faba =append (_faba ,_agdc );};return _faba ,nil ;}; 629 630 // MakeStream creates an PdfObjectStream with specified contents and encoding. If encoding is nil, then raw encoding 631 // will be used (i.e. no encoding applied). 632 func MakeStream (contents []byte ,encoder StreamEncoder )(*PdfObjectStream ,error ){_ccbff :=&PdfObjectStream {};if encoder ==nil {encoder =NewRawEncoder ();};_ccbff .PdfObjectDictionary =encoder .MakeStreamDict ();_aegc ,_dbgeab :=encoder .EncodeBytes (contents ); 633 if _dbgeab !=nil {return nil ,_dbgeab ;};_ccbff .PdfObjectDictionary .Set ("\u004c\u0065\u006e\u0067\u0074\u0068",MakeInteger (int64 (len (_aegc ))));_ccbff .Stream =_aegc ;return _ccbff ,nil ;};func _eegb (_aebfd int )int {if _aebfd < 0{return -_aebfd ; 634 };return _aebfd ;};func (_gffd *PdfParser )parseXref ()(*PdfObjectDictionary ,error ){_gffd .skipSpaces ();const _acgff =20;_dbaadb ,_ :=_gffd ._gcec .Peek (_acgff );for _dgfeg :=0;_dgfeg < 2;_dgfeg ++{if _gffd ._cdca ==0{_gffd ._cdca =_gffd .GetFileOffset (); 635 };if _bfdf .Match (_dbaadb ){_df .Log .Trace ("\u0078\u0072e\u0066\u0020\u0070\u006f\u0069\u006e\u0074\u0073\u0020\u0074\u006f\u0020\u0061\u006e\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u002e\u0020\u0050\u0072\u006f\u0062\u0061\u0062\u006c\u0079\u0020\u0078\u0072\u0065\u0066\u0020\u006f\u0062\u006a\u0065\u0063\u0074"); 636 _df .Log .Debug ("\u0073t\u0061r\u0074\u0069\u006e\u0067\u0020w\u0069\u0074h\u0020\u0022\u0025\u0073\u0022",string (_dbaadb ));return _gffd .parseXrefStream (nil );};if _bggfa .Match (_dbaadb ){_df .Log .Trace ("\u0053\u0074\u0061\u006ed\u0061\u0072\u0064\u0020\u0078\u0072\u0065\u0066\u0020\u0073e\u0063t\u0069\u006f\u006e\u0020\u0074\u0061\u0062l\u0065\u0021"); 637 return _gffd .parseXrefTable ();};_dedd :=_gffd .GetFileOffset ();if _gffd ._cdca ==0{_gffd ._cdca =_dedd ;};_gffd .SetFileOffset (_dedd -_acgff );defer _gffd .SetFileOffset (_dedd );_gebc ,_ :=_gffd ._gcec .Peek (_acgff );_dbaadb =append (_gebc ,_dbaadb ...); 638 };_df .Log .Debug ("\u0057\u0061\u0072\u006e\u0069\u006e\u0067\u003a\u0020\u0055\u006e\u0061\u0062\u006c\u0065\u0020\u0074\u006f \u0066\u0069\u006e\u0064\u0020\u0078\u0072\u0065f\u0020\u0074\u0061\u0062\u006c\u0065\u0020\u006fr\u0020\u0073\u0074\u0072\u0065\u0061\u006d.\u0020\u0052\u0065\u0070\u0061i\u0072\u0020\u0061\u0074\u0074e\u006d\u0070\u0074\u0065\u0064\u003a\u0020\u004c\u006f\u006f\u006b\u0069\u006e\u0067\u0020\u0066\u006f\u0072\u0020\u0065\u0061\u0072\u006c\u0069\u0065\u0073\u0074\u0020x\u0072\u0065\u0066\u0020\u0066\u0072\u006f\u006d\u0020\u0062\u006f\u0074to\u006d\u002e"); 639 if _eabad :=_gffd .repairSeekXrefMarker ();_eabad !=nil {_df .Log .Debug ("\u0052e\u0070a\u0069\u0072\u0020\u0066\u0061i\u006c\u0065d\u0020\u002d\u0020\u0025\u0076",_eabad );return nil ,_eabad ;};return _gffd .parseXrefTable ();};var _bfdf =_f .MustCompile ("\u0028\u005c\u0064\u002b)\\\u0073\u002b\u0028\u005c\u0064\u002b\u0029\u005c\u0073\u002b\u006f\u0062\u006a"); 640 func (_fefad *PdfParser )repairRebuildXrefsTopDown ()(*XrefTable ,error ){if _fefad ._fbae {return nil ,_ea .Errorf ("\u0072\u0065\u0070\u0061\u0069\u0072\u0020\u0066\u0061\u0069\u006c\u0065\u0064");};_fefad ._fbae =true ;_fefad ._abdga .Seek (0,_gd .SeekStart ); 641 _fefad ._gcec =_fd .NewReader (_fefad ._abdga );_fbcb :=20;_faddd :=make ([]byte ,_fbcb );_eccce :=XrefTable {};_eccce .ObjectMap =make (map[int ]XrefObject );for {_ccebg ,_gdgbc :=_fefad ._gcec .ReadByte ();if _gdgbc !=nil {if _gdgbc ==_gd .EOF {break ; 642 }else {return nil ,_gdgbc ;};};if _ccebg =='j'&&_faddd [_fbcb -1]=='b'&&_faddd [_fbcb -2]=='o'&&IsWhiteSpace (_faddd [_fbcb -3]){_bdaac :=_fbcb -4;for IsWhiteSpace (_faddd [_bdaac ])&&_bdaac > 0{_bdaac --;};if _bdaac ==0||!IsDecimalDigit (_faddd [_bdaac ]){continue ; 643 };for IsDecimalDigit (_faddd [_bdaac ])&&_bdaac > 0{_bdaac --;};if _bdaac ==0||!IsWhiteSpace (_faddd [_bdaac ]){continue ;};for IsWhiteSpace (_faddd [_bdaac ])&&_bdaac > 0{_bdaac --;};if _bdaac ==0||!IsDecimalDigit (_faddd [_bdaac ]){continue ;};for IsDecimalDigit (_faddd [_bdaac ])&&_bdaac > 0{_bdaac --; 644 };if _bdaac ==0{continue ;};_ebeg :=_fefad .GetFileOffset ()-int64 (_fbcb -_bdaac );_dffdd :=append (_faddd [_bdaac +1:],_ccebg );_cdae ,_deagf ,_befdc :=_fagc (string (_dffdd ));if _befdc !=nil {_df .Log .Debug ("\u0055\u006e\u0061\u0062\u006c\u0065 \u0074\u006f\u0020\u0070\u0061\u0072\u0073\u0065\u0020\u006f\u0062\u006a\u0065c\u0074\u0020\u006e\u0075\u006d\u0062\u0065r\u003a\u0020\u0025\u0076",_befdc ); 645 return nil ,_befdc ;};if _bbaa ,_ggcd :=_eccce .ObjectMap [_cdae ];!_ggcd ||_bbaa .Generation < _deagf {_efbf :=XrefObject {};_efbf .XType =XrefTypeTableEntry ;_efbf .ObjectNumber =_cdae ;_efbf .Generation =_deagf ;_efbf .Offset =_ebeg ;_eccce .ObjectMap [_cdae ]=_efbf ; 646 };};_faddd =append (_faddd [1:_fbcb ],_ccebg );};_fefad ._dbeed =nil ;return &_eccce ,nil ;}; 647 648 // GetName returns the *PdfObjectName represented by the PdfObject directly or indirectly within an indirect 649 // object. On type mismatch the found bool flag is false and a nil pointer is returned. 650 func GetName (obj PdfObject )(_bbaeb *PdfObjectName ,_ccag bool ){_bbaeb ,_ccag =TraceToDirectObject (obj ).(*PdfObjectName );return _bbaeb ,_ccag ;};var _dcef =_a .New ("\u0045\u004f\u0046\u0020\u006e\u006f\u0074\u0020\u0066\u006f\u0075\u006e\u0064"); 651 652 653 // MakeDecodeParams makes a new instance of an encoding dictionary based on 654 // the current encoder settings. 655 func (_dae *CCITTFaxEncoder )MakeDecodeParams ()PdfObject {_bfaa :=MakeDict ();_bfaa .Set ("\u004b",MakeInteger (int64 (_dae .K )));_bfaa .Set ("\u0043o\u006c\u0075\u006d\u006e\u0073",MakeInteger (int64 (_dae .Columns )));if _dae .BlackIs1 {_bfaa .Set ("\u0042\u006c\u0061\u0063\u006b\u0049\u0073\u0031",MakeBool (_dae .BlackIs1 )); 656 };if _dae .EncodedByteAlign {_bfaa .Set ("\u0045\u006ec\u006f\u0064\u0065d\u0042\u0079\u0074\u0065\u0041\u006c\u0069\u0067\u006e",MakeBool (_dae .EncodedByteAlign ));};if _dae .EndOfLine &&_dae .K >=0{_bfaa .Set ("\u0045n\u0064\u004f\u0066\u004c\u0069\u006ee",MakeBool (_dae .EndOfLine )); 657 };if _dae .Rows !=0&&!_dae .EndOfBlock {_bfaa .Set ("\u0052\u006f\u0077\u0073",MakeInteger (int64 (_dae .Rows )));};if !_dae .EndOfBlock {_bfaa .Set ("\u0045\u006e\u0064\u004f\u0066\u0042\u006c\u006f\u0063\u006b",MakeBool (_dae .EndOfBlock ));};if _dae .DamagedRowsBeforeError !=0{_bfaa .Set ("\u0044\u0061\u006d\u0061ge\u0064\u0052\u006f\u0077\u0073\u0042\u0065\u0066\u006f\u0072\u0065\u0045\u0072\u0072o\u0072",MakeInteger (int64 (_dae .DamagedRowsBeforeError ))); 658 };return _bfaa ;}; 659 660 // ResolveReferencesDeep recursively traverses through object `o`, looking up and replacing 661 // references with indirect objects. 662 // Optionally a map of already deep-resolved objects can be provided via `traversed`. The `traversed` map 663 // is updated while traversing the objects to avoid traversing same objects multiple times. 664 func ResolveReferencesDeep (o PdfObject ,traversed map[PdfObject ]struct{})error {if traversed ==nil {traversed =map[PdfObject ]struct{}{};};return _fcfa (o ,0,traversed );}; 665 666 // UpdateParams updates the parameter values of the encoder. 667 func (_fgabd *RunLengthEncoder )UpdateParams (params *PdfObjectDictionary ){};func (_dbb *PdfCrypt )loadCryptFilters (_bgg *PdfObjectDictionary )error {_dbb ._bde =cryptFilters {};_cgcg :=_bgg .Get ("\u0043\u0046");_cgcg =TraceToDirectObject (_cgcg );if _af ,_fec :=_cgcg .(*PdfObjectReference ); 668 _fec {_ccb ,_ageb :=_dbb ._edd .LookupByReference (*_af );if _ageb !=nil {_df .Log .Debug ("\u0045\u0072r\u006f\u0072\u0020\u006c\u006f\u006f\u006b\u0069\u006e\u0067\u0020\u0075\u0070\u0020\u0043\u0046\u0020\u0072\u0065\u0066\u0065\u0072en\u0063\u0065"); 669 return _ageb ;};_cgcg =TraceToDirectObject (_ccb );};_afb ,_eaa :=_cgcg .(*PdfObjectDictionary );if !_eaa {_df .Log .Debug ("I\u006ev\u0061\u006c\u0069\u0064\u0020\u0043\u0046\u002c \u0074\u0079\u0070\u0065: \u0025\u0054",_cgcg );return _a .New ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0043\u0046"); 670 };for _ ,_gba :=range _afb .Keys (){_gaa :=_afb .Get (_gba );if _cgd ,_fbdd :=_gaa .(*PdfObjectReference );_fbdd {_ae ,_gbaa :=_dbb ._edd .LookupByReference (*_cgd );if _gbaa !=nil {_df .Log .Debug ("\u0045\u0072ro\u0072\u0020\u006co\u006f\u006b\u0075\u0070 up\u0020di\u0063\u0074\u0069\u006f\u006e\u0061\u0072y \u0072\u0065\u0066\u0065\u0072\u0065\u006ec\u0065"); 671 return _gbaa ;};_gaa =TraceToDirectObject (_ae );};_cdbe ,_edc :=_gaa .(*PdfObjectDictionary );if !_edc {return _ea .Errorf ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0064\u0069\u0063\u0074\u0020\u0069\u006e \u0043\u0046\u0020\u0028\u006e\u0061\u006d\u0065\u0020\u0025\u0073\u0029\u0020-\u0020\u006e\u006f\u0074\u0020\u0061\u0020\u0064\u0069\u0063\u0074\u0069on\u0061\u0072\u0079\u0020\u0062\u0075\u0074\u0020\u0025\u0054",_gba ,_gaa ); 672 };if _gba =="\u0049\u0064\u0065\u006e\u0074\u0069\u0074\u0079"{_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u0020\u002d\u0020\u0043\u0061\u006e\u006e\u006f\u0074\u0020\u006f\u0076\u0065\u0072\u0077r\u0069\u0074\u0065\u0020\u0074\u0068\u0065\u0020\u0069d\u0065\u006e\u0074\u0069\u0074\u0079\u0020\u0066\u0069\u006c\u0074\u0065\u0072 \u002d\u0020\u0054\u0072\u0079\u0069n\u0067\u0020\u006ee\u0078\u0074"); 673 continue ;};var _cee _gc .FilterDict ;if _fece :=_cgc (&_cee ,_cdbe );_fece !=nil {return _fece ;};_bda ,_bab :=_gc .NewFilter (_cee );if _bab !=nil {return _bab ;};_dbb ._bde [string (_gba )]=_bda ;};_dbb ._bde ["\u0049\u0064\u0065\u006e\u0074\u0069\u0074\u0079"]=_gc .NewIdentity (); 674 _dbb ._fbe ="\u0049\u0064\u0065\u006e\u0074\u0069\u0074\u0079";if _cdgg ,_dcbb :=_bgg .Get ("\u0053\u0074\u0072\u0046").(*PdfObjectName );_dcbb {if _ ,_ddb :=_dbb ._bde [string (*_cdgg )];!_ddb {return _ea .Errorf ("\u0063\u0072\u0079\u0070t\u0020\u0066\u0069\u006c\u0074\u0065\u0072\u0020\u0066o\u0072\u0020\u0053\u0074\u0072\u0046\u0020\u006e\u006f\u0074\u0020\u0073\u0070\u0065\u0063\u0069\u0066\u0069e\u0064\u0020\u0069\u006e\u0020C\u0046\u0020\u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061\u0072\u0079\u0020\u0028\u0025\u0073\u0029",*_cdgg ); 675 };_dbb ._fbe =string (*_cdgg );};_dbb ._ddfb ="\u0049\u0064\u0065\u006e\u0074\u0069\u0074\u0079";if _bba ,_dadc :=_bgg .Get ("\u0053\u0074\u006d\u0046").(*PdfObjectName );_dadc {if _ ,_gbe :=_dbb ._bde [string (*_bba )];!_gbe {return _ea .Errorf ("\u0063\u0072\u0079\u0070t\u0020\u0066\u0069\u006c\u0074\u0065\u0072\u0020\u0066o\u0072\u0020\u0053\u0074\u006d\u0046\u0020\u006e\u006f\u0074\u0020\u0073\u0070\u0065\u0063\u0069\u0066\u0069e\u0064\u0020\u0069\u006e\u0020C\u0046\u0020\u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061\u0072\u0079\u0020\u0028\u0025\u0073\u0029",*_bba ); 676 };_dbb ._ddfb =string (*_bba );};return nil ;}; 677 678 // Read implementation of Read interface. 679 func (_deab *limitedReadSeeker )Read (p []byte )(_acc int ,_dbaa error ){_ddba ,_dbaa :=_deab ._cgfaf .Seek (0,_gd .SeekCurrent );if _dbaa !=nil {return 0,_dbaa ;};_fgde :=_deab ._dgfg -_ddba ;if _fgde ==0{return 0,_gd .EOF ;};if _acbf :=int64 (len (p )); 680 _acbf < _fgde {_fgde =_acbf ;};_bbfb :=make ([]byte ,_fgde );_acc ,_dbaa =_deab ._cgfaf .Read (_bbfb );copy (p ,_bbfb );return _acc ,_dbaa ;}; 681 682 // GetRevision returns PdfParser for the specific version of the Pdf document. 683 func (_egfbg *PdfParser )GetRevision (revisionNumber int )(*PdfParser ,error ){_dedg :=_egfbg ._eaae ;if _dedg ==revisionNumber {return _egfbg ,nil ;};if _dedg < revisionNumber {return nil ,_a .New ("\u0075\u006e\u0064\u0065\u0066\u0069\u006e\u0065\u0064\u0020\u0072\u0065\u0076\u0069\u0073i\u006fn\u004e\u0075\u006d\u0062\u0065\u0072\u0020\u0076\u0065\u0072\u0073\u0069\u006f\u006e"); 684 };if _egfbg ._bddb [revisionNumber ]!=nil {return _egfbg ._bddb [revisionNumber ],nil ;};_ggad :=_egfbg ;for ;_dedg > revisionNumber ;_dedg --{_fbda ,_cdff :=_ggad .GetPreviousRevisionParser ();if _cdff !=nil {return nil ,_cdff ;};_egfbg ._bddb [_dedg -1]=_fbda ; 685 _egfbg ._dgef [_ggad ]=_fbda ;_ggad =_fbda ;};return _ggad ,nil ;}; 686 687 // GetFileOffset returns the current file offset, accounting for buffered position. 688 func (_cffd *PdfParser )GetFileOffset ()int64 {_aedbe ,_ :=_cffd ._abdga .Seek (0,_gd .SeekCurrent );_aedbe -=int64 (_cffd ._gcec .Buffered ());return _aedbe ;}; 689 690 // IsEncrypted checks if the document is encrypted. A bool flag is returned indicating the result. 691 // First time when called, will check if the Encrypt dictionary is accessible through the trailer dictionary. 692 // If encrypted, prepares a crypt datastructure which can be used to authenticate and decrypt the document. 693 // On failure, an error is returned. 694 func (_cegd *PdfParser )IsEncrypted ()(bool ,error ){if _cegd ._acg !=nil {return true ,nil ;}else if _cegd ._aagb ==nil {return false ,nil ;};_df .Log .Trace ("\u0043\u0068\u0065c\u006b\u0069\u006e\u0067 \u0065\u006e\u0063\u0072\u0079\u0070\u0074i\u006f\u006e\u0020\u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061\u0072\u0079\u0021"); 695 _dabb :=_cegd ._aagb .Get ("\u0045n\u0063\u0072\u0079\u0070\u0074");if _dabb ==nil {return false ,nil ;};_df .Log .Trace ("\u0049\u0073\u0020\u0065\u006e\u0063\u0072\u0079\u0070\u0074\u0065\u0064\u0021");var (_gfea *PdfObjectDictionary ;);switch _ceba :=_dabb .(type ){case *PdfObjectDictionary :_gfea =_ceba ; 696 case *PdfObjectReference :_df .Log .Trace ("\u0030\u003a\u0020\u004c\u006f\u006f\u006b\u0020\u0075\u0070\u0020\u0072e\u0066\u0020\u0025\u0071",_ceba );_cbd ,_gbade :=_cegd .LookupByReference (*_ceba );_df .Log .Trace ("\u0031\u003a\u0020%\u0071",_cbd ); 697 if _gbade !=nil {return false ,_gbade ;};_eddc ,_ecb :=_cbd .(*PdfIndirectObject );if !_ecb {_df .Log .Debug ("E\u006e\u0063\u0072\u0079\u0070\u0074\u0069\u006f\u006e\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u0020\u006eo\u0074\u0020\u0061\u006e\u0020\u0069\u006e\u0064\u0069\u0072ec\u0074\u0020\u006fb\u006ae\u0063\u0074"); 698 return false ,_a .New ("\u0074\u0079p\u0065\u0020\u0063h\u0065\u0063\u006b\u0020\u0065\u0072\u0072\u006f\u0072");};_bgd ,_ecb :=_eddc .PdfObject .(*PdfObjectDictionary );_cegd ._bgafa =_eddc ;_df .Log .Trace ("\u0032\u003a\u0020%\u0071",_bgd );if !_ecb {return false ,_a .New ("\u0074\u0072a\u0069\u006c\u0065\u0072 \u0045\u006ec\u0072\u0079\u0070\u0074\u0020\u006f\u0062\u006ae\u0063\u0074\u0020\u006e\u006f\u006e\u0020\u0064\u0069\u0063\u0074\u0069o\u006e\u0061\u0072\u0079"); 699 };_gfea =_bgd ;case *PdfObjectNull :_df .Log .Debug ("\u0045\u006e\u0063\u0072\u0079\u0070\u0074 \u0069\u0073\u0020a\u0020\u006e\u0075l\u006c\u0020o\u0062\u006a\u0065\u0063\u0074\u002e \u0046il\u0065\u0020\u0073\u0068\u006f\u0075\u006c\u0064\u0020\u006e\u006f\u0074\u0020\u0062\u0065\u0020\u0065\u006e\u0063\u0072\u0079\u0070\u0074\u0065\u0064\u002e"); 700 return false ,nil ;default:return false ,_ea .Errorf ("u\u006es\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064 \u0074\u0079\u0070\u0065: \u0025\u0054",_ceba );};_dbfea ,_fdfg :=PdfCryptNewDecrypt (_cegd ,_gfea ,_cegd ._aagb );if _fdfg !=nil {return false ,_fdfg ; 701 };for _ ,_ebgefc :=range []string {"\u0045n\u0063\u0072\u0079\u0070\u0074"}{_gfae :=_cegd ._aagb .Get (PdfObjectName (_ebgefc ));if _gfae ==nil {continue ;};switch _abeb :=_gfae .(type ){case *PdfObjectReference :_dbfea ._becc [int (_abeb .ObjectNumber )]=struct{}{}; 702 case *PdfIndirectObject :_dbfea ._gee [_abeb ]=true ;_dbfea ._becc [int (_abeb .ObjectNumber )]=struct{}{};};};_cegd ._acg =_dbfea ;_df .Log .Trace ("\u0043\u0072\u0079\u0070\u0074\u0065\u0072\u0020\u006f\u0062\u006a\u0065c\u0074\u0020\u0025\u0062",_dbfea ); 703 return true ,nil ;}; 704 705 // PdfObjectArray represents the primitive PDF array object. 706 type PdfObjectArray struct{_cdea []PdfObject };func (_gfcf *PdfParser )getNumbersOfUpdatedObjects (_ebae *PdfParser )([]int ,error ){if _ebae ==nil {return nil ,_a .New ("\u0070\u0072e\u0076\u0069\u006f\u0075\u0073\u0020\u0070\u0061\u0072\u0073\u0065\u0072\u0020\u0063\u0061\u006e\u0027\u0074\u0020\u0062\u0065\u0020nu\u006c\u006c"); 707 };_cabe :=_ebae ._gccgc ;_deac :=make ([]int ,0);_decb :=make (map[int ]interface{});_gaeb :=make (map[int ]int64 );for _acag ,_ccbgf :=range _gfcf ._ggaf .ObjectMap {if _ccbgf .Offset ==0{if _ccbgf .OsObjNumber !=0{if _ccca ,_gfgg :=_gfcf ._ggaf .ObjectMap [_ccbgf .OsObjNumber ]; 708 _gfgg {_decb [_ccbgf .OsObjNumber ]=struct{}{};_gaeb [_acag ]=_ccca .Offset ;}else {return nil ,_a .New ("u\u006ed\u0065\u0066\u0069\u006e\u0065\u0064\u0020\u0078r\u0065\u0066\u0020\u0074ab\u006c\u0065");};};}else {_gaeb [_acag ]=_ccbgf .Offset ;};};for _gcfc ,_gfbf :=range _gaeb {if _ ,_eddad :=_decb [_gcfc ]; 709 _eddad {continue ;};if _gfbf > _cabe {_deac =append (_deac ,_gcfc );};};return _deac ,nil ;};const _adeg =6;type objectStream struct{N int ;_dcc []byte ;_ece map[int ]int64 ;};var _dfde =[]byte ("\u0030\u0031\u0032\u003345\u0036\u0037\u0038\u0039\u0061\u0062\u0063\u0064\u0065\u0066\u0041\u0042\u0043\u0044E\u0046"); 710 711 712 // EncodeBytes ASCII encodes the passed in slice of bytes. 713 func (_abca *ASCIIHexEncoder )EncodeBytes (data []byte )([]byte ,error ){var _agg _d .Buffer ;for _ ,_bgfc :=range data {_agg .WriteString (_ea .Sprintf ("\u0025\u002e\u0032X\u0020",_bgfc ));};_agg .WriteByte ('>');return _agg .Bytes (),nil ;}; 714 715 // UpdateParams updates the parameter values of the encoder. 716 func (_dffd *CCITTFaxEncoder )UpdateParams (params *PdfObjectDictionary ){if _cfbdf ,_beg :=GetNumberAsInt64 (params .Get ("\u004b"));_beg ==nil {_dffd .K =int (_cfbdf );};if _bcded ,_ffea :=GetNumberAsInt64 (params .Get ("\u0043o\u006c\u0075\u006d\u006e\u0073")); 717 _ffea ==nil {_dffd .Columns =int (_bcded );}else if _bcded ,_ffea =GetNumberAsInt64 (params .Get ("\u0057\u0069\u0064t\u0068"));_ffea ==nil {_dffd .Columns =int (_bcded );};if _gdcf ,_gdea :=GetNumberAsInt64 (params .Get ("\u0042\u006c\u0061\u0063\u006b\u0049\u0073\u0031")); 718 _gdea ==nil {_dffd .BlackIs1 =_gdcf > 0;}else {if _begd ,_fbabd :=GetBoolVal (params .Get ("\u0042\u006c\u0061\u0063\u006b\u0049\u0073\u0031"));_fbabd {_dffd .BlackIs1 =_begd ;}else {if _bgca ,_acdgb :=GetArray (params .Get ("\u0044\u0065\u0063\u006f\u0064\u0065")); 719 _acdgb {_decc ,_gagfd :=_bgca .ToIntegerArray ();if _gagfd ==nil {_dffd .BlackIs1 =_decc [0]==1&&_decc [1]==0;};};};};if _beff ,_gfge :=GetNumberAsInt64 (params .Get ("\u0045\u006ec\u006f\u0064\u0065d\u0042\u0079\u0074\u0065\u0041\u006c\u0069\u0067\u006e")); 720 _gfge ==nil {_dffd .EncodedByteAlign =_beff > 0;}else {if _fab ,_fefa :=GetBoolVal (params .Get ("\u0045\u006ec\u006f\u0064\u0065d\u0042\u0079\u0074\u0065\u0041\u006c\u0069\u0067\u006e"));_fefa {_dffd .EncodedByteAlign =_fab ;};};if _bff ,_ffaf :=GetNumberAsInt64 (params .Get ("\u0045n\u0064\u004f\u0066\u004c\u0069\u006ee")); 721 _ffaf ==nil {_dffd .EndOfLine =_bff > 0;}else {if _gbdg ,_bdd :=GetBoolVal (params .Get ("\u0045n\u0064\u004f\u0066\u004c\u0069\u006ee"));_bdd {_dffd .EndOfLine =_gbdg ;};};if _bebf ,_bbc :=GetNumberAsInt64 (params .Get ("\u0052\u006f\u0077\u0073"));_bbc ==nil {_dffd .Rows =int (_bebf ); 722 }else if _bebf ,_bbc =GetNumberAsInt64 (params .Get ("\u0048\u0065\u0069\u0067\u0068\u0074"));_bbc ==nil {_dffd .Rows =int (_bebf );};if _bcfe ,_afd :=GetNumberAsInt64 (params .Get ("\u0045\u006e\u0064\u004f\u0066\u0042\u006c\u006f\u0063\u006b"));_afd ==nil {_dffd .EndOfBlock =_bcfe > 0; 723 }else {if _cbaf ,_bcdee :=GetBoolVal (params .Get ("\u0045\u006e\u0064\u004f\u0066\u0042\u006c\u006f\u0063\u006b"));_bcdee {_dffd .EndOfBlock =_cbaf ;};};if _bddf ,_daga :=GetNumberAsInt64 (params .Get ("\u0044\u0061\u006d\u0061ge\u0064\u0052\u006f\u0077\u0073\u0042\u0065\u0066\u006f\u0072\u0065\u0045\u0072\u0072o\u0072")); 724 _daga !=nil {_dffd .DamagedRowsBeforeError =int (_bddf );};}; 725 726 // MakeDecodeParams makes a new instance of an encoding dictionary based on 727 // the current encoder settings. 728 func (_acaf *RunLengthEncoder )MakeDecodeParams ()PdfObject {return nil }; 729 730 // MakeDecodeParams makes a new instance of an encoding dictionary based on 731 // the current encoder settings. 732 func (_bbe *LZWEncoder )MakeDecodeParams ()PdfObject {if _bbe .Predictor > 1{_afeg :=MakeDict ();_afeg .Set ("\u0050r\u0065\u0064\u0069\u0063\u0074\u006fr",MakeInteger (int64 (_bbe .Predictor )));if _bbe .BitsPerComponent !=8{_afeg .Set ("\u0042\u0069t\u0073\u0050\u0065r\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074",MakeInteger (int64 (_bbe .BitsPerComponent ))); 733 };if _bbe .Columns !=1{_afeg .Set ("\u0043o\u006c\u0075\u006d\u006e\u0073",MakeInteger (int64 (_bbe .Columns )));};if _bbe .Colors !=1{_afeg .Set ("\u0043\u006f\u006c\u006f\u0072\u0073",MakeInteger (int64 (_bbe .Colors )));};return _afeg ;};return nil ; 734 }; 735 736 // NewRunLengthEncoder makes a new run length encoder 737 func NewRunLengthEncoder ()*RunLengthEncoder {return &RunLengthEncoder {}}; 738 739 // MakeArray creates an PdfObjectArray from a list of PdfObjects. 740 func MakeArray (objects ...PdfObject )*PdfObjectArray {return &PdfObjectArray {_cdea :objects }}; 741 742 // WriteString outputs the object as it is to be written to file. 743 func (_gbadc *PdfObjectBool )WriteString ()string {if *_gbadc {return "\u0074\u0072\u0075\u0065";};return "\u0066\u0061\u006cs\u0065";}; 744 745 // DrawableImage is same as golang image/draw's Image interface that allow drawing images. 746 type DrawableImage interface{ColorModel ()_fe .Model ;Bounds ()_ff .Rectangle ;At (_fdca ,_fbg int )_fe .Color ;Set (_gdbd ,_ccbc int ,_bbaf _fe .Color );}; 747 748 // GetFilterName returns the name of the encoding filter. 749 func (_cabb *JPXEncoder )GetFilterName ()string {return StreamEncodingFilterNameJPX };func (_agef *PdfCrypt )securityHandler ()_gb .StdHandler {if _agef ._bga .R >=5{return _gb .NewHandlerR6 ();};return _gb .NewHandlerR4 (_agef ._geg ,_agef ._dgc .Length ); 750 }; 751 752 // DecodeBytes decodes a slice of LZW encoded bytes and returns the result. 753 func (_fecb *LZWEncoder )DecodeBytes (encoded []byte )([]byte ,error ){var _efge _d .Buffer ;_bfag :=_d .NewReader (encoded );var _cgea _gd .ReadCloser ;if _fecb .EarlyChange ==1{_cgea =_cd .NewReader (_bfag ,_cd .MSB ,8);}else {_cgea =_ag .NewReader (_bfag ,_ag .MSB ,8); 754 };defer _cgea .Close ();if _ ,_cced :=_efge .ReadFrom (_cgea );_cced !=nil {if _cced !=_gd .ErrUnexpectedEOF ||_efge .Len ()==0{return nil ,_cced ;};_df .Log .Debug ("\u0057\u0041\u0052\u004e\u003a\u0020\u004c\u005a\u0057\u0020\u0064\u0065\u0063\u006f\u0064i\u006e\u0067\u0020\u0065\u0072\u0072\u006f\u0072\u003a\u0020\u0025\u0076\u002e \u004f\u0075\u0074\u0070\u0075\u0074\u0020\u006d\u0061\u0079\u0020\u0062e \u0069\u006e\u0063\u006f\u0072\u0072\u0065\u0063\u0074\u002e",_cced ); 755 };return _efge .Bytes (),nil ;};func (_fdega *PdfParser )parseArray ()(*PdfObjectArray ,error ){_cegg :=MakeArray ();_fdega ._gcec .ReadByte ();for {_fdega .skipSpaces ();_gabb ,_fdef :=_fdega ._gcec .Peek (1);if _fdef !=nil {return _cegg ,_fdef ;};if _gabb [0]==']'{_fdega ._gcec .ReadByte (); 756 break ;};_bfg ,_fdef :=_fdega .parseObject ();if _fdef !=nil {return _cegg ,_fdef ;};_cegg .Append (_bfg );};return _cegg ,nil ;}; 757 758 // EncodeBytes encodes the passed in slice of bytes by passing it through the 759 // EncodeBytes method of the underlying encoders. 760 func (_cgb *MultiEncoder )EncodeBytes (data []byte )([]byte ,error ){_beaa :=data ;var _gagfa error ;for _facb :=len (_cgb ._gbgba )-1;_facb >=0;_facb --{_daeg :=_cgb ._gbgba [_facb ];_beaa ,_gagfa =_daeg .EncodeBytes (_beaa );if _gagfa !=nil {return nil ,_gagfa ; 761 };};return _beaa ,nil ;}; 762 763 // SetFileOffset sets the file to an offset position and resets buffer. 764 func (_cecg *PdfParser )SetFileOffset (offset int64 ){if offset < 0{offset =0;};_cecg ._abdga .Seek (offset ,_gd .SeekStart );_cecg ._gcec =_fd .NewReader (_cecg ._abdga );}; 765 766 // ToInt64Slice returns a slice of all array elements as an int64 slice. An error is returned if the 767 // array non-integer objects. Each element can only be PdfObjectInteger. 768 func (_afab *PdfObjectArray )ToInt64Slice ()([]int64 ,error ){var _cfcc []int64 ;for _ ,_afdcd :=range _afab .Elements (){if _fege ,_dbaab :=_afdcd .(*PdfObjectInteger );_dbaab {_cfcc =append (_cfcc ,int64 (*_fege ));}else {return nil ,ErrTypeError ;}; 769 };return _cfcc ,nil ;}; 770 771 // MakeHexString creates an PdfObjectString from a string intended for output as a hexadecimal string. 772 func MakeHexString (s string )*PdfObjectString {_cgeae :=PdfObjectString {_bcfef :s ,_aae :true };return &_cgeae ;}; 773 774 // Seek implementation of Seek interface. 775 func (_feee *limitedReadSeeker )Seek (offset int64 ,whence int )(int64 ,error ){var _gabcd int64 ;switch whence {case _gd .SeekStart :_gabcd =offset ;case _gd .SeekCurrent :_bdaa ,_eedd :=_feee ._cgfaf .Seek (0,_gd .SeekCurrent );if _eedd !=nil {return 0,_eedd ; 776 };_gabcd =_bdaa +offset ;case _gd .SeekEnd :_gabcd =_feee ._dgfg +offset ;};if _gcbe :=_feee .getError (_gabcd );_gcbe !=nil {return 0,_gcbe ;};if _ ,_gefb :=_feee ._cgfaf .Seek (_gabcd ,_gd .SeekStart );_gefb !=nil {return 0,_gefb ;};return _gabcd ,nil ; 777 }; 778 779 // NewRawEncoder returns a new instace of RawEncoder. 780 func NewRawEncoder ()*RawEncoder {return &RawEncoder {}}; 781 782 // GetNameVal returns the string value represented by the PdfObject directly or indirectly if 783 // contained within an indirect object. On type mismatch the found bool flag returned is false and 784 // an empty string is returned. 785 func GetNameVal (obj PdfObject )(_gegdg string ,_eefe bool ){_bceb ,_eefe :=TraceToDirectObject (obj ).(*PdfObjectName );if _eefe {return string (*_bceb ),true ;};return ;};var _bggfa =_f .MustCompile ("\u005c\u0073\u002a\u0078\u0072\u0065\u0066\u005c\u0073\u002a"); 786 787 788 // MakeArrayFromFloats creates an PdfObjectArray from a slice of float64s, where each array element is an 789 // PdfObjectFloat. 790 func MakeArrayFromFloats (vals []float64 )*PdfObjectArray {_ggea :=MakeArray ();for _ ,_dgaf :=range vals {_ggea .Append (MakeFloat (_dgaf ));};return _ggea ;};type offsetReader struct{_eacg _gd .ReadSeeker ;_fefc int64 ;}; 791 792 // ToGoImage converts the JBIG2Image to the golang image.Image. 793 func (_adec *JBIG2Image )ToGoImage ()(_ff .Image ,error ){const _aafa ="J\u0042I\u0047\u0032\u0049\u006d\u0061\u0067\u0065\u002eT\u006f\u0047\u006f\u0049ma\u0067\u0065";if _adec .Data ==nil {return nil ,_dd .Error (_aafa ,"\u0069\u006d\u0061\u0067e \u0064\u0061\u0074\u0061\u0020\u006e\u006f\u0074\u0020\u0064\u0065\u0066\u0069\u006ee\u0064"); 794 };if _adec .Width ==0||_adec .Height ==0{return nil ,_dd .Error (_aafa ,"\u0069\u006d\u0061\u0067\u0065\u0020h\u0065\u0069\u0067\u0068\u0074\u0020\u006f\u0072\u0020\u0077\u0069\u0064\u0074h\u0020\u006e\u006f\u0074\u0020\u0064\u0065f\u0069\u006e\u0065\u0064"); 795 };_eeacg ,_dbgd :=_cf .NewImage (_adec .Width ,_adec .Height ,1,1,_adec .Data ,nil ,nil );if _dbgd !=nil {return nil ,_dbgd ;};return _eeacg ,nil ;};func _fagc (_bgggc string )(int ,int ,error ){_cdgb :=_bfdf .FindStringSubmatch (_bgggc );if len (_cdgb )< 3{return 0,0,_a .New ("\u0075\u006e\u0061b\u006c\u0065\u0020\u0074\u006f\u0020\u0064\u0065\u0074\u0065\u0063\u0074\u0020\u0069\u006e\u0064\u0069\u0072\u0065\u0063\u0074\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u0020s\u0069\u0067\u006e\u0061\u0074\u0075\u0072\u0065"); 796 };_ebbg ,_ :=_be .Atoi (_cdgb [1]);_cebcd ,_ :=_be .Atoi (_cdgb [2]);return _ebbg ,_cebcd ,nil ;}; 797 798 // Clear resets the array to an empty state. 799 func (_abba *PdfObjectArray )Clear (){_abba ._cdea =[]PdfObject {}}; 800 801 // DecodeStream decodes a JPX encoded stream and returns the result as a 802 // slice of bytes. 803 func (_aeca *JPXEncoder )DecodeStream (streamObj *PdfObjectStream )([]byte ,error ){_df .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u003a\u0020\u0041t\u0074\u0065\u006dpt\u0069\u006e\u0067\u0020\u0074\u006f \u0075\u0073\u0065\u0020\u0075\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064 \u0065\u006e\u0063\u006f\u0064\u0069\u006e\u0067 \u0025\u0073",_aeca .GetFilterName ()); 804 return streamObj .Stream ,ErrNoJPXDecode ;}; 805 806 // NewMultiEncoder returns a new instance of MultiEncoder. 807 func NewMultiEncoder ()*MultiEncoder {_bfcf :=MultiEncoder {};_bfcf ._gbgba =[]StreamEncoder {};return &_bfcf ;};func (_gfbb *PdfCrypt )isEncrypted (_dfeg PdfObject )bool {_ ,_gccb :=_gfbb ._fag [_dfeg ];if _gccb {_df .Log .Trace ("\u0041\u006c\u0072\u0065\u0061\u0064\u0079\u0020\u0065\u006e\u0063\u0072y\u0070\u0074\u0065\u0064"); 808 return true ;};_df .Log .Trace ("\u004e\u006f\u0074\u0020\u0065\u006e\u0063\u0072\u0079\u0070\u0074\u0065d\u0020\u0079\u0065\u0074");return false ;}; 809 810 // Remove removes an element specified by key. 811 func (_gdaaf *PdfObjectDictionary )Remove (key PdfObjectName ){_feggf :=-1;for _aega ,_bcad :=range _gdaaf ._aggf {if _bcad ==key {_feggf =_aega ;break ;};};if _feggf >=0{_gdaaf ._aggf =append (_gdaaf ._aggf [:_feggf ],_gdaaf ._aggf [_feggf +1:]...);delete (_gdaaf ._ccfa ,key ); 812 };}; 813 814 // Decoded returns the PDFDocEncoding or UTF-16BE decoded string contents. 815 // UTF-16BE is applied when the first two bytes are 0xFE, 0XFF, otherwise decoding of 816 // PDFDocEncoding is performed. 817 func (_gdege *PdfObjectString )Decoded ()string {if _gdege ==nil {return "";};_dgdaf :=[]byte (_gdege ._bcfef );if len (_dgdaf )>=2&&_dgdaf [0]==0xFE&&_dgdaf [1]==0xFF{return _gf .UTF16ToString (_dgdaf [2:]);};return _gf .PDFDocEncodingToString (_dgdaf ); 818 }; 819 820 // MakeDecodeParams makes a new instance of an encoding dictionary based on 821 // the current encoder settings. 822 func (_bcbg *ASCIIHexEncoder )MakeDecodeParams ()PdfObject {return nil }; 823 824 // DecodeStream implements ASCII hex decoding. 825 func (_adafd *ASCIIHexEncoder )DecodeStream (streamObj *PdfObjectStream )([]byte ,error ){return _adafd .DecodeBytes (streamObj .Stream );}; 826 827 // GetPreviousRevisionReadSeeker returns ReadSeeker for the previous version of the Pdf document. 828 func (_cfcgg *PdfParser )GetPreviousRevisionReadSeeker ()(_gd .ReadSeeker ,error ){if _fbgfc :=_cfcgg .seekToEOFMarker (_cfcgg ._gccgc -_adeg );_fbgfc !=nil {return nil ,_fbgfc ;};_dbeg ,_ccbb :=_cfcgg ._abdga .Seek (0,_gd .SeekCurrent );if _ccbb !=nil {return nil ,_ccbb ; 829 };_dbeg +=_adeg ;return _afbe (_cfcgg ._abdga ,_dbeg );}; 830 831 // DecodeStream decodes a LZW encoded stream and returns the result as a 832 // slice of bytes. 833 func (_eggc *LZWEncoder )DecodeStream (streamObj *PdfObjectStream )([]byte ,error ){_df .Log .Trace ("\u004c\u005a\u0057 \u0044\u0065\u0063\u006f\u0064\u0069\u006e\u0067");_df .Log .Trace ("\u0050\u0072\u0065\u0064\u0069\u0063\u0074\u006f\u0072\u003a\u0020\u0025\u0064",_eggc .Predictor ); 834 _eceda ,_afec :=_eggc .DecodeBytes (streamObj .Stream );if _afec !=nil {return nil ,_afec ;};_df .Log .Trace ("\u0020\u0049\u004e\u003a\u0020\u0028\u0025\u0064\u0029\u0020\u0025\u0020\u0078",len (streamObj .Stream ),streamObj .Stream );_df .Log .Trace ("\u004f\u0055\u0054\u003a\u0020\u0028\u0025\u0064\u0029\u0020\u0025\u0020\u0078",len (_eceda ),_eceda ); 835 if _eggc .Predictor > 1{if _eggc .Predictor ==2{_df .Log .Trace ("\u0054\u0069\u0066\u0066\u0020\u0065\u006e\u0063\u006f\u0064\u0069\u006e\u0067");_dbca :=_eggc .Columns *_eggc .Colors ;if _dbca < 1{return []byte {},nil ;};_dfg :=len (_eceda )/_dbca ;if len (_eceda )%_dbca !=0{_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020T\u0049\u0046\u0046 \u0065\u006e\u0063\u006fd\u0069\u006e\u0067\u003a\u0020\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0072\u006f\u0077\u0020\u006c\u0065\u006e\u0067\u0074\u0068\u002e\u002e\u002e"); 836 return nil ,_ea .Errorf ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0072\u006f\u0077 \u006c\u0065\u006e\u0067\u0074\u0068\u0020\u0028\u0025\u0064/\u0025\u0064\u0029",len (_eceda ),_dbca );};if _dbca %_eggc .Colors !=0{return nil ,_ea .Errorf ("\u0069\u006ev\u0061\u006c\u0069\u0064 \u0072\u006fw\u0020\u006c\u0065\u006e\u0067\u0074\u0068\u0020(\u0025\u0064\u0029\u0020\u0066\u006f\u0072\u0020\u0063\u006f\u006c\u006fr\u0073\u0020\u0025\u0064",_dbca ,_eggc .Colors ); 837 };if _dbca > len (_eceda ){_df .Log .Debug ("\u0052\u006fw\u0020\u006c\u0065\u006e\u0067t\u0068\u0020\u0063\u0061\u006en\u006f\u0074\u0020\u0062\u0065\u0020\u006c\u006f\u006e\u0067\u0065\u0072\u0020\u0074\u0068\u0061\u006e\u0020\u0064\u0061\u0074\u0061\u0020\u006c\u0065\u006e\u0067\u0074\u0068\u0020\u0028\u0025\u0064\u002f\u0025\u0064\u0029",_dbca ,len (_eceda )); 838 return nil ,_a .New ("\u0072\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b\u0020e\u0072\u0072\u006f\u0072");};_df .Log .Trace ("i\u006e\u0070\u0020\u006fut\u0044a\u0074\u0061\u0020\u0028\u0025d\u0029\u003a\u0020\u0025\u0020\u0078",len (_eceda ),_eceda ); 839 _gdce :=_d .NewBuffer (nil );for _gdf :=0;_gdf < _dfg ;_gdf ++{_gdac :=_eceda [_dbca *_gdf :_dbca *(_gdf +1)];for _ddc :=_eggc .Colors ;_ddc < _dbca ;_ddc ++{_gdac [_ddc ]=byte (int (_gdac [_ddc ]+_gdac [_ddc -_eggc .Colors ])%256);};_gdce .Write (_gdac ); 840 };_efb :=_gdce .Bytes ();_df .Log .Trace ("\u0050O\u0075t\u0044\u0061\u0074\u0061\u0020(\u0025\u0064)\u003a\u0020\u0025\u0020\u0078",len (_efb ),_efb );return _efb ,nil ;}else if _eggc .Predictor >=10&&_eggc .Predictor <=15{_df .Log .Trace ("\u0050\u004e\u0047 \u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067"); 841 _bbdc :=_eggc .Columns *_eggc .Colors +1;if _bbdc < 1{return []byte {},nil ;};_ffag :=len (_eceda )/_bbdc ;if len (_eceda )%_bbdc !=0{return nil ,_ea .Errorf ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0072\u006f\u0077 \u006c\u0065\u006e\u0067\u0074\u0068\u0020\u0028\u0025\u0064/\u0025\u0064\u0029",len (_eceda ),_bbdc ); 842 };if _bbdc > len (_eceda ){_df .Log .Debug ("\u0052\u006fw\u0020\u006c\u0065\u006e\u0067t\u0068\u0020\u0063\u0061\u006en\u006f\u0074\u0020\u0062\u0065\u0020\u006c\u006f\u006e\u0067\u0065\u0072\u0020\u0074\u0068\u0061\u006e\u0020\u0064\u0061\u0074\u0061\u0020\u006c\u0065\u006e\u0067\u0074\u0068\u0020\u0028\u0025\u0064\u002f\u0025\u0064\u0029",_bbdc ,len (_eceda )); 843 return nil ,_a .New ("\u0072\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b\u0020e\u0072\u0072\u006f\u0072");};_eda :=_d .NewBuffer (nil );_df .Log .Trace ("P\u0072\u0065\u0064\u0069ct\u006fr\u0020\u0063\u006f\u006c\u0075m\u006e\u0073\u003a\u0020\u0025\u0064",_eggc .Columns ); 844 _df .Log .Trace ("\u004ce\u006e\u0067\u0074\u0068:\u0020\u0025\u0064\u0020\u002f \u0025d\u0020=\u0020\u0025\u0064\u0020\u0072\u006f\u0077s",len (_eceda ),_bbdc ,_ffag );_fdgb :=make ([]byte ,_bbdc );for _fgd :=0;_fgd < _bbdc ;_fgd ++{_fdgb [_fgd ]=0;}; 845 for _deeb :=0;_deeb < _ffag ;_deeb ++{_fafg :=_eceda [_bbdc *_deeb :_bbdc *(_deeb +1)];_fca :=_fafg [0];switch _fca {case 0:case 1:for _cddc :=2;_cddc < _bbdc ;_cddc ++{_fafg [_cddc ]=byte (int (_fafg [_cddc ]+_fafg [_cddc -1])%256);};case 2:for _fagdc :=1; 846 _fagdc < _bbdc ;_fagdc ++{_fafg [_fagdc ]=byte (int (_fafg [_fagdc ]+_fdgb [_fagdc ])%256);};default:_df .Log .Debug ("\u0045\u0052\u0052O\u0052\u003a\u0020\u0049n\u0076\u0061\u006c\u0069\u0064\u0020\u0066i\u006c\u0074\u0065\u0072\u0020\u0062\u0079\u0074\u0065\u0020\u0028\u0025\u0064\u0029",_fca ); 847 return nil ,_ea .Errorf ("\u0069n\u0076\u0061\u006c\u0069\u0064\u0020\u0066\u0069\u006c\u0074\u0065r\u0020\u0062\u0079\u0074\u0065\u0020\u0028\u0025\u0064\u0029",_fca );};for _ecgb :=0;_ecgb < _bbdc ;_ecgb ++{_fdgb [_ecgb ]=_fafg [_ecgb ];};_eda .Write (_fafg [1:]); 848 };_fddf :=_eda .Bytes ();return _fddf ,nil ;}else {_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a \u0055\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u0020\u0070r\u0065\u0064\u0069\u0063\u0074\u006f\u0072 \u0028\u0025\u0064\u0029",_eggc .Predictor ); 849 return nil ,_ea .Errorf ("\u0075\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064 \u0070\u0072\u0065\u0064\u0069\u0063\u0074\u006f\u0072\u0020(\u0025\u0064\u0029",_eggc .Predictor );};};return _eceda ,nil ;}; 850 851 // GetString returns the *PdfObjectString represented by the PdfObject directly or indirectly within an indirect 852 // object. On type mismatch the found bool flag is false and a nil pointer is returned. 853 func GetString (obj PdfObject )(_acfbee *PdfObjectString ,_accf bool ){_acfbee ,_accf =TraceToDirectObject (obj ).(*PdfObjectString );return _acfbee ,_accf ;}; 854 855 // XrefTable represents the cross references in a PDF, i.e. the table of objects and information 856 // where to access within the PDF file. 857 type XrefTable struct{ObjectMap map[int ]XrefObject ;_ggf []XrefObject ;};func (_eebe *PdfParser )parseXrefTable ()(*PdfObjectDictionary ,error ){var _cade *PdfObjectDictionary ;_aeab ,_aaaab :=_eebe .readTextLine ();if _aaaab !=nil {return nil ,_aaaab ; 858 };if _eebe ._dcad &&_cb .Count (_cb .TrimPrefix (_aeab ,"\u0078\u0072\u0065\u0066"),"\u0020")> 0{_eebe ._ffge ._fdg =true ;};_df .Log .Trace ("\u0078\u0072\u0065\u0066 f\u0069\u0072\u0073\u0074\u0020\u006c\u0069\u006e\u0065\u003a\u0020\u0025\u0073",_aeab ); 859 _eebc :=-1;_ddde :=0;_aefab :=false ;_dabgc :="";for {_eebe .skipSpaces ();_ ,_abdd :=_eebe ._gcec .Peek (1);if _abdd !=nil {return nil ,_abdd ;};_aeab ,_abdd =_eebe .readTextLine ();if _abdd !=nil {return nil ,_abdd ;};_efbb :=_bcbac .FindStringSubmatch (_aeab ); 860 if len (_efbb )==0{_agab :=len (_dabgc )> 0;_dabgc +=_aeab +"\u000a";if _agab {_efbb =_bcbac .FindStringSubmatch (_dabgc );};};if len (_efbb )==3{if _eebe ._dcad &&!_eebe ._ffge ._bfa {var (_ecfbc bool ;_ggffe int ;);for _ ,_eff :=range _aeab {if _ec .IsDigit (_eff ){if _ecfbc {break ; 861 };continue ;};if !_ecfbc {_ecfbc =true ;};_ggffe ++;};if _ggffe > 1{_eebe ._ffge ._bfa =true ;};};_gebg ,_ :=_be .Atoi (_efbb [1]);_eaeb ,_ :=_be .Atoi (_efbb [2]);_eebc =_gebg ;_ddde =_eaeb ;_aefab =true ;_dabgc ="";_df .Log .Trace ("\u0078r\u0065\u0066 \u0073\u0075\u0062s\u0065\u0063\u0074\u0069\u006f\u006e\u003a \u0066\u0069\u0072\u0073\u0074\u0020o\u0062\u006a\u0065\u0063\u0074\u003a\u0020\u0025\u0064\u0020\u006fb\u006a\u0065\u0063\u0074\u0073\u003a\u0020\u0025\u0064",_eebc ,_ddde ); 862 continue ;};_gbce :=_aefgf .FindStringSubmatch (_aeab );if len (_gbce )==4{if !_aefab {_df .Log .Debug ("E\u0052\u0052\u004f\u0052\u0020\u0058r\u0065\u0066\u0020\u0069\u006e\u0076\u0061\u006c\u0069d\u0020\u0066\u006fr\u006da\u0074\u0021\u000a");return nil ,_a .New ("\u0078\u0072\u0065\u0066 i\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0066\u006f\u0072\u006d\u0061\u0074"); 863 };_ddbgf ,_ :=_be .ParseInt (_gbce [1],10,64);_eabda ,_ :=_be .Atoi (_gbce [2]);_fgbd :=_gbce [3];_dabgc ="";if _cb .ToLower (_fgbd )=="\u006e"&&_ddbgf > 1{_fgf ,_ffcf :=_eebe ._ggaf .ObjectMap [_eebc ];if !_ffcf ||_eabda > _fgf .Generation {_acca :=XrefObject {ObjectNumber :_eebc ,XType :XrefTypeTableEntry ,Offset :_ddbgf ,Generation :_eabda }; 864 _eebe ._ggaf .ObjectMap [_eebc ]=_acca ;};};_eebc ++;continue ;};if (len (_aeab )> 6)&&(_aeab [:7]=="\u0074r\u0061\u0069\u006c\u0065\u0072"){_df .Log .Trace ("\u0046o\u0075n\u0064\u0020\u0074\u0072\u0061i\u006c\u0065r\u0020\u002d\u0020\u0025\u0073",_aeab ); 865 if len (_aeab )> 9{_baed :=_eebe .GetFileOffset ();_eebe .SetFileOffset (_baed -int64 (len (_aeab ))+7);};_eebe .skipSpaces ();_eebe .skipComments ();_df .Log .Trace ("R\u0065\u0061\u0064\u0069ng\u0020t\u0072\u0061\u0069\u006c\u0065r\u0020\u0064\u0069\u0063\u0074\u0021"); 866 _df .Log .Trace ("\u0070\u0065\u0065\u006b\u003a\u0020\u0022\u0025\u0073\u0022",_aeab );_cade ,_abdd =_eebe .ParseDict ();_df .Log .Trace ("\u0045O\u0046\u0020\u0072\u0065a\u0064\u0069\u006e\u0067\u0020t\u0072a\u0069l\u0065\u0072\u0020\u0064\u0069\u0063\u0074!"); 867 if _abdd !=nil {_df .Log .Debug ("\u0045\u0072\u0072o\u0072\u0020\u0070\u0061r\u0073\u0069\u006e\u0067\u0020\u0074\u0072a\u0069\u006c\u0065\u0072\u0020\u0064\u0069\u0063\u0074\u0020\u0028\u0025\u0073\u0029",_abdd );return nil ,_abdd ;};break ;};if _aeab =="\u0025\u0025\u0045O\u0046"{_df .Log .Debug ("E\u0052\u0052\u004f\u0052\u003a\u0020\u0065\u006e\u0064 \u006f\u0066\u0020\u0066\u0069\u006c\u0065 -\u0020\u0074\u0072\u0061i\u006c\u0065\u0072\u0020\u006e\u006f\u0074\u0020\u0066ou\u006e\u0064 \u002d\u0020\u0065\u0072\u0072\u006f\u0072\u0021"); 868 return nil ,_a .New ("\u0065\u006e\u0064 \u006f\u0066\u0020\u0066i\u006c\u0065\u0020\u002d\u0020\u0074\u0072a\u0069\u006c\u0065\u0072\u0020\u006e\u006f\u0074\u0020\u0066\u006f\u0075\u006e\u0064");};_df .Log .Trace ("\u0078\u0072\u0065\u0066\u0020\u006d\u006f\u0072\u0065 \u003a\u0020\u0025\u0073",_aeab ); 869 };_df .Log .Trace ("\u0045\u004f\u0046 p\u0061\u0072\u0073\u0069\u006e\u0067\u0020\u0078\u0072\u0065\u0066\u0020\u0074\u0061\u0062\u006c\u0065\u0021");if _eebe ._dfbg ==nil {_fefd :=XrefTypeTableEntry ;_eebe ._dfbg =&_fefd ;};return _cade ,nil ;}; 870 871 // LookupByReference looks up a PdfObject by a reference. 872 func (_bea *PdfParser )LookupByReference (ref PdfObjectReference )(PdfObject ,error ){_df .Log .Trace ("\u004c\u006f\u006fki\u006e\u0067\u0020\u0075\u0070\u0020\u0072\u0065\u0066\u0065\u0072\u0065\u006e\u0063\u0065\u0020\u0025\u0073",ref .String ());return _bea .LookupByNumber (int (ref .ObjectNumber )); 873 }; 874 875 // PdfObjectString represents the primitive PDF string object. 876 type PdfObjectString struct{_bcfef string ;_aae bool ;}; 877 878 // GetFloatVal returns the float64 value represented by the PdfObject directly or indirectly if contained within an 879 // indirect object. On type mismatch the found bool flag returned is false and a nil pointer is returned. 880 func GetFloatVal (obj PdfObject )(_abbc float64 ,_deabe bool ){_ecbe ,_deabe :=TraceToDirectObject (obj ).(*PdfObjectFloat );if _deabe {return float64 (*_ecbe ),true ;};return 0,false ;};func (_afdc *PdfParser )seekToEOFMarker (_dfbd int64 )error {var _gecf int64 ; 881 var _gcac int64 =2048;for _gecf < _dfbd -4{if _dfbd <=(_gcac +_gecf ){_gcac =_dfbd -_gecf ;};_ ,_aeag :=_afdc ._abdga .Seek (_dfbd -_gecf -_gcac ,_gd .SeekStart );if _aeag !=nil {return _aeag ;};_cbec :=make ([]byte ,_gcac );_afdc ._abdga .Read (_cbec ); 882 _df .Log .Trace ("\u004c\u006f\u006f\u006bi\u006e\u0067\u0020\u0066\u006f\u0072\u0020\u0045\u004f\u0046 \u006da\u0072\u006b\u0065\u0072\u003a\u0020\u0022%\u0073\u0022",string (_cbec ));_egfg :=_eggcd .FindAllStringIndex (string (_cbec ),-1);if _egfg !=nil {_acgd :=_egfg [len (_egfg )-1]; 883 _df .Log .Trace ("\u0049\u006e\u0064\u003a\u0020\u0025\u0020\u0064",_egfg );_dffef :=_dfbd -_gecf -_gcac +int64 (_acgd [0]);_afdc ._abdga .Seek (_dffef ,_gd .SeekStart );return nil ;};_df .Log .Debug ("\u0057\u0061\u0072\u006e\u0069\u006eg\u003a\u0020\u0045\u004f\u0046\u0020\u006d\u0061\u0072\u006b\u0065\u0072\u0020\u006e\u006f\u0074\u0020\u0066\u006f\u0075n\u0064\u0021\u0020\u002d\u0020\u0063\u006f\u006e\u0074\u0069\u006e\u0075\u0065\u0020s\u0065e\u006b\u0069\u006e\u0067"); 884 _gecf +=_gcac -4;};_df .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u003a\u0020\u0045\u004f\u0046\u0020\u006d\u0061\u0072\u006be\u0072 \u0077\u0061\u0073\u0020\u006e\u006f\u0074\u0020\u0066\u006f\u0075\u006e\u0064\u002e");return _dcef ;}; 885 886 // ParseIndirectObject parses an indirect object from the input stream. Can also be an object stream. 887 // Returns the indirect object (*PdfIndirectObject) or the stream object (*PdfObjectStream). 888 func (_ggcf *PdfParser )ParseIndirectObject ()(PdfObject ,error ){_abed :=PdfIndirectObject {};_abed ._egcg =_ggcf ;_df .Log .Trace ("\u002dR\u0065a\u0064\u0020\u0069\u006e\u0064i\u0072\u0065c\u0074\u0020\u006f\u0062\u006a");_agfc ,_febaf :=_ggcf ._gcec .Peek (20); 889 if _febaf !=nil {if _febaf !=_gd .EOF {_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0046\u0061\u0069\u006c\u0020\u0074\u006f\u0020r\u0065a\u0064\u0020\u0069\u006e\u0064\u0069\u0072\u0065\u0063\u0074\u0020\u006f\u0062\u006a");return &_abed ,_febaf ; 890 };};_df .Log .Trace ("\u0028\u0069\u006edi\u0072\u0065\u0063\u0074\u0020\u006f\u0062\u006a\u0020\u0070\u0065\u0065\u006b\u0020\u0022\u0025\u0073\u0022",string (_agfc ));_fcc :=_bfdf .FindStringSubmatchIndex (string (_agfc ));if len (_fcc )< 6{if _febaf ==_gd .EOF {return nil ,_febaf ; 891 };_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020U\u006e\u0061\u0062l\u0065\u0020\u0074\u006f \u0066\u0069\u006e\u0064\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u0020\u0073\u0069\u0067\u006e\u0061\u0074\u0075\u0072\u0065\u0020\u0028\u0025\u0073\u0029",string (_agfc )); 892 return &_abed ,_a .New ("\u0075\u006e\u0061b\u006c\u0065\u0020\u0074\u006f\u0020\u0064\u0065\u0074\u0065\u0063\u0074\u0020\u0069\u006e\u0064\u0069\u0072\u0065\u0063\u0074\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u0020s\u0069\u0067\u006e\u0061\u0074\u0075\u0072\u0065"); 893 };_ggcf ._gcec .Discard (_fcc [0]);_df .Log .Trace ("O\u0066\u0066\u0073\u0065\u0074\u0073\u0020\u0025\u0020\u0064",_fcc );_fabe :=_fcc [1]-_fcc [0];_fdac :=make ([]byte ,_fabe );_ ,_febaf =_ggcf .ReadAtLeast (_fdac ,_fabe );if _febaf !=nil {_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0075\u006e\u0061\u0062l\u0065\u0020\u0074\u006f\u0020\u0072\u0065\u0061\u0064\u0020-\u0020\u0025\u0073",_febaf ); 894 return nil ,_febaf ;};_df .Log .Trace ("\u0074\u0065\u0078t\u006c\u0069\u006e\u0065\u003a\u0020\u0025\u0073",_fdac );_ffgaf :=_bfdf .FindStringSubmatch (string (_fdac ));if len (_ffgaf )< 3{_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020U\u006e\u0061\u0062l\u0065\u0020\u0074\u006f \u0066\u0069\u006e\u0064\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u0020\u0073\u0069\u0067\u006e\u0061\u0074\u0075\u0072\u0065\u0020\u0028\u0025\u0073\u0029",string (_fdac )); 895 return &_abed ,_a .New ("\u0075\u006e\u0061b\u006c\u0065\u0020\u0074\u006f\u0020\u0064\u0065\u0074\u0065\u0063\u0074\u0020\u0069\u006e\u0064\u0069\u0072\u0065\u0063\u0074\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u0020s\u0069\u0067\u006e\u0061\u0074\u0075\u0072\u0065"); 896 };_bdfc ,_ :=_be .Atoi (_ffgaf [1]);_ffege ,_ :=_be .Atoi (_ffgaf [2]);_abed .ObjectNumber =int64 (_bdfc );_abed .GenerationNumber =int64 (_ffege );for {_dcbfb ,_ceedb :=_ggcf ._gcec .Peek (2);if _ceedb !=nil {return &_abed ,_ceedb ;};_df .Log .Trace ("I\u006ed\u002e\u0020\u0070\u0065\u0065\u006b\u003a\u0020%\u0073\u0020\u0028\u0025 x\u0029\u0021",string (_dcbfb ),string (_dcbfb )); 897 if IsWhiteSpace (_dcbfb [0]){_ggcf .skipSpaces ();}else if _dcbfb [0]=='%'{_ggcf .skipComments ();}else if (_dcbfb [0]=='<')&&(_dcbfb [1]=='<'){_df .Log .Trace ("\u0043\u0061\u006c\u006c\u0020\u0050\u0061\u0072\u0073e\u0044\u0069\u0063\u0074");_abed .PdfObject ,_ceedb =_ggcf .ParseDict (); 898 _df .Log .Trace ("\u0045\u004f\u0046\u0020Ca\u006c\u006c\u0020\u0050\u0061\u0072\u0073\u0065\u0044\u0069\u0063\u0074\u003a\u0020%\u0076",_ceedb );if _ceedb !=nil {return &_abed ,_ceedb ;};_df .Log .Trace ("\u0050\u0061\u0072\u0073\u0065\u0064\u0020\u0064\u0069\u0063t\u0069\u006f\u006e\u0061\u0072\u0079\u002e.\u002e\u0020\u0066\u0069\u006e\u0069\u0073\u0068\u0065\u0064\u002e"); 899 }else if (_dcbfb [0]=='/')||(_dcbfb [0]=='(')||(_dcbfb [0]=='[')||(_dcbfb [0]=='<'){_abed .PdfObject ,_ceedb =_ggcf .parseObject ();if _ceedb !=nil {return &_abed ,_ceedb ;};_df .Log .Trace ("P\u0061\u0072\u0073\u0065\u0064\u0020o\u0062\u006a\u0065\u0063\u0074\u0020\u002e\u002e\u002e \u0066\u0069\u006ei\u0073h\u0065\u0064\u002e"); 900 }else if _dcbfb [0]==']'{_df .Log .Debug ("\u0057\u0041\u0052\u004e\u0049N\u0047\u003a\u0020\u0027\u005d\u0027 \u0063\u0068\u0061\u0072\u0061\u0063\u0074e\u0072\u0020\u006eo\u0074\u0020\u0062\u0065i\u006e\u0067\u0020\u0075\u0073\u0065d\u0020\u0061\u0073\u0020\u0061\u006e\u0020\u0061\u0072\u0072\u0061\u0079\u0020\u0065\u006e\u0064\u0069n\u0067\u0020\u006d\u0061\u0072\u006b\u0065\u0072\u002e\u0020\u0053\u006b\u0069\u0070\u0070\u0069\u006e\u0067\u002e"); 901 _ggcf ._gcec .Discard (1);}else {if _dcbfb [0]=='e'{_afedc ,_cdefc :=_ggcf .readTextLine ();if _cdefc !=nil {return nil ,_cdefc ;};if len (_afedc )>=6&&_afedc [0:6]=="\u0065\u006e\u0064\u006f\u0062\u006a"{break ;};}else if _dcbfb [0]=='s'{_dcbfb ,_ =_ggcf ._gcec .Peek (10); 902 if string (_dcbfb [:6])=="\u0073\u0074\u0072\u0065\u0061\u006d"{_gfc :=6;if len (_dcbfb )> 6{if IsWhiteSpace (_dcbfb [_gfc ])&&_dcbfb [_gfc ]!='\r'&&_dcbfb [_gfc ]!='\n'{_df .Log .Debug ("\u004e\u006fn\u002d\u0063\u006f\u006e\u0066\u006f\u0072\u006d\u0061\u006e\u0074\u0020\u0050\u0044\u0046\u0020\u006e\u006f\u0074 \u0065\u006e\u0064\u0069\u006e\u0067 \u0073\u0074\u0072\u0065\u0061\u006d\u0020\u006c\u0069\u006e\u0065\u0020\u0070\u0072o\u0070\u0065r\u006c\u0079\u0020\u0077i\u0074\u0068\u0020\u0045\u004fL\u0020\u006d\u0061\u0072\u006b\u0065\u0072"); 903 _ggcf ._ffge ._ecg =true ;_gfc ++;};if _dcbfb [_gfc ]=='\r'{_gfc ++;if _dcbfb [_gfc ]=='\n'{_gfc ++;};}else if _dcbfb [_gfc ]=='\n'{_gfc ++;}else {_ggcf ._ffge ._ecg =true ;};};_ggcf ._gcec .Discard (_gfc );_dcccf ,_abfd :=_abed .PdfObject .(*PdfObjectDictionary ); 904 if !_abfd {return nil ,_a .New ("\u0073\u0074\u0072\u0065\u0061\u006d\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u0020\u006di\u0073s\u0069\u006e\u0067\u0020\u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061\u0072\u0079");};_df .Log .Trace ("\u0053\u0074\u0072\u0065\u0061\u006d\u0020\u0064\u0069c\u0074\u0020\u0025\u0073",_dcccf ); 905 _effg ,_ggac :=_ggcf .traceStreamLength (_dcccf .Get ("\u004c\u0065\u006e\u0067\u0074\u0068"));if _ggac !=nil {_df .Log .Debug ("\u0046\u0061\u0069l\u0020\u0074\u006f\u0020t\u0072\u0061\u0063\u0065\u0020\u0073\u0074r\u0065\u0061\u006d\u0020\u006c\u0065\u006e\u0067\u0074\u0068\u003a\u0020\u0025\u0076",_ggac ); 906 return nil ,_ggac ;};_df .Log .Trace ("\u0053\u0074\u0072\u0065\u0061\u006d\u0020\u006c\u0065\u006e\u0067\u0074h\u003f\u0020\u0025\u0073",_effg );_aggbg ,_gbcca :=_effg .(*PdfObjectInteger );if !_gbcca {return nil ,_a .New ("\u0073\u0074re\u0061\u006d\u0020l\u0065\u006e\u0067\u0074h n\u0065ed\u0073\u0020\u0074\u006f\u0020\u0062\u0065 a\u006e\u0020\u0069\u006e\u0074\u0065\u0067e\u0072"); 907 };_cfbbb :=*_aggbg ;if _cfbbb < 0{return nil ,_a .New ("\u0073\u0074\u0072\u0065\u0061\u006d\u0020\u006e\u0065\u0065\u0064\u0073\u0020\u0074\u006f \u0062e\u0020\u006c\u006f\u006e\u0067\u0065\u0072\u0020\u0074\u0068\u0061\u006e\u0020\u0030");};_beafg :=_ggcf .GetFileOffset (); 908 _gbead :=_ggcf .xrefNextObjectOffset (_beafg );if _beafg +int64 (_cfbbb )> _gbead &&_gbead > _beafg {_df .Log .Debug ("E\u0078\u0070\u0065\u0063te\u0064 \u0065\u006e\u0064\u0069\u006eg\u0020\u0061\u0074\u0020\u0025\u0064",_beafg +int64 (_cfbbb ));_df .Log .Debug ("\u004e\u0065\u0078\u0074\u0020\u006f\u0062\u006a\u0065\u0063\u0074 \u0073\u0074\u0061\u0072\u0074\u0069\u006e\u0067\u0020\u0061t\u0020\u0025\u0064",_gbead ); 909 _eabf :=_gbead -_beafg -17;if _eabf < 0{return nil ,_a .New ("\u0069n\u0076\u0061l\u0069\u0064\u0020\u0073t\u0072\u0065\u0061m\u0020\u006c\u0065\u006e\u0067\u0074\u0068\u002c\u0020go\u0069\u006e\u0067 \u0070\u0061s\u0074\u0020\u0062\u006f\u0075\u006ed\u0061\u0072i\u0065\u0073"); 910 };_df .Log .Debug ("\u0041\u0074\u0074\u0065\u006d\u0070\u0074\u0069\u006e\u0067\u0020\u0061\u0020l\u0065\u006e\u0067\u0074\u0068\u0020c\u006f\u0072\u0072\u0065\u0063\u0074\u0069\u006f\u006e\u0020\u0074\u006f\u0020%\u0064\u002e\u002e\u002e",_eabf );_cfbbb =PdfObjectInteger (_eabf ); 911 _dcccf .Set ("\u004c\u0065\u006e\u0067\u0074\u0068",MakeInteger (_eabf ));};if int64 (_cfbbb )> _ggcf ._gccgc {_df .Log .Debug ("\u0045\u0052R\u004f\u0052\u003a\u0020\u0053t\u0072\u0065\u0061\u006d\u0020l\u0065\u006e\u0067\u0074\u0068\u0020\u0063\u0061\u006e\u006e\u006f\u0074\u0020\u0062\u0065\u0020\u006c\u0061\u0072\u0067\u0065\u0072\u0020\u0074\u0068\u0061\u006e\u0020\u0066\u0069\u006c\u0065\u0020\u0073\u0069\u007a\u0065"); 912 return nil ,_a .New ("\u0069n\u0076\u0061l\u0069\u0064\u0020\u0073t\u0072\u0065\u0061m\u0020\u006c\u0065\u006e\u0067\u0074\u0068\u002c\u0020la\u0072\u0067\u0065r\u0020\u0074h\u0061\u006e\u0020\u0066\u0069\u006ce\u0020\u0073i\u007a\u0065");};_bgbdb :=make ([]byte ,_cfbbb ); 913 _ ,_ggac =_ggcf .ReadAtLeast (_bgbdb ,int (_cfbbb ));if _ggac !=nil {_df .Log .Debug ("E\u0052\u0052\u004f\u0052 s\u0074r\u0065\u0061\u006d\u0020\u0028%\u0064\u0029\u003a\u0020\u0025\u0058",len (_bgbdb ),_bgbdb );_df .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_ggac ); 914 return nil ,_ggac ;};_adac :=PdfObjectStream {};_adac .Stream =_bgbdb ;_adac .PdfObjectDictionary =_abed .PdfObject .(*PdfObjectDictionary );_adac .ObjectNumber =_abed .ObjectNumber ;_adac .GenerationNumber =_abed .GenerationNumber ;_adac .PdfObjectReference ._egcg =_ggcf ; 915 _ggcf .skipSpaces ();_ggcf ._gcec .Discard (9);_ggcf .skipSpaces ();return &_adac ,nil ;};};_abed .PdfObject ,_ceedb =_ggcf .parseObject ();if _abed .PdfObject ==nil {_df .Log .Debug ("\u0049N\u0043\u004f\u004dP\u0041\u0054\u0049B\u0049LI\u0054\u0059\u003a\u0020\u0049\u006e\u0064i\u0072\u0065\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\u0061n \u006fb\u006a\u0065\u0063\u0074\u0020\u002d \u0061\u0073\u0073\u0075\u006di\u006e\u0067\u0020\u006e\u0075\u006c\u006c\u0020\u006f\u0062\u006ae\u0063\u0074"); 916 _abed .PdfObject =MakeNull ();};return &_abed ,_ceedb ;};};if _abed .PdfObject ==nil {_df .Log .Debug ("\u0049N\u0043\u004f\u004dP\u0041\u0054\u0049B\u0049LI\u0054\u0059\u003a\u0020\u0049\u006e\u0064i\u0072\u0065\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\u0061n \u006fb\u006a\u0065\u0063\u0074\u0020\u002d \u0061\u0073\u0073\u0075\u006di\u006e\u0067\u0020\u006e\u0075\u006c\u006c\u0020\u006f\u0062\u006ae\u0063\u0074"); 917 _abed .PdfObject =MakeNull ();};_df .Log .Trace ("\u0052\u0065\u0074\u0075rn\u0069\u006e\u0067\u0020\u0069\u006e\u0064\u0069\u0072\u0065\u0063\u0074\u0021");return &_abed ,nil ;}; 918 919 // WriteString outputs the object as it is to be written to file. 920 func (_cfdfd *PdfObjectString )WriteString ()string {var _afbb _d .Buffer ;if _cfdfd ._aae {_bdcg :=_ac .EncodeToString (_cfdfd .Bytes ());_afbb .WriteString ("\u003c");_afbb .WriteString (_bdcg );_afbb .WriteString ("\u003e");return _afbb .String ();}; 921 _fadd :=map[byte ]string {'\n':"\u005c\u006e",'\r':"\u005c\u0072",'\t':"\u005c\u0074",'\b':"\u005c\u0062",'\f':"\u005c\u0066",'(':"\u005c\u0028",')':"\u005c\u0029",'\\':"\u005c\u005c"};_afbb .WriteString ("\u0028");for _cfag :=0;_cfag < len (_cfdfd ._bcfef ); 922 _cfag ++{_dgea :=_cfdfd ._bcfef [_cfag ];if _gaffg ,_bdcfa :=_fadd [_dgea ];_bdcfa {_afbb .WriteString (_gaffg );}else {_afbb .WriteByte (_dgea );};};_afbb .WriteString ("\u0029");return _afbb .String ();}; 923 924 // ASCIIHexEncoder implements ASCII hex encoder/decoder. 925 type ASCIIHexEncoder struct{}; 926 927 // NewJPXEncoder returns a new instance of JPXEncoder. 928 func NewJPXEncoder ()*JPXEncoder {return &JPXEncoder {}}; 929 930 // DecodeBytes decodes byte array with ASCII85. 5 ASCII characters -> 4 raw binary bytes 931 func (_acfd *ASCII85Encoder )DecodeBytes (encoded []byte )([]byte ,error ){var _gccd []byte ;_df .Log .Trace ("\u0041\u0053\u0043\u0049\u0049\u0038\u0035\u0020\u0044e\u0063\u006f\u0064\u0065");_dfgg :=0;_bfcd :=false ;for _dfgg < len (encoded )&&!_bfcd {_beeg :=[5]byte {0,0,0,0,0}; 932 _cdba :=0;_cabfe :=0;_ddcd :=4;for _cabfe < 5+_cdba {if _dfgg +_cabfe ==len (encoded ){break ;};_ddfd :=encoded [_dfgg +_cabfe ];if IsWhiteSpace (_ddfd ){_cdba ++;_cabfe ++;continue ;}else if _ddfd =='~'&&_dfgg +_cabfe +1< len (encoded )&&encoded [_dfgg +_cabfe +1]=='>'{_ddcd =(_cabfe -_cdba )-1; 933 if _ddcd < 0{_ddcd =0;};_bfcd =true ;break ;}else if _ddfd >='!'&&_ddfd <='u'{_ddfd -='!';}else if _ddfd =='z'&&_cabfe -_cdba ==0{_ddcd =4;_cabfe ++;break ;}else {_df .Log .Error ("\u0046\u0061i\u006c\u0065\u0064\u0020\u0064\u0065\u0063\u006f\u0064\u0069\u006e\u0067\u002c\u0020\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020co\u0064\u0065"); 934 return nil ,_a .New ("\u0069n\u0076\u0061\u006c\u0069\u0064\u0020\u0063\u006f\u0064\u0065\u0020e\u006e\u0063\u006f\u0075\u006e\u0074\u0065\u0072\u0065\u0064");};_beeg [_cabfe -_cdba ]=_ddfd ;_cabfe ++;};_dfgg +=_cabfe ;for _cbg :=_ddcd +1;_cbg < 5;_cbg ++{_beeg [_cbg ]=84; 935 };_bcdb :=uint32 (_beeg [0])*85*85*85*85+uint32 (_beeg [1])*85*85*85+uint32 (_beeg [2])*85*85+uint32 (_beeg [3])*85+uint32 (_beeg [4]);_adbec :=[]byte {byte ((_bcdb >>24)&0xff),byte ((_bcdb >>16)&0xff),byte ((_bcdb >>8)&0xff),byte (_bcdb &0xff)};_gccd =append (_gccd ,_adbec [:_ddcd ]...); 936 };_df .Log .Trace ("A\u0053\u0043\u0049\u004985\u002c \u0065\u006e\u0063\u006f\u0064e\u0064\u003a\u0020\u0025\u0020\u0058",encoded );_df .Log .Trace ("A\u0053\u0043\u0049\u004985\u002c \u0064\u0065\u0063\u006f\u0064e\u0064\u003a\u0020\u0025\u0020\u0058",_gccd ); 937 return _gccd ,nil ;}; 938 939 // UpdateParams updates the parameter values of the encoder. 940 func (_faga *MultiEncoder )UpdateParams (params *PdfObjectDictionary ){for _ ,_bbea :=range _faga ._gbgba {_bbea .UpdateParams (params );};};var _efdd =_f .MustCompile ("\u0025P\u0044F\u002d\u0028\u005c\u0064\u0029\u005c\u002e\u0028\u005c\u0064\u0029"); 941 942 943 // HasInvalidSeparationAfterXRef implements core.ParserMetadata interface. 944 func (_bgga ParserMetadata )HasInvalidSeparationAfterXRef ()bool {return _bgga ._fdg }; 945 946 // Decrypt attempts to decrypt the PDF file with a specified password. Also tries to 947 // decrypt with an empty password. Returns true if successful, false otherwise. 948 // An error is returned when there is a problem with decrypting. 949 func (_affb *PdfParser )Decrypt (password []byte )(bool ,error ){if _affb ._acg ==nil {return false ,_a .New ("\u0063\u0068\u0065\u0063k \u0065\u006e\u0063\u0072\u0079\u0070\u0074\u0069\u006f\u006e\u0020\u0066\u0069\u0072s\u0074");};_bggdg ,_agggf :=_affb ._acg .authenticate (password ); 950 if _agggf !=nil {return false ,_agggf ;};if !_bggdg {_bggdg ,_agggf =_affb ._acg .authenticate ([]byte (""));};return _bggdg ,_agggf ;};func _gfabf (_bdgd string )(PdfObjectReference ,error ){_edcgb :=PdfObjectReference {};_feca :=_dbgee .FindStringSubmatch (_bdgd ); 951 if len (_feca )< 3{_df .Log .Debug ("\u0045\u0072\u0072or\u0020\u0070\u0061\u0072\u0073\u0069\u006e\u0067\u0020\u0072\u0065\u0066\u0065\u0072\u0065\u006e\u0063\u0065");return _edcgb ,_a .New ("\u0075n\u0061\u0062\u006c\u0065 \u0074\u006f\u0020\u0070\u0061r\u0073e\u0020r\u0065\u0066\u0065\u0072\u0065\u006e\u0063e"); 952 };_cgdc ,_ :=_be .Atoi (_feca [1]);_abcgd ,_ :=_be .Atoi (_feca [2]);_edcgb .ObjectNumber =int64 (_cgdc );_edcgb .GenerationNumber =int64 (_abcgd );return _edcgb ,nil ;}; 953 954 // NewCCITTFaxEncoder makes a new CCITTFax encoder. 955 func NewCCITTFaxEncoder ()*CCITTFaxEncoder {return &CCITTFaxEncoder {Columns :1728,EndOfBlock :true }}; 956 957 // DecodeBytes decodes the CCITTFax encoded image data. 958 func (_fgef *CCITTFaxEncoder )DecodeBytes (encoded []byte )([]byte ,error ){_egdb ,_eccd :=_dc .NewDecoder (encoded ,_dc .DecodeOptions {Columns :_fgef .Columns ,Rows :_fgef .Rows ,K :_fgef .K ,EncodedByteAligned :_fgef .EncodedByteAlign ,BlackIsOne :_fgef .BlackIs1 ,EndOfBlock :_fgef .EndOfBlock ,EndOfLine :_fgef .EndOfLine ,DamagedRowsBeforeError :_fgef .DamagedRowsBeforeError }); 959 if _eccd !=nil {return nil ,_eccd ;};_dcba ,_eccd :=_bc .ReadAll (_egdb );if _eccd !=nil {return nil ,_eccd ;};return _dcba ,nil ;}; 960 961 // StreamEncoder represents the interface for all PDF stream encoders. 962 type StreamEncoder interface{GetFilterName ()string ;MakeDecodeParams ()PdfObject ;MakeStreamDict ()*PdfObjectDictionary ;UpdateParams (_eab *PdfObjectDictionary );EncodeBytes (_dcg []byte )([]byte ,error );DecodeBytes (_bfec []byte )([]byte ,error );DecodeStream (_gce *PdfObjectStream )([]byte ,error ); 963 };const _dffc =32<<(^uint (0)>>63); 964 965 // GetFilterName returns the name of the encoding filter. 966 func (_fcg *RawEncoder )GetFilterName ()string {return StreamEncodingFilterNameRaw }; 967 968 // NewCompliancePdfParser creates a new PdfParser that will parse input reader with the focus on extracting more metadata, which 969 // might affect performance of the regular PdfParser this function. 970 func NewCompliancePdfParser (rs _gd .ReadSeeker )(_dbgb *PdfParser ,_baec error ){_dbgb =&PdfParser {_abdga :rs ,ObjCache :make (objectCache ),_dbaad :map[int64 ]bool {},_dcad :true ,_dgef :make (map[*PdfParser ]*PdfParser )};if _baec =_dbgb .parseDetailedHeader (); 971 _baec !=nil {return nil ,_baec ;};if _dbgb ._aagb ,_baec =_dbgb .loadXrefs ();_baec !=nil {_df .Log .Debug ("\u0045\u0052RO\u0052\u003a\u0020F\u0061\u0069\u006c\u0065d t\u006f l\u006f\u0061\u0064\u0020\u0078\u0072\u0065f \u0074\u0061\u0062\u006c\u0065\u0021\u0020%\u0073",_baec ); 972 return nil ,_baec ;};_df .Log .Trace ("T\u0072\u0061\u0069\u006c\u0065\u0072\u003a\u0020\u0025\u0073",_dbgb ._aagb );if len (_dbgb ._ggaf .ObjectMap )==0{return nil ,_ea .Errorf ("\u0065\u006d\u0070\u0074\u0079\u0020\u0058\u0052\u0045\u0046\u0020t\u0061\u0062\u006c\u0065\u0020\u002d\u0020\u0049\u006e\u0076a\u006c\u0069\u0064"); 973 };return _dbgb ,nil ;}; 974 975 // Len returns the number of elements in the array. 976 func (_dcge *PdfObjectArray )Len ()int {if _dcge ==nil {return 0;};return len (_dcge ._cdea );}; 977 978 // String returns the PDF version as a string. Implements interface fmt.Stringer. 979 func (_fgbg Version )String ()string {return _ea .Sprintf ("\u00250\u0064\u002e\u0025\u0030\u0064",_fgbg .Major ,_fgbg .Minor );}; 980 981 // JPXEncoder implements JPX encoder/decoder (dummy, for now) 982 // FIXME: implement 983 type JPXEncoder struct{};const _abedf =10; 984 985 // NewParserFromString is used for testing purposes. 986 func NewParserFromString (txt string )*PdfParser {_abge :=_d .NewReader ([]byte (txt ));_agabg :=&PdfParser {ObjCache :objectCache {},_abdga :_abge ,_gcec :_fd .NewReader (_abge ),_gccgc :int64 (len (txt )),_dbaad :map[int64 ]bool {},_dgef :make (map[*PdfParser ]*PdfParser )}; 987 _agabg ._ggaf .ObjectMap =make (map[int ]XrefObject );return _agabg ;}; 988 989 // GetInt returns the *PdfObjectBool object that is represented by a PdfObject either directly or indirectly 990 // within an indirect object. The bool flag indicates whether a match was found. 991 func GetInt (obj PdfObject )(_abegg *PdfObjectInteger ,_deccf bool ){_abegg ,_deccf =TraceToDirectObject (obj ).(*PdfObjectInteger );return _abegg ,_deccf ;}; 992 993 // GetXrefTable returns the PDFs xref table. 994 func (_dbdc *PdfParser )GetXrefTable ()XrefTable {return _dbdc ._ggaf }; 995 996 // MakeDecodeParams makes a new instance of an encoding dictionary based on 997 // the current encoder settings. 998 func (_cfcg *JPXEncoder )MakeDecodeParams ()PdfObject {return nil };func (_bgdb *PdfParser )checkLinearizedInformation (_acbc *PdfObjectDictionary )(bool ,error ){var _bdgb error ;_bgdb ._adcg ,_bdgb =GetNumberAsInt64 (_acbc .Get ("\u004c"));if _bdgb !=nil {return false ,_bdgb ; 999 };_bdgb =_bgdb .seekToEOFMarker (_bgdb ._adcg );switch _bdgb {case nil :return true ,nil ;case _dcef :return false ,nil ;default:return false ,_bdgb ;};}; 1000 1001 // DecodeBytes decodes a byte slice from Run length encoding. 1002 // 1003 // 7.4.5 RunLengthDecode Filter 1004 // The RunLengthDecode filter decodes data that has been encoded in a simple byte-oriented format based on run length. 1005 // The encoded data shall be a sequence of runs, where each run shall consist of a length byte followed by 1 to 128 1006 // bytes of data. If the length byte is in the range 0 to 127, the following length + 1 (1 to 128) bytes shall be 1007 // copied literally during decompression. If length is in the range 129 to 255, the following single byte shall be 1008 // copied 257 - length (2 to 128) times during decompression. A length value of 128 shall denote EOD. 1009 func (_ebaa *RunLengthEncoder )DecodeBytes (encoded []byte )([]byte ,error ){_dacb :=_d .NewReader (encoded );var _gbbg []byte ;for {_fagb ,_aadc :=_dacb .ReadByte ();if _aadc !=nil {return nil ,_aadc ;};if _fagb > 128{_fefg ,_gef :=_dacb .ReadByte (); 1010 if _gef !=nil {return nil ,_gef ;};for _eddb :=0;_eddb < 257-int (_fagb );_eddb ++{_gbbg =append (_gbbg ,_fefg );};}else if _fagb < 128{for _gdag :=0;_gdag < int (_fagb )+1;_gdag ++{_cdga ,_geba :=_dacb .ReadByte ();if _geba !=nil {return nil ,_geba ;}; 1011 _gbbg =append (_gbbg ,_cdga );};}else {break ;};};return _gbbg ,nil ;}; 1012 1013 // PdfObjectFloat represents the primitive PDF floating point numerical object. 1014 type PdfObjectFloat float64 ; 1015 1016 // MakeDecodeParams makes a new instance of an encoding dictionary based on 1017 // the current encoder settings. 1018 func (_babg *ASCII85Encoder )MakeDecodeParams ()PdfObject {return nil }; 1019 1020 // String returns a string describing `array`. 1021 func (_eeba *PdfObjectArray )String ()string {_efaab :="\u005b";for _eccf ,_ebaf :=range _eeba .Elements (){_efaab +=_ebaf .String ();if _eccf < (_eeba .Len ()-1){_efaab +="\u002c\u0020";};};_efaab +="\u005d";return _efaab ;};func (_eedb *PdfCrypt )makeKey (_ffeg string ,_caba ,_fded uint32 ,_fba []byte )([]byte ,error ){_gabc ,_edda :=_eedb ._bde [_ffeg ]; 1022 if !_edda {return nil ,_ea .Errorf ("\u0075n\u006b\u006e\u006f\u0077n\u0020\u0063\u0072\u0079\u0070t\u0020f\u0069l\u0074\u0065\u0072\u0020\u0028\u0025\u0073)",_ffeg );};return _gabc .MakeKey (_caba ,_fded ,_fba );}; 1023 1024 // Get returns the i-th element of the array or nil if out of bounds (by index). 1025 func (_eef *PdfObjectArray )Get (i int )PdfObject {if _eef ==nil ||i >=len (_eef ._cdea )||i < 0{return nil ;};return _eef ._cdea [i ];}; 1026 1027 // GetRevisionNumber returns the current version of the Pdf document. 1028 func (_fdece *PdfParser )GetRevisionNumber ()int {return _fdece ._eaae }; 1029 1030 // AddPageImage adds the page with the image 'img' to the encoder context in order to encode it jbig2 document. 1031 // The 'settings' defines what encoding type should be used by the encoder. 1032 func (_ffac *JBIG2Encoder )AddPageImage (img *JBIG2Image ,settings *JBIG2EncoderSettings )(_caa error ){const _agd ="\u004a\u0042\u0049\u0047\u0032\u0044\u006f\u0063\u0075\u006d\u0065n\u0074\u002e\u0041\u0064\u0064\u0050\u0061\u0067\u0065\u0049m\u0061\u0067\u0065"; 1033 if _ffac ==nil {return _dd .Error (_agd ,"J\u0042I\u0047\u0032\u0044\u006f\u0063\u0075\u006d\u0065n\u0074\u0020\u0069\u0073 n\u0069\u006c");};if settings ==nil {settings =&_ffac .DefaultPageSettings ;};if _ffac ._efaa ==nil {_ffac ._efaa =_ecdf .InitEncodeDocument (settings .FileMode ); 1034 };if _caa =settings .Validate ();_caa !=nil {return _dd .Wrap (_caa ,_agd ,"");};_ddbg ,_caa :=img .toBitmap ();if _caa !=nil {return _dd .Wrap (_caa ,_agd ,"");};switch settings .Compression {case JB2Generic :if _caa =_ffac ._efaa .AddGenericPage (_ddbg ,settings .DuplicatedLinesRemoval ); 1035 _caa !=nil {return _dd .Wrap (_caa ,_agd ,"");};case JB2SymbolCorrelation :return _dd .Error (_agd ,"s\u0079\u006d\u0062\u006f\u006c\u0020\u0063\u006f\u0072r\u0065\u006c\u0061\u0074\u0069\u006f\u006e e\u006e\u0063\u006f\u0064i\u006e\u0067\u0020\u006e\u006f\u0074\u0020\u0069\u006dpl\u0065\u006de\u006e\u0074\u0065\u0064\u0020\u0079\u0065\u0074"); 1036 case JB2SymbolRankHaus :return _dd .Error (_agd ,"\u0073y\u006d\u0062o\u006c\u0020\u0072a\u006e\u006b\u0020\u0068\u0061\u0075\u0073 \u0065\u006e\u0063\u006f\u0064\u0069n\u0067\u0020\u006e\u006f\u0074\u0020\u0069\u006d\u0070\u006c\u0065m\u0065\u006e\u0074\u0065\u0064\u0020\u0079\u0065\u0074"); 1037 default:return _dd .Error (_agd ,"\u0070\u0072\u006f\u0076i\u0064\u0065\u0064\u0020\u0069\u006e\u0076\u0061\u006c\u0069d\u0020c\u006f\u006d\u0070\u0072\u0065\u0073\u0073i\u006f\u006e");};return nil ;}; 1038 1039 // GetBoolVal returns the bool value within a *PdObjectBool represented by an PdfObject interface directly or indirectly. 1040 // If the PdfObject does not represent a bool value, a default value of false is returned (found = false also). 1041 func GetBoolVal (obj PdfObject )(_cbde bool ,_bfecf bool ){_babf ,_bfecf :=TraceToDirectObject (obj ).(*PdfObjectBool );if _bfecf {return bool (*_babf ),true ;};return false ,false ;}; 1042 1043 // Set sets the PdfObject at index i of the array. An error is returned if the index is outside bounds. 1044 func (_dfce *PdfObjectArray )Set (i int ,obj PdfObject )error {if i < 0||i >=len (_dfce ._cdea ){return _a .New ("\u006f\u0075\u0074\u0073\u0069\u0064\u0065\u0020\u0062o\u0075\u006e\u0064\u0073");};_dfce ._cdea [i ]=obj ;return nil ;}; 1045 1046 // GetObjectStreams returns the *PdfObjectStreams represented by the PdfObject. On type mismatch the found bool flag is 1047 // false and a nil pointer is returned. 1048 func GetObjectStreams (obj PdfObject )(_bbbc *PdfObjectStreams ,_ceag bool ){_bbbc ,_ceag =obj .(*PdfObjectStreams );return _bbbc ,_ceag ;}; 1049 1050 // MakeArrayFromIntegers creates an PdfObjectArray from a slice of ints, where each array element is 1051 // an PdfObjectInteger. 1052 func MakeArrayFromIntegers (vals []int )*PdfObjectArray {_gacdc :=MakeArray ();for _ ,_gbga :=range vals {_gacdc .Append (MakeInteger (int64 (_gbga )));};return _gacdc ;}; 1053 1054 // DecodeBytes decodes a slice of JPX encoded bytes and returns the result. 1055 func (_eegf *JPXEncoder )DecodeBytes (encoded []byte )([]byte ,error ){_df .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u003a\u0020\u0041t\u0074\u0065\u006dpt\u0069\u006e\u0067\u0020\u0074\u006f \u0075\u0073\u0065\u0020\u0075\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064 \u0065\u006e\u0063\u006f\u0064\u0069\u006e\u0067 \u0025\u0073",_eegf .GetFilterName ()); 1056 return encoded ,ErrNoJPXDecode ;}; 1057 1058 // EncodeStream encodes the stream data using the encoded specified by the stream's dictionary. 1059 func EncodeStream (streamObj *PdfObjectStream )error {_df .Log .Trace ("\u0045\u006e\u0063\u006f\u0064\u0065\u0020\u0073\u0074\u0072\u0065\u0061\u006d");_cgcad ,_agfd :=NewEncoderFromStream (streamObj );if _agfd !=nil {_df .Log .Debug ("\u0053\u0074\u0072\u0065\u0061\u006d\u0020\u0064\u0065\u0063\u006fd\u0069\u006e\u0067\u0020\u0066\u0061\u0069\u006c\u0065\u0064:\u0020\u0025\u0076",_agfd ); 1060 return _agfd ;};if _ecba ,_cdegd :=_cgcad .(*LZWEncoder );_cdegd {_ecba .EarlyChange =0;streamObj .PdfObjectDictionary .Set ("E\u0061\u0072\u006c\u0079\u0043\u0068\u0061\u006e\u0067\u0065",MakeInteger (0));};_df .Log .Trace ("\u0045\u006e\u0063\u006f\u0064\u0065\u0072\u003a\u0020\u0025\u002b\u0076\u000a",_cgcad ); 1061 _gaffe ,_agfd :=_cgcad .EncodeBytes (streamObj .Stream );if _agfd !=nil {_df .Log .Debug ("\u0053\u0074\u0072\u0065\u0061\u006d\u0020\u0065\u006e\u0063\u006fd\u0069\u006e\u0067\u0020\u0066\u0061\u0069\u006c\u0065\u0064:\u0020\u0025\u0076",_agfd );return _agfd ; 1062 };streamObj .Stream =_gaffe ;streamObj .PdfObjectDictionary .Set ("\u004c\u0065\u006e\u0067\u0074\u0068",MakeInteger (int64 (len (_gaffe ))));return nil ;}; 1063 1064 // PdfCryptNewDecrypt makes the document crypt handler based on the encryption dictionary 1065 // and trailer dictionary. Returns an error on failure to process. 1066 func PdfCryptNewDecrypt (parser *PdfParser ,ed ,trailer *PdfObjectDictionary )(*PdfCrypt ,error ){_dbe :=&PdfCrypt {_age :false ,_gee :make (map[PdfObject ]bool ),_fag :make (map[PdfObject ]bool ),_becc :make (map[int ]struct{}),_edd :parser };_dgd ,_acd :=ed .Get ("\u0046\u0069\u006c\u0074\u0065\u0072").(*PdfObjectName ); 1067 if !_acd {_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u0020\u0043\u0072\u0079\u0070\u0074 \u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061r\u0079 \u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0072\u0065\u0071\u0075\u0069\u0072\u0065\u0064\u0020\u0046i\u006c\u0074\u0065\u0072\u0020\u0066\u0069\u0065\u006c\u0064\u0021"); 1068 return _dbe ,_a .New ("r\u0065\u0071\u0075\u0069\u0072\u0065d\u0020\u0063\u0072\u0079\u0070\u0074 \u0066\u0069\u0065\u006c\u0064\u0020\u0046i\u006c\u0074\u0065\u0072\u0020\u006d\u0069\u0073\u0073\u0069n\u0067");};if *_dgd !="\u0053\u0074\u0061\u006e\u0064\u0061\u0072\u0064"{_df .Log .Debug ("\u0045\u0052R\u004f\u0052\u0020\u0055\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u0020\u0066\u0069\u006c\u0074\u0065\u0072\u0020(%\u0073\u0029",*_dgd ); 1069 return _dbe ,_a .New ("\u0075n\u0073u\u0070\u0070\u006f\u0072\u0074e\u0064\u0020F\u0069\u006c\u0074\u0065\u0072");};_dbe ._dgc .Filter =string (*_dgd );if _cac ,_cbfd :=ed .Get ("\u0053u\u0062\u0046\u0069\u006c\u0074\u0065r").(*PdfObjectString );_cbfd {_dbe ._dgc .SubFilter =_cac .Str (); 1070 _df .Log .Debug ("\u0055s\u0069n\u0067\u0020\u0073\u0075\u0062f\u0069\u006ct\u0065\u0072\u0020\u0025\u0073",_cac );};if L ,_eed :=ed .Get ("\u004c\u0065\u006e\u0067\u0074\u0068").(*PdfObjectInteger );_eed {if (*L %8)!=0{_df .Log .Debug ("\u0045\u0052\u0052O\u0052\u0020\u0049\u006ev\u0061\u006c\u0069\u0064\u0020\u0065\u006ec\u0072\u0079\u0070\u0074\u0069\u006f\u006e\u0020\u006c\u0065\u006e\u0067\u0074\u0068"); 1071 return _dbe ,_a .New ("\u0069n\u0076\u0061\u006c\u0069d\u0020\u0065\u006e\u0063\u0072y\u0070t\u0069o\u006e\u0020\u006c\u0065\u006e\u0067\u0074h");};_dbe ._dgc .Length =int (*L );}else {_dbe ._dgc .Length =40;};_dbe ._dgc .V =0;if _bdb ,_gbea :=ed .Get ("\u0056").(*PdfObjectInteger ); 1072 _gbea {V :=int (*_bdb );_dbe ._dgc .V =V ;if V >=1&&V <=2{_dbe ._bde =_gff (_dbe ._dgc .Length );}else if V >=4&&V <=5{if _efd :=_dbe .loadCryptFilters (ed );_efd !=nil {return _dbe ,_efd ;};}else {_df .Log .Debug ("E\u0052\u0052\u004f\u0052\u0020\u0055\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u0020\u0065n\u0063\u0072\u0079\u0070\u0074\u0069\u006f\u006e\u0020\u0061lg\u006f\u0020\u0056 \u003d \u0025\u0064",V ); 1073 return _dbe ,_a .New ("u\u006e\u0073\u0075\u0070po\u0072t\u0065\u0064\u0020\u0061\u006cg\u006f\u0072\u0069\u0074\u0068\u006d");};};if _cbag :=_fbea (&_dbe ._bga ,ed );_cbag !=nil {return _dbe ,_cbag ;};_fagg :="";if _egg ,_aaca :=trailer .Get ("\u0049\u0044").(*PdfObjectArray ); 1074 _aaca &&_egg .Len ()>=1{_gab ,_ceb :=GetString (_egg .Get (0));if !_ceb {return _dbe ,_a .New ("\u0069n\u0076a\u006c\u0069\u0064\u0020\u0074r\u0061\u0069l\u0065\u0072\u0020\u0049\u0044");};_fagg =_gab .Str ();}else {_df .Log .Debug ("\u0054\u0072ai\u006c\u0065\u0072 \u0049\u0044\u0020\u0061rra\u0079 m\u0069\u0073\u0073\u0069\u006e\u0067\u0020or\u0020\u0069\u006e\u0076\u0061\u006c\u0069d\u0021"); 1075 };_dbe ._geg =_fagg ;return _dbe ,nil ;};func (_aabb *PdfParser )parseXrefStream (_gcegf *PdfObjectInteger )(*PdfObjectDictionary ,error ){if _gcegf !=nil {_df .Log .Trace ("\u0058\u0052\u0065f\u0053\u0074\u006d\u0020x\u0072\u0065\u0066\u0020\u0074\u0061\u0062l\u0065\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u0020\u0061\u0074\u0020\u0025\u0064",_gcegf ); 1076 _aabb ._abdga .Seek (int64 (*_gcegf ),_gd .SeekStart );_aabb ._gcec =_fd .NewReader (_aabb ._abdga );};_agccg :=_aabb .GetFileOffset ();_egbbf ,_gafg :=_aabb .ParseIndirectObject ();if _gafg !=nil {_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a \u0046\u0061\u0069\u006c\u0065\u0064\u0020\u0074\u006f\u0020\u0072\u0065\u0061d\u0020\u0078\u0072\u0065\u0066\u0020\u006fb\u006a\u0065\u0063\u0074"); 1077 return nil ,_a .New ("\u0066\u0061\u0069\u006c\u0065\u0064\u0020\u0074\u006f\u0020\u0072e\u0061\u0064\u0020\u0078\u0072\u0065\u0066\u0020\u006f\u0062j\u0065\u0063\u0074");};_df .Log .Trace ("\u0058R\u0065f\u0053\u0074\u006d\u0020\u006fb\u006a\u0065c\u0074\u003a\u0020\u0025\u0073",_egbbf ); 1078 _fdae ,_eddd :=_egbbf .(*PdfObjectStream );if !_eddd {_df .Log .Debug ("\u0045R\u0052\u004fR\u003a\u0020\u0058R\u0065\u0066\u0053\u0074\u006d\u0020\u0070o\u0069\u006e\u0074\u0069\u006e\u0067 \u0074\u006f\u0020\u006e\u006f\u006e\u002d\u0073\u0074\u0072\u0065a\u006d\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u0021"); 1079 return nil ,_a .New ("\u0058\u0052\u0065\u0066\u0053\u0074\u006d\u0020\u0070\u006f\u0069\u006e\u0074i\u006e\u0067\u0020\u0074\u006f\u0020a\u0020\u006e\u006f\u006e\u002d\u0073\u0074\u0072\u0065\u0061\u006d\u0020\u006fb\u006a\u0065\u0063\u0074");};_caab :=_fdae .PdfObjectDictionary ; 1080 _fcbf ,_eddd :=_fdae .PdfObjectDictionary .Get ("\u0053\u0069\u007a\u0065").(*PdfObjectInteger );if !_eddd {_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a \u004d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0073\u0069\u007a\u0065\u0020f\u0072\u006f\u006d\u0020\u0078\u0072\u0065f\u0020\u0073\u0074\u006d"); 1081 return nil ,_a .New ("\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0053\u0069\u007ae\u0020\u0066\u0072\u006f\u006d\u0020\u0078\u0072\u0065\u0066 \u0073\u0074\u006d");};if int64 (*_fcbf )> 8388607{_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0078\u0072\u0065\u0066\u0020\u0053\u0069\u007a\u0065\u0020\u0065x\u0063\u0065\u0065\u0064\u0065\u0064\u0020l\u0069\u006d\u0069\u0074\u002c\u0020\u006f\u0076\u0065\u0072\u00208\u0033\u0038\u0038\u0036\u0030\u0037\u0020\u0028\u0025\u0064\u0029",*_fcbf ); 1082 return nil ,_a .New ("\u0072\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b\u0020e\u0072\u0072\u006f\u0072");};_caae :=_fdae .PdfObjectDictionary .Get ("\u0057");_eecgf ,_eddd :=_caae .(*PdfObjectArray );if !_eddd {return nil ,_a .New ("\u0069n\u0076\u0061\u006c\u0069\u0064\u0020\u0057\u0020\u0069\u006e\u0020x\u0072\u0065\u0066\u0020\u0073\u0074\u0072\u0065\u0061\u006d"); 1083 };_fgee :=_eecgf .Len ();if _fgee !=3{_df .Log .Debug ("\u0045\u0052R\u004f\u0052\u003a\u0020\u0055\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u0020\u0078\u0072\u0065\u0066\u0020\u0073\u0074\u006d\u0020\u0028\u006c\u0065\u006e\u0028\u0057\u0029\u0020\u0021\u003d\u0020\u0033\u0020\u002d\u0020\u0025\u0064\u0029",_fgee ); 1084 return nil ,_a .New ("\u0075\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u0020\u0078\u0072\u0065f\u0020s\u0074\u006d\u0020\u006c\u0065\u006e\u0028\u0057\u0029\u0020\u0021\u003d\u0020\u0033");};var _adfc []int64 ;for _aged :=0;_aged < 3; 1085 _aged ++{_edcd ,_ffdc :=GetInt (_eecgf .Get (_aged ));if !_ffdc {return nil ,_a .New ("i\u006e\u0076\u0061\u006cid\u0020w\u0020\u006f\u0062\u006a\u0065c\u0074\u0020\u0074\u0079\u0070\u0065");};_adfc =append (_adfc ,int64 (*_edcd ));};_feeac ,_gafg :=DecodeStream (_fdae ); 1086 if _gafg !=nil {_df .Log .Debug ("\u0045\u0052\u0052OR\u003a\u0020\u0055\u006e\u0061\u0062\u006c\u0065\u0020t\u006f \u0064e\u0063o\u0064\u0065\u0020\u0073\u0074\u0072\u0065\u0061\u006d\u003a\u0020\u0025\u0076",_gafg );return nil ,_gafg ;};_eaee :=int (_adfc [0]); 1087 _cddf :=int (_adfc [0]+_adfc [1]);_ccbg :=int (_adfc [0]+_adfc [1]+_adfc [2]);_agggd :=int (_adfc [0]+_adfc [1]+_adfc [2]);if _eaee < 0||_cddf < 0||_ccbg < 0{_df .Log .Debug ("\u0045\u0072\u0072\u006fr\u0020\u0073\u0020\u0076\u0061\u006c\u0075\u0065\u0020\u003c \u0030 \u0028\u0025\u0064\u002c\u0025\u0064\u002c%\u0064\u0029",_eaee ,_cddf ,_ccbg ); 1088 return nil ,_a .New ("\u0072\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b\u0020e\u0072\u0072\u006f\u0072");};if _agggd ==0{_df .Log .Debug ("\u004e\u006f\u0020\u0078\u0072\u0065\u0066\u0020\u006f\u0062\u006a\u0065\u0063t\u0073\u0020\u0069\u006e\u0020\u0073t\u0072\u0065\u0061\u006d\u0020\u0028\u0064\u0065\u006c\u0074\u0061\u0062\u0020=\u003d\u0020\u0030\u0029"); 1089 return _caab ,nil ;};_ddad :=len (_feeac )/_agggd ;_cgeb :=0;_dcgc :=_fdae .PdfObjectDictionary .Get ("\u0049\u006e\u0064e\u0078");var _gdca []int ;if _dcgc !=nil {_df .Log .Trace ("\u0049n\u0064\u0065\u0078\u003a\u0020\u0025b",_dcgc );_feaf ,_gagd :=_dcgc .(*PdfObjectArray ); 1090 if !_gagd {_df .Log .Debug ("\u0049\u006e\u0076\u0061\u006ci\u0064\u0020\u0049\u006e\u0064\u0065\u0078\u0020\u006f\u0062\u006a\u0065\u0063t\u0020\u0028\u0073\u0068\u006f\u0075\u006c\u0064\u0020\u0062\u0065\u0020\u0061\u006e\u0020\u0061\u0072\u0072\u0061\u0079\u0029"); 1091 return nil ,_a .New ("i\u006ev\u0061\u006c\u0069\u0064\u0020\u0049\u006e\u0064e\u0078\u0020\u006f\u0062je\u0063\u0074");};if _feaf .Len ()%2!=0{_df .Log .Debug ("\u0057\u0041\u0052\u004eI\u004e\u0047\u0020\u0046\u0061\u0069\u006c\u0075\u0072e\u0020\u006c\u006f\u0061\u0064\u0069\u006e\u0067\u0020\u0078\u0072\u0065\u0066\u0020\u0073\u0074\u006d\u0020i\u006e\u0064\u0065\u0078\u0020n\u006f\u0074\u0020\u006d\u0075\u006c\u0074\u0069\u0070\u006c\u0065\u0020\u006f\u0066\u0020\u0032\u002e"); 1092 return nil ,_a .New ("\u0072\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b\u0020e\u0072\u0072\u006f\u0072");};_cgeb =0;_fcdc ,_egde :=_feaf .ToIntegerArray ();if _egde !=nil {_df .Log .Debug ("\u0045\u0072\u0072\u006f\u0072 \u0067\u0065\u0074\u0074\u0069\u006e\u0067\u0020\u0069\u006e\u0064\u0065\u0078 \u0061\u0072\u0072\u0061\u0079\u0020\u0061\u0073\u0020\u0069\u006e\u0074\u0065\u0067\u0065\u0072\u0073\u003a\u0020\u0025\u0076",_egde ); 1093 return nil ,_egde ;};for _gaef :=0;_gaef < len (_fcdc );_gaef +=2{_aagbf :=_fcdc [_gaef ];_efeb :=_fcdc [_gaef +1];for _dgee :=0;_dgee < _efeb ;_dgee ++{_gdca =append (_gdca ,_aagbf +_dgee );};_cgeb +=_efeb ;};}else {for _dcefd :=0;_dcefd < int (*_fcbf ); 1094 _dcefd ++{_gdca =append (_gdca ,_dcefd );};_cgeb =int (*_fcbf );};if _ddad ==_cgeb +1{_df .Log .Debug ("\u0049n\u0063\u006f\u006d\u0070ati\u0062\u0069\u006c\u0069t\u0079\u003a\u0020\u0049\u006e\u0064\u0065\u0078\u0020\u006di\u0073\u0073\u0069\u006e\u0067\u0020\u0063\u006f\u0076\u0065\u0072\u0061\u0067\u0065\u0020\u006f\u0066\u0020\u0031\u0020\u006f\u0062\u006ae\u0063\u0074\u0020\u002d\u0020\u0061\u0070\u0070en\u0064\u0069\u006eg\u0020\u006f\u006e\u0065\u0020-\u0020M\u0061\u0079\u0020\u006c\u0065\u0061\u0064\u0020\u0074o\u0020\u0070\u0072\u006f\u0062\u006c\u0065\u006d\u0073"); 1095 _fdgg :=_cgeb -1;for _ ,_ccdec :=range _gdca {if _ccdec > _fdgg {_fdgg =_ccdec ;};};_gdca =append (_gdca ,_fdgg +1);_cgeb ++;};if _ddad !=len (_gdca ){_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020x\u0072\u0065\u0066 \u0073\u0074\u006d:\u0020\u006eu\u006d\u0020\u0065\u006e\u0074\u0072i\u0065s \u0021\u003d\u0020\u006c\u0065\u006e\u0028\u0069\u006e\u0064\u0069\u0063\u0065\u0073\u0029\u0020\u0028\u0025\u0064\u0020\u0021\u003d\u0020\u0025\u0064\u0029",_ddad ,len (_gdca )); 1096 return nil ,_a .New ("\u0078\u0072ef\u0020\u0073\u0074m\u0020\u006e\u0075\u006d en\u0074ri\u0065\u0073\u0020\u0021\u003d\u0020\u006cen\u0028\u0069\u006e\u0064\u0069\u0063\u0065s\u0029");};_df .Log .Trace ("\u004f\u0062j\u0065\u0063\u0074s\u0020\u0063\u006f\u0075\u006e\u0074\u0020\u0025\u0064",_cgeb ); 1097 _df .Log .Trace ("\u0049\u006e\u0064i\u0063\u0065\u0073\u003a\u0020\u0025\u0020\u0064",_gdca );_gcbf :=func (_dbgec []byte )int64 {var _dccc int64 ;for _dfcd :=0;_dfcd < len (_dbgec );_dfcd ++{_dccc +=int64 (_dbgec [_dfcd ])*(1<<uint (8*(len (_dbgec )-_dfcd -1))); 1098 };return _dccc ;};_df .Log .Trace ("\u0044e\u0063\u006f\u0064\u0065d\u0020\u0073\u0074\u0072\u0065a\u006d \u006ce\u006e\u0067\u0074\u0068\u003a\u0020\u0025d",len (_feeac ));_babc :=0;for _gegg :=0;_gegg < len (_feeac );_gegg +=_agggd {_ffcef :=_ccdddf (len (_feeac ),_gegg ,_gegg +_eaee ); 1099 if _ffcef !=nil {_df .Log .Debug ("\u0049\u006e\u0076al\u0069\u0064\u0020\u0073\u006c\u0069\u0063\u0065\u0020\u0072\u0061\u006e\u0067\u0065\u003a\u0020\u0025\u0076",_ffcef );return nil ,_ffcef ;};_efcf :=_feeac [_gegg :_gegg +_eaee ];_ffcef =_ccdddf (len (_feeac ),_gegg +_eaee ,_gegg +_cddf ); 1100 if _ffcef !=nil {_df .Log .Debug ("\u0049\u006e\u0076al\u0069\u0064\u0020\u0073\u006c\u0069\u0063\u0065\u0020\u0072\u0061\u006e\u0067\u0065\u003a\u0020\u0025\u0076",_ffcef );return nil ,_ffcef ;};_egdc :=_feeac [_gegg +_eaee :_gegg +_cddf ];_ffcef =_ccdddf (len (_feeac ),_gegg +_cddf ,_gegg +_ccbg ); 1101 if _ffcef !=nil {_df .Log .Debug ("\u0049\u006e\u0076al\u0069\u0064\u0020\u0073\u006c\u0069\u0063\u0065\u0020\u0072\u0061\u006e\u0067\u0065\u003a\u0020\u0025\u0076",_ffcef );return nil ,_ffcef ;};_bbda :=_feeac [_gegg +_cddf :_gegg +_ccbg ];_bdbb :=_gcbf (_efcf ); 1102 _cgfg :=_gcbf (_egdc );_agbe :=_gcbf (_bbda );if _adfc [0]==0{_bdbb =1;};if _babc >=len (_gdca ){_df .Log .Debug ("X\u0052\u0065\u0066\u0020\u0073\u0074\u0072\u0065\u0061\u006d\u0020\u002d\u0020\u0054\u0072\u0079\u0069\u006e\u0067\u0020\u0074\u006f\u0020\u0061\u0063\u0063e\u0073s\u0020\u0069\u006e\u0064e\u0078\u0020o\u0075\u0074\u0020\u006f\u0066\u0020\u0062\u006f\u0075\u006e\u0064\u0073\u0020\u002d\u0020\u0062\u0072\u0065\u0061\u006b\u0069\u006e\u0067"); 1103 break ;};_feafc :=_gdca [_babc ];_babc ++;_df .Log .Trace ("%\u0064\u002e\u0020\u0070\u0031\u003a\u0020\u0025\u0020\u0078",_feafc ,_efcf );_df .Log .Trace ("%\u0064\u002e\u0020\u0070\u0032\u003a\u0020\u0025\u0020\u0078",_feafc ,_egdc );_df .Log .Trace ("%\u0064\u002e\u0020\u0070\u0033\u003a\u0020\u0025\u0020\u0078",_feafc ,_bbda ); 1104 _df .Log .Trace ("\u0025d\u002e \u0078\u0072\u0065\u0066\u003a \u0025\u0064 \u0025\u0064\u0020\u0025\u0064",_feafc ,_bdbb ,_cgfg ,_agbe );if _bdbb ==0{_df .Log .Trace ("-\u0020\u0046\u0072\u0065\u0065\u0020o\u0062\u006a\u0065\u0063\u0074\u0020-\u0020\u0063\u0061\u006e\u0020\u0070\u0072o\u0062\u0061\u0062\u006c\u0079\u0020\u0069\u0067\u006e\u006fr\u0065"); 1105 }else if _bdbb ==1{_df .Log .Trace ("\u002d\u0020I\u006e\u0020\u0075\u0073e\u0020\u002d \u0075\u006e\u0063\u006f\u006d\u0070\u0072\u0065s\u0073\u0065\u0064\u0020\u0076\u0069\u0061\u0020\u006f\u0066\u0066\u0073e\u0074\u0020\u0025\u0062",_egdc );if _cgfg ==_agccg {_df .Log .Debug ("\u0055\u0070d\u0061\u0074\u0069\u006e\u0067\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u0020\u006e\u0075\u006d\u0062\u0065\u0072\u0020\u0066\u006f\u0072\u0020\u0058\u0052\u0065\u0066\u0020\u0074\u0061\u0062\u006c\u0065\u0020\u0025\u0064\u0020\u002d\u003e\u0020\u0025\u0064",_feafc ,_fdae .ObjectNumber ); 1106 _feafc =int (_fdae .ObjectNumber );};if _fceg ,_eeggc :=_aabb ._ggaf .ObjectMap [_feafc ];!_eeggc ||int (_agbe )> _fceg .Generation {_daae :=XrefObject {ObjectNumber :_feafc ,XType :XrefTypeTableEntry ,Offset :_cgfg ,Generation :int (_agbe )};_aabb ._ggaf .ObjectMap [_feafc ]=_daae ; 1107 };}else if _bdbb ==2{_df .Log .Trace ("\u002d\u0020\u0049\u006e \u0075\u0073\u0065\u0020\u002d\u0020\u0063\u006f\u006d\u0070r\u0065s\u0073\u0065\u0064\u0020\u006f\u0062\u006ae\u0063\u0074");if _ ,_daggg :=_aabb ._ggaf .ObjectMap [_feafc ];!_daggg {_afa :=XrefObject {ObjectNumber :_feafc ,XType :XrefTypeObjectStream ,OsObjNumber :int (_cgfg ),OsObjIndex :int (_agbe )}; 1108 _aabb ._ggaf .ObjectMap [_feafc ]=_afa ;_df .Log .Trace ("\u0065\u006e\u0074\u0072\u0079\u003a\u0020\u0025\u002b\u0076",_afa );};}else {_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052:\u0020\u002d\u002d\u002d\u002d\u002d\u002d\u002d\u002d\u0049\u004e\u0056\u0041L\u0049\u0044\u0020\u0054\u0059\u0050\u0045\u0020\u0058\u0072\u0065\u0066\u0053\u0074\u006d\u0020\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u003f\u002d\u002d\u002d\u002d\u002d\u002d-"); 1109 continue ;};};if _aabb ._dfbg ==nil {_ecagf :=XrefTypeObjectStream ;_aabb ._dfbg =&_ecagf ;};return _caab ,nil ;};func (_bgaff *PdfObjectInteger )String ()string {return _ea .Sprintf ("\u0025\u0064",*_bgaff )}; 1110 1111 // UpdateParams updates the parameter values of the encoder. 1112 // Implements StreamEncoder interface. 1113 func (_eccc *JBIG2Encoder )UpdateParams (params *PdfObjectDictionary ){_ccefc ,_aagf :=GetNumberAsInt64 (params .Get ("\u0042\u0069t\u0073\u0050\u0065r\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074"));if _aagf ==nil {_eccc .BitsPerComponent =int (_ccefc ); 1114 };_aefg ,_aagf :=GetNumberAsInt64 (params .Get ("\u0057\u0069\u0064t\u0068"));if _aagf ==nil {_eccc .Width =int (_aefg );};_acec ,_aagf :=GetNumberAsInt64 (params .Get ("\u0048\u0065\u0069\u0067\u0068\u0074"));if _aagf ==nil {_eccc .Height =int (_acec ); 1115 };_eeac ,_aagf :=GetNumberAsInt64 (params .Get ("\u0043o\u006co\u0072\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074\u0073"));if _aagf ==nil {_eccc .ColorComponents =int (_eeac );};}; 1116 1117 // PdfObjectDictionary represents the primitive PDF dictionary/map object. 1118 type PdfObjectDictionary struct{_ccfa map[PdfObjectName ]PdfObject ;_aggf []PdfObjectName ;_gfff *_c .Mutex ;_fdad *PdfParser ;}; 1119 1120 // GetTrailer returns the PDFs trailer dictionary. The trailer dictionary is typically the starting point for a PDF, 1121 // referencing other key objects that are important in the document structure. 1122 func (_gebe *PdfParser )GetTrailer ()*PdfObjectDictionary {return _gebe ._aagb }; 1123 1124 // MakeNull creates an PdfObjectNull. 1125 func MakeNull ()*PdfObjectNull {_daef :=PdfObjectNull {};return &_daef }; 1126 1127 // MultiEncoder supports serial encoding. 1128 type MultiEncoder struct{_gbgba []StreamEncoder }; 1129 1130 // Bytes returns the PdfObjectString content as a []byte array. 1131 func (_gbcbg *PdfObjectString )Bytes ()[]byte {return []byte (_gbcbg ._bcfef )};func (_dea *PdfParser )checkPostEOFData ()error {const _dgfd ="\u0025\u0025\u0045O\u0046";_ ,_geb :=_dea ._abdga .Seek (-int64 (len ([]byte (_dgfd )))-1,_gd .SeekEnd );if _geb !=nil {return _geb ; 1132 };_ccg :=make ([]byte ,len ([]byte (_dgfd ))+1);_ ,_geb =_dea ._abdga .Read (_ccg );if _geb !=nil {if _geb !=_gd .EOF {return _geb ;};};if string (_ccg )==_dgfd ||string (_ccg )==_dgfd +"\u000a"{_dea ._ffge ._dacf =true ;};return nil ;}; 1133 1134 // TraceToDirectObject traces a PdfObject to a direct object. For example direct objects contained 1135 // in indirect objects (can be double referenced even). 1136 func TraceToDirectObject (obj PdfObject )PdfObject {if _daba ,_faag :=obj .(*PdfObjectReference );_faag {obj =_daba .Resolve ();};_fagae ,_eeff :=obj .(*PdfIndirectObject );_edddd :=0;for _eeff {obj =_fagae .PdfObject ;_fagae ,_eeff =GetIndirect (obj ); 1137 _edddd ++;if _edddd > _abedf {_df .Log .Error ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0054\u0072\u0061\u0063\u0065\u0020\u0064\u0065p\u0074\u0068\u0020\u006c\u0065\u0076\u0065\u006c\u0020\u0062\u0065\u0079\u006fn\u0064\u0020\u0025\u0064\u0020\u002d\u0020\u006e\u006f\u0074\u0020\u0067oi\u006e\u0067\u0020\u0064\u0065\u0065\u0070\u0065\u0072\u0021",_abedf ); 1138 return nil ;};};return obj ;}; 1139 1140 // WriteString outputs the object as it is to be written to file. 1141 func (_bcca *PdfObjectStreams )WriteString ()string {var _gddb _cb .Builder ;_gddb .WriteString (_be .FormatInt (_bcca .ObjectNumber ,10));_gddb .WriteString ("\u0020\u0030\u0020\u0052");return _gddb .String ();}; 1142 1143 // GetBool returns the *PdfObjectBool object that is represented by a PdfObject directly or indirectly 1144 // within an indirect object. The bool flag indicates whether a match was found. 1145 func GetBool (obj PdfObject )(_fgeec *PdfObjectBool ,_ffega bool ){_fgeec ,_ffega =TraceToDirectObject (obj ).(*PdfObjectBool );return _fgeec ,_ffega ;};func (_fbaa *PdfParser )parseObject ()(PdfObject ,error ){_df .Log .Trace ("\u0052e\u0061d\u0020\u0064\u0069\u0072\u0065c\u0074\u0020o\u0062\u006a\u0065\u0063\u0074"); 1146 _fbaa .skipSpaces ();for {_fedd ,_ddbb :=_fbaa ._gcec .Peek (2);if _ddbb !=nil {if _ddbb !=_gd .EOF ||len (_fedd )==0{return nil ,_ddbb ;};if len (_fedd )==1{_fedd =append (_fedd ,' ');};};_df .Log .Trace ("\u0050e\u0065k\u0020\u0073\u0074\u0072\u0069\u006e\u0067\u003a\u0020\u0025\u0073",string (_fedd )); 1147 if _fedd [0]=='/'{_ffcb ,_cadb :=_fbaa .parseName ();_df .Log .Trace ("\u002d\u003e\u004ea\u006d\u0065\u003a\u0020\u0027\u0025\u0073\u0027",_ffcb );return &_ffcb ,_cadb ;}else if _fedd [0]=='('{_df .Log .Trace ("\u002d>\u0053\u0074\u0072\u0069\u006e\u0067!"); 1148 _ebbf ,_gdda :=_fbaa .parseString ();return _ebbf ,_gdda ;}else if _fedd [0]=='['{_df .Log .Trace ("\u002d\u003e\u0041\u0072\u0072\u0061\u0079\u0021");_bdcf ,_aeedb :=_fbaa .parseArray ();return _bdcf ,_aeedb ;}else if (_fedd [0]=='<')&&(_fedd [1]=='<'){_df .Log .Trace ("\u002d>\u0044\u0069\u0063\u0074\u0021"); 1149 _fcgee ,_affa :=_fbaa .ParseDict ();return _fcgee ,_affa ;}else if _fedd [0]=='<'{_df .Log .Trace ("\u002d\u003e\u0048\u0065\u0078\u0020\u0073\u0074\u0072\u0069\u006e\u0067\u0021");_abgaf ,_eccdd :=_fbaa .parseHexString ();return _abgaf ,_eccdd ;}else if _fedd [0]=='%'{_fbaa .readComment (); 1150 _fbaa .skipSpaces ();}else {_df .Log .Trace ("\u002d\u003eN\u0075\u006d\u0062e\u0072\u0020\u006f\u0072\u0020\u0072\u0065\u0066\u003f");_fedd ,_ =_fbaa ._gcec .Peek (15);_cddbd :=string (_fedd );_df .Log .Trace ("\u0050\u0065\u0065k\u0020\u0073\u0074\u0072\u003a\u0020\u0025\u0073",_cddbd ); 1151 if (len (_cddbd )> 3)&&(_cddbd [:4]=="\u006e\u0075\u006c\u006c"){_bcda ,_ggcgb :=_fbaa .parseNull ();return &_bcda ,_ggcgb ;}else if (len (_cddbd )> 4)&&(_cddbd [:5]=="\u0066\u0061\u006cs\u0065"){_fdcff ,_gfgd :=_fbaa .parseBool ();return &_fdcff ,_gfgd ; 1152 }else if (len (_cddbd )> 3)&&(_cddbd [:4]=="\u0074\u0072\u0075\u0065"){_gadg ,_dcgg :=_fbaa .parseBool ();return &_gadg ,_dcgg ;};_bdga :=_dbgee .FindStringSubmatch (_cddbd );if len (_bdga )> 1{_fedd ,_ =_fbaa ._gcec .ReadBytes ('R');_df .Log .Trace ("\u002d\u003e\u0020\u0021\u0052\u0065\u0066\u003a\u0020\u0027\u0025\u0073\u0027",string (_fedd [:])); 1153 _egdd ,_baaa :=_gfabf (string (_fedd ));_egdd ._egcg =_fbaa ;return &_egdd ,_baaa ;};_cabdb :=_cadf .FindStringSubmatch (_cddbd );if len (_cabdb )> 1{_df .Log .Trace ("\u002d\u003e\u0020\u004e\u0075\u006d\u0062\u0065\u0072\u0021");_gfbbe ,_fdcc :=_fbaa .parseNumber (); 1154 return _gfbbe ,_fdcc ;};_cabdb =_dfff .FindStringSubmatch (_cddbd );if len (_cabdb )> 1{_df .Log .Trace ("\u002d\u003e\u0020\u0045xp\u006f\u006e\u0065\u006e\u0074\u0069\u0061\u006c\u0020\u004e\u0075\u006d\u0062\u0065r\u0021");_df .Log .Trace ("\u0025\u0020\u0073",_cabdb ); 1155 _ebc ,_fcgd :=_fbaa .parseNumber ();return _ebc ,_fcgd ;};_df .Log .Debug ("\u0045R\u0052\u004f\u0052\u0020U\u006e\u006b\u006e\u006f\u0077n\u0020(\u0070e\u0065\u006b\u0020\u0022\u0025\u0073\u0022)",_cddbd );return nil ,_a .New ("\u006f\u0062\u006a\u0065\u0063t\u0020\u0070\u0061\u0072\u0073\u0069\u006e\u0067\u0020\u0065\u0072\u0072\u006fr\u0020\u002d\u0020\u0075\u006e\u0065\u0078\u0070\u0065\u0063\u0074\u0065\u0064\u0020\u0070\u0061\u0074\u0074\u0065\u0072\u006e"); 1156 };};}; 1157 1158 // GoImageToJBIG2 creates a binary image on the base of 'i' golang image.Image. 1159 // If the image is not a black/white image then the function converts provided input into 1160 // JBIG2Image with 1bpp. For non grayscale images the function performs the conversion to the grayscale temp image. 1161 // Then it checks the value of the gray image value if it's within bounds of the black white threshold. 1162 // This 'bwThreshold' value should be in range (0.0, 1.0). The threshold checks if the grayscale pixel (uint) value 1163 // is greater or smaller than 'bwThreshold' * 255. Pixels inside the range will be white, and the others will be black. 1164 // If the 'bwThreshold' is equal to -1.0 - JB2ImageAutoThreshold then it's value would be set on the base of 1165 // it's histogram using Triangle method. For more information go to: 1166 // https://www.mathworks.com/matlabcentral/fileexchange/28047-gray-image-thresholding-using-the-triangle-method 1167 func GoImageToJBIG2 (i _ff .Image ,bwThreshold float64 )(*JBIG2Image ,error ){const _gcfb ="\u0047\u006f\u0049\u006d\u0061\u0067\u0065\u0054\u006fJ\u0042\u0049\u0047\u0032";if i ==nil {return nil ,_dd .Error (_gcfb ,"i\u006d\u0061\u0067\u0065 '\u0069'\u0020\u006e\u006f\u0074\u0020d\u0065\u0066\u0069\u006e\u0065\u0064"); 1168 };var (_aeec uint8 ;_bgaf _cf .Image ;_gbag error ;);if bwThreshold ==JB2ImageAutoThreshold {_bgaf ,_gbag =_cf .MonochromeConverter .Convert (i );}else if bwThreshold > 1.0||bwThreshold < 0.0{return nil ,_dd .Error (_gcfb ,"p\u0072\u006f\u0076\u0069\u0064\u0065\u0064\u0020\u0074h\u0072\u0065\u0073\u0068\u006f\u006c\u0064 i\u0073\u0020\u006e\u006ft\u0020\u0069\u006e\u0020\u0061\u0020\u0072\u0061\u006ege\u0020\u007b0\u002e\u0030\u002c\u0020\u0031\u002e\u0030\u007d"); 1169 }else {_aeec =uint8 (255*bwThreshold );_bgaf ,_gbag =_cf .MonochromeThresholdConverter (_aeec ).Convert (i );};if _gbag !=nil {return nil ,_gbag ;};return _dbfe (_bgaf ),nil ;}; 1170 1171 // EncodeBytes encodes data into ASCII85 encoded format. 1172 func (_acfbe *ASCII85Encoder )EncodeBytes (data []byte )([]byte ,error ){var _fcf _d .Buffer ;for _facg :=0;_facg < len (data );_facg +=4{_ggdg :=data [_facg ];_cffcc :=1;_dgb :=byte (0);if _facg +1< len (data ){_dgb =data [_facg +1];_cffcc ++;};_adc :=byte (0); 1173 if _facg +2< len (data ){_adc =data [_facg +2];_cffcc ++;};_fgbe :=byte (0);if _facg +3< len (data ){_fgbe =data [_facg +3];_cffcc ++;};_cea :=(uint32 (_ggdg )<<24)|(uint32 (_dgb )<<16)|(uint32 (_adc )<<8)|uint32 (_fgbe );if _cea ==0{_fcf .WriteByte ('z'); 1174 }else {_agag :=_acfbe .base256Tobase85 (_cea );for _ ,_efgfd :=range _agag [:_cffcc +1]{_fcf .WriteByte (_efgfd +'!');};};};_fcf .WriteString ("\u007e\u003e");return _fcf .Bytes (),nil ;};func (_aafd *offsetReader )Read (p []byte )(_adag int ,_edf error ){return _aafd ._eacg .Read (p )}; 1175 1176 1177 // UpdateParams updates the parameter values of the encoder. 1178 func (_ggecb *LZWEncoder )UpdateParams (params *PdfObjectDictionary ){_baa ,_def :=GetNumberAsInt64 (params .Get ("\u0050r\u0065\u0064\u0069\u0063\u0074\u006fr"));if _def ==nil {_ggecb .Predictor =int (_baa );};_deff ,_def :=GetNumberAsInt64 (params .Get ("\u0042\u0069t\u0073\u0050\u0065r\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074")); 1179 if _def ==nil {_ggecb .BitsPerComponent =int (_deff );};_eced ,_def :=GetNumberAsInt64 (params .Get ("\u0057\u0069\u0064t\u0068"));if _def ==nil {_ggecb .Columns =int (_eced );};_abea ,_def :=GetNumberAsInt64 (params .Get ("\u0043o\u006co\u0072\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074\u0073")); 1180 if _def ==nil {_ggecb .Colors =int (_abea );};_gaf ,_def :=GetNumberAsInt64 (params .Get ("E\u0061\u0072\u006c\u0079\u0043\u0068\u0061\u006e\u0067\u0065"));if _def ==nil {_ggecb .EarlyChange =int (_gaf );};}; 1181 1182 // GetStringVal returns the string value represented by the PdfObject directly or indirectly if 1183 // contained within an indirect object. On type mismatch the found bool flag returned is false and 1184 // an empty string is returned. 1185 func GetStringVal (obj PdfObject )(_efgc string ,_fdcd bool ){_bdde ,_fdcd :=TraceToDirectObject (obj ).(*PdfObjectString );if _fdcd {return _bdde .Str (),true ;};return ;}; 1186 1187 // DecodeStream decodes RunLengthEncoded stream object and give back decoded bytes. 1188 func (_gdee *RunLengthEncoder )DecodeStream (streamObj *PdfObjectStream )([]byte ,error ){return _gdee .DecodeBytes (streamObj .Stream );}; 1189 1190 // HasOddLengthHexStrings checks if the document has odd length hexadecimal strings. 1191 func (_gfe ParserMetadata )HasOddLengthHexStrings ()bool {return _gfe ._faae }; 1192 1193 // JBIG2Encoder implements both jbig2 encoder and the decoder. The encoder allows to encode 1194 // provided images (best used document scans) in multiple way. By default it uses single page generic 1195 // encoder. It allows to store lossless data as a single segment. 1196 // In order to store multiple image pages use the 'FileMode' which allows to store more pages within single jbig2 document. 1197 // WIP: In order to obtain better compression results the encoder would allow to encode the input in a 1198 // lossy or lossless way with a component (symbol) mode. It divides the image into components. 1199 // Then checks if any component is 'similar' to the others and maps them together. The symbol classes are stored 1200 // in the dictionary. Then the encoder creates text regions which uses the related symbol classes to fill it's space. 1201 // The similarity is defined by the 'Threshold' variable (default: 0.95). The less the value is, the more components 1202 // matches to single class, thus the compression is better, but the result might become lossy. 1203 type JBIG2Encoder struct{ 1204 1205 // These values are required to be set for the 'EncodeBytes' method. 1206 // ColorComponents defines the number of color components for provided image. 1207 ColorComponents int ; 1208 1209 // BitsPerComponent is the number of bits that stores per color component 1210 BitsPerComponent int ; 1211 1212 // Width is the width of the image to encode 1213 Width int ; 1214 1215 // Height is the height of the image to encode. 1216 Height int ;_efaa *_ecdf .Document ; 1217 1218 // Globals are the JBIG2 global segments. 1219 Globals _db .Globals ; 1220 1221 // IsChocolateData defines if the data is encoded such that 1222 // binary data '1' means black and '0' white. 1223 // otherwise the data is called vanilla. 1224 // Naming convention taken from: 'https://en.wikipedia.org/wiki/Binary_image#Interpretation' 1225 IsChocolateData bool ; 1226 1227 // DefaultPageSettings are the settings parameters used by the jbig2 encoder. 1228 DefaultPageSettings JBIG2EncoderSettings ;}; 1229 1230 // ASCII85Encoder implements ASCII85 encoder/decoder. 1231 type ASCII85Encoder struct{};var (ErrUnsupportedEncodingParameters =_a .New ("\u0075\u006e\u0073u\u0070\u0070\u006f\u0072t\u0065\u0064\u0020\u0065\u006e\u0063\u006fd\u0069\u006e\u0067\u0020\u0070\u0061\u0072\u0061\u006d\u0065\u0074\u0065\u0072\u0073"); 1232 ErrNoCCITTFaxDecode =_a .New ("\u0043\u0043I\u0054\u0054\u0046\u0061\u0078\u0044\u0065\u0063\u006f\u0064\u0065\u0020\u0065\u006e\u0063\u006f\u0064\u0069\u006e\u0067\u0020\u0069\u0073\u0020\u006e\u006f\u0074\u0020\u0079\u0065\u0074\u0020\u0069\u006d\u0070\u006c\u0065\u006d\u0065\u006e\u0074\u0065\u0064"); 1233 ErrNoJBIG2Decode =_a .New ("\u004a\u0042\u0049\u0047\u0032\u0044\u0065c\u006f\u0064\u0065 \u0065\u006e\u0063\u006fd\u0069\u006e\u0067\u0020\u0069\u0073\u0020\u006e\u006f\u0074\u0020\u0079\u0065\u0074\u0020\u0069\u006d\u0070\u006c\u0065\u006d\u0065\u006e\u0074\u0065\u0064"); 1234 ErrNoJPXDecode =_a .New ("\u004a\u0050\u0058\u0044\u0065c\u006f\u0064\u0065\u0020\u0065\u006e\u0063\u006f\u0064\u0069\u006e\u0067\u0020i\u0073\u0020\u006e\u006f\u0074\u0020\u0079\u0065\u0074\u0020\u0069\u006d\u0070\u006c\u0065\u006d\u0065\u006e\u0074\u0065\u0064"); 1235 ErrNoPdfVersion =_a .New ("\u0076\u0065\u0072\u0073\u0069\u006f\u006e\u0020\u006e\u006f\u0074\u0020f\u006f\u0075\u006e\u0064");ErrTypeError =_a .New ("\u0074\u0079p\u0065\u0020\u0063h\u0065\u0063\u006b\u0020\u0065\u0072\u0072\u006f\u0072");ErrRangeError =_a .New ("\u0072\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b\u0020e\u0072\u0072\u006f\u0072"); 1236 ErrNotSupported =_aa .New ("\u0066\u0065\u0061t\u0075\u0072\u0065\u0020n\u006f\u0074\u0020\u0063\u0075\u0072\u0072e\u006e\u0074\u006c\u0079\u0020\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064");ErrNotANumber =_a .New ("\u006e\u006f\u0074 \u0061\u0020\u006e\u0075\u006d\u0062\u0065\u0072"); 1237 ); 1238 1239 // PdfObjectBool represents the primitive PDF boolean object. 1240 type PdfObjectBool bool ;func (_acgf *PdfParser )parseName ()(PdfObjectName ,error ){var _dedc _d .Buffer ;_gcgg :=false ;for {_bbgb ,_cabfb :=_acgf ._gcec .Peek (1);if _cabfb ==_gd .EOF {break ;};if _cabfb !=nil {return PdfObjectName (_dedc .String ()),_cabfb ; 1241 };if !_gcgg {if _bbgb [0]=='/'{_gcgg =true ;_acgf ._gcec .ReadByte ();}else if _bbgb [0]=='%'{_acgf .readComment ();_acgf .skipSpaces ();}else {_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u0020N\u0061\u006d\u0065\u0020\u0073\u0074\u0061\u0072\u0074\u0069\u006e\u0067\u0020w\u0069\u0074\u0068\u0020\u0025\u0073\u0020(\u0025\u0020\u0078\u0029",_bbgb ,_bbgb ); 1242 return PdfObjectName (_dedc .String ()),_ea .Errorf ("\u0069n\u0076a\u006c\u0069\u0064\u0020\u006ea\u006d\u0065:\u0020\u0028\u0025\u0063\u0029",_bbgb [0]);};}else {if IsWhiteSpace (_bbgb [0]){break ;}else if (_bbgb [0]=='/')||(_bbgb [0]=='[')||(_bbgb [0]=='(')||(_bbgb [0]==']')||(_bbgb [0]=='<')||(_bbgb [0]=='>'){break ; 1243 }else if _bbgb [0]=='#'{_baad ,_fcda :=_acgf ._gcec .Peek (3);if _fcda !=nil {return PdfObjectName (_dedc .String ()),_fcda ;};_fbbbf ,_fcda :=_ac .DecodeString (string (_baad [1:3]));if _fcda !=nil {_df .Log .Debug ("\u0045\u0052\u0052\u004fR\u003a\u0020\u0049\u006ev\u0061\u006c\u0069d\u0020\u0068\u0065\u0078\u0020\u0066o\u006c\u006co\u0077\u0069\u006e\u0067 \u0027\u0023\u0027\u002c \u0063\u006f\u006e\u0074\u0069n\u0075\u0069\u006e\u0067\u0020\u0075\u0073i\u006e\u0067\u0020\u006c\u0069t\u0065\u0072\u0061\u006c\u0020\u002d\u0020\u004f\u0075t\u0070\u0075\u0074\u0020\u006d\u0061\u0079\u0020\u0062\u0065\u0020\u0069\u006e\u0063\u006f\u0072\u0072\u0065\u0063\u0074"); 1244 _dedc .WriteByte ('#');_acgf ._gcec .Discard (1);continue ;};_acgf ._gcec .Discard (3);_dedc .Write (_fbbbf );}else {_bacc ,_ :=_acgf ._gcec .ReadByte ();_dedc .WriteByte (_bacc );};};};return PdfObjectName (_dedc .String ()),nil ;};func (_geafg *PdfParser )repairLocateXref ()(int64 ,error ){_gabe :=int64 (1000); 1245 _geafg ._abdga .Seek (-_gabe ,_gd .SeekCurrent );_gegf ,_efdc :=_geafg ._abdga .Seek (0,_gd .SeekCurrent );if _efdc !=nil {return 0,_efdc ;};_feac :=make ([]byte ,_gabe );_geafg ._abdga .Read (_feac );_aggc :=_gedee .FindAllStringIndex (string (_feac ),-1); 1246 if len (_aggc )< 1{_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0052\u0065\u0070a\u0069\u0072\u003a\u0020\u0078\u0072\u0065f\u0020\u006e\u006f\u0074\u0020\u0066\u006f\u0075\u006e\u0064\u0021");return 0,_a .New ("\u0072\u0065\u0070\u0061ir\u003a\u0020\u0078\u0072\u0065\u0066\u0020\u006e\u006f\u0074\u0020\u0066\u006f\u0075n\u0064"); 1247 };_efbef :=int64 (_aggc [len (_aggc )-1][0]);_ggefa :=_gegf +_efbef ;return _ggefa ,nil ;}; 1248 1249 // GetFilterName returns the name of the encoding filter. 1250 func (_gfac *RunLengthEncoder )GetFilterName ()string {return StreamEncodingFilterNameRunLength }; 1251 1252 // GetFilterName returns the name of the encoding filter. 1253 func (_cbab *FlateEncoder )GetFilterName ()string {return StreamEncodingFilterNameFlate }; 1254 1255 // HasEOLAfterHeader gets information if there is a EOL after the version header. 1256 func (_eba ParserMetadata )HasEOLAfterHeader ()bool {return _eba ._eddgg };var _gagg =_f .MustCompile ("\u0073t\u0061r\u0074\u0078\u003f\u0072\u0065f\u005c\u0073*\u0028\u005c\u0064\u002b\u0029"); 1257 1258 // MakeDictMap creates a PdfObjectDictionary initialized from a map of keys to values. 1259 func MakeDictMap (objmap map[string ]PdfObject )*PdfObjectDictionary {_febg :=MakeDict ();return _febg .Update (objmap );}; 1260 1261 // MakeStreamDict makes a new instance of an encoding dictionary for a stream object. 1262 func (_cfge *CCITTFaxEncoder )MakeStreamDict ()*PdfObjectDictionary {_cfbb :=MakeDict ();_cfbb .Set ("\u0046\u0069\u006c\u0074\u0065\u0072",MakeName (_cfge .GetFilterName ()));_cfbb .SetIfNotNil ("D\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0072\u006d\u0073",_cfge .MakeDecodeParams ()); 1263 return _cfbb ;}; 1264 1265 // IsWhiteSpace checks if byte represents a white space character. 1266 func IsWhiteSpace (ch byte )bool {if (ch ==0x00)||(ch ==0x09)||(ch ==0x0A)||(ch ==0x0C)||(ch ==0x0D)||(ch ==0x20){return true ;};return false ;}; 1267 1268 // String returns a string describing `stream`. 1269 func (_eeef *PdfObjectStream )String ()string {return _ea .Sprintf ("O\u0062j\u0065\u0063\u0074\u0020\u0073\u0074\u0072\u0065a\u006d\u0020\u0025\u0064: \u0025\u0073",_eeef .ObjectNumber ,_eeef .PdfObjectDictionary );}; 1270 1271 // Len returns the number of elements in the streams. 1272 func (_bdegf *PdfObjectStreams )Len ()int {if _bdegf ==nil {return 0;};return len (_bdegf ._dgbb );};func _gded (_ebbe PdfObject ,_egfbd int )PdfObject {if _egfbd > _abedf {_df .Log .Error ("\u0054\u0072ac\u0065\u0020\u0064e\u0070\u0074\u0068\u0020lev\u0065l \u0062\u0065\u0079\u006f\u006e\u0064\u0020%d\u0020\u002d\u0020\u0065\u0072\u0072\u006fr\u0021",_abedf ); 1273 return MakeNull ();};switch _adbfe :=_ebbe .(type ){case *PdfIndirectObject :_ebbe =_gded ((*_adbfe ).PdfObject ,_egfbd +1);case *PdfObjectArray :for _bfebc ,_gecg :=range (*_adbfe )._cdea {(*_adbfe )._cdea [_bfebc ]=_gded (_gecg ,_egfbd +1);};case *PdfObjectDictionary :for _ffafg ,_fccf :=range (*_adbfe )._ccfa {(*_adbfe )._ccfa [_ffafg ]=_gded (_fccf ,_egfbd +1); 1274 };_g .Slice ((*_adbfe )._aggf ,func (_afegbb ,_cfbfc int )bool {return (*_adbfe )._aggf [_afegbb ]< (*_adbfe )._aggf [_cfbfc ]});};return _ebbe ;};func (_gad *PdfCrypt )saveCryptFilters (_dab *PdfObjectDictionary )error {if _gad ._dgc .V < 4{return _a .New ("\u0063\u0061\u006e\u0020\u006f\u006e\u006c\u0079\u0020\u0062\u0065 \u0075\u0073\u0065\u0064\u0020\u0077\u0069\u0074\u0068\u0020V\u003e\u003d\u0034"); 1275 };_gbg :=MakeDict ();_dab .Set ("\u0043\u0046",_gbg );for _cfb ,_bggg :=range _gad ._bde {if _cfb =="\u0049\u0064\u0065\u006e\u0074\u0069\u0074\u0079"{continue ;};_ccde :=_ceda (_bggg ,"");_gbg .Set (PdfObjectName (_cfb ),_ccde );};_dab .Set ("\u0053\u0074\u0072\u0046",MakeName (_gad ._fbe )); 1276 _dab .Set ("\u0053\u0074\u006d\u0046",MakeName (_gad ._ddfb ));return nil ;}; 1277 1278 // MakeEncodedString creates a PdfObjectString with encoded content, which can be either 1279 // UTF-16BE or PDFDocEncoding depending on whether `utf16BE` is true or false respectively. 1280 func MakeEncodedString (s string ,utf16BE bool )*PdfObjectString {if utf16BE {var _beeeb _d .Buffer ;_beeeb .Write ([]byte {0xFE,0xFF});_beeeb .WriteString (_gf .StringToUTF16 (s ));return &PdfObjectString {_bcfef :_beeeb .String (),_aae :true };};return &PdfObjectString {_bcfef :string (_gf .StringToPDFDocEncoding (s )),_aae :false }; 1281 }; 1282 1283 // Validate validates the page settings for the JBIG2 encoder. 1284 func (_fbgb JBIG2EncoderSettings )Validate ()error {const _geeeg ="\u0076a\u006ci\u0064\u0061\u0074\u0065\u0045\u006e\u0063\u006f\u0064\u0065\u0072";if _fbgb .Threshold < 0||_fbgb .Threshold > 1.0{return _dd .Errorf (_geeeg ,"\u0070\u0072\u006f\u0076\u0069\u0064\u0065\u0064\u0020\u0074\u0068\u0072\u0065\u0073\u0068\u006f\u006c\u0064\u0020\u0076a\u006c\u0075\u0065\u003a\u0020\u0027\u0025\u0076\u0027 \u006d\u0075\u0073\u0074\u0020\u0062\u0065\u0020\u0069\u006e\u0020\u0072\u0061n\u0067\u0065\u0020\u005b\u0030\u002e0\u002c\u0020\u0031.\u0030\u005d",_fbgb .Threshold ); 1285 };if _fbgb .ResolutionX < 0{return _dd .Errorf (_geeeg ,"\u0070\u0072\u006f\u0076\u0069\u0064\u0065\u0064\u0020\u0078\u0020\u0072\u0065\u0073\u006f\u006c\u0075\u0074\u0069\u006fn\u003a\u0020\u0027\u0025\u0064\u0027\u0020\u006d\u0075s\u0074\u0020\u0062\u0065\u0020\u0070\u006f\u0073\u0069\u0074\u0069\u0076\u0065 \u006f\u0072\u0020\u007a\u0065\u0072o\u0020\u0076\u0061l\u0075\u0065",_fbgb .ResolutionX ); 1286 };if _fbgb .ResolutionY < 0{return _dd .Errorf (_geeeg ,"\u0070\u0072\u006f\u0076\u0069\u0064\u0065\u0064\u0020\u0079\u0020\u0072\u0065\u0073\u006f\u006c\u0075\u0074\u0069\u006fn\u003a\u0020\u0027\u0025\u0064\u0027\u0020\u006d\u0075s\u0074\u0020\u0062\u0065\u0020\u0070\u006f\u0073\u0069\u0074\u0069\u0076\u0065 \u006f\u0072\u0020\u007a\u0065\u0072o\u0020\u0076\u0061l\u0075\u0065",_fbgb .ResolutionY ); 1287 };if _fbgb .DefaultPixelValue !=0&&_fbgb .DefaultPixelValue !=1{return _dd .Errorf (_geeeg ,"de\u0066\u0061u\u006c\u0074\u0020\u0070\u0069\u0078\u0065\u006c\u0020v\u0061\u006c\u0075\u0065\u003a\u0020\u0027\u0025\u0064\u0027\u0020\u006d\u0075\u0073\u0074\u0020\u0062\u0065\u0020\u0061\u0020\u0076\u0061\u006c\u0075\u0065\u0020\u0066o\u0072 \u0074\u0068\u0065\u0020\u0062\u0069\u0074\u003a \u007b0\u002c\u0031}",_fbgb .DefaultPixelValue ); 1288 };if _fbgb .Compression !=JB2Generic {return _dd .Errorf (_geeeg ,"\u0070\u0072\u006f\u0076\u0069\u0064\u0065d\u0020\u0063\u006fm\u0070\u0072\u0065\u0073s\u0069\u006f\u006e\u0020\u0069\u0073\u0020\u006e\u006f\u0074\u0020\u0069\u006d\u0070\u006c\u0065\u006d\u0065\u006e\u0074\u0065\u0064\u0020\u0079\u0065\u0074"); 1289 };return nil ;}; 1290 1291 // UpdateParams updates the parameter values of the encoder. 1292 func (_bdcb *ASCII85Encoder )UpdateParams (params *PdfObjectDictionary ){}; 1293 1294 // MakeDict creates and returns an empty PdfObjectDictionary. 1295 func MakeDict ()*PdfObjectDictionary {_abce :=&PdfObjectDictionary {};_abce ._ccfa =map[PdfObjectName ]PdfObject {};_abce ._aggf =[]PdfObjectName {};_abce ._gfff =&_c .Mutex {};return _abce ;}; 1296 1297 // Append appends PdfObject(s) to the array. 1298 func (_cgce *PdfObjectArray )Append (objects ...PdfObject ){if _cgce ==nil {_df .Log .Debug ("\u0057\u0061\u0072\u006e\u0020\u002d\u0020\u0041\u0074\u0074\u0065\u006d\u0070t\u0020\u0074\u006f\u0020\u0061\u0070p\u0065\u006e\u0064\u0020\u0074\u006f\u0020\u0061\u0020\u006e\u0069\u006c\u0020a\u0072\u0072\u0061\u0079"); 1299 return ;};_cgce ._cdea =append (_cgce ._cdea ,objects ...);}; 1300 1301 // MakeName creates a PdfObjectName from a string. 1302 func MakeName (s string )*PdfObjectName {_fbgc :=PdfObjectName (s );return &_fbgc }; 1303 1304 // MakeBool creates a PdfObjectBool from a bool value. 1305 func MakeBool (val bool )*PdfObjectBool {_cfef :=PdfObjectBool (val );return &_cfef }; 1306 1307 // ParseNumber parses a numeric objects from a buffered stream. 1308 // Section 7.3.3. 1309 // Integer or Float. 1310 // 1311 // An integer shall be written as one or more decimal digits optionally 1312 // preceded by a sign. The value shall be interpreted as a signed 1313 // decimal integer and shall be converted to an integer object. 1314 // 1315 // A real value shall be written as one or more decimal digits with an 1316 // optional sign and a leading, trailing, or embedded PERIOD (2Eh) 1317 // (decimal point). The value shall be interpreted as a real number 1318 // and shall be converted to a real object. 1319 // 1320 // Regarding exponential numbers: 7.3.3 Numeric Objects: 1321 // A conforming writer shall not use the PostScript syntax for numbers 1322 // with non-decimal radices (such as 16#FFFE) or in exponential format 1323 // (such as 6.02E23). 1324 // Nonetheless, we sometimes get numbers with exponential format, so 1325 // we will support it in the reader (no confusion with other types, so 1326 // no compromise). 1327 func ParseNumber (buf *_fd .Reader )(PdfObject ,error ){_dbbf :=false ;_fdbfc :=true ;var _egedc _d .Buffer ;for {if _df .Log .IsLogLevel (_df .LogLevelTrace ){_df .Log .Trace ("\u0050\u0061\u0072\u0073in\u0067\u0020\u006e\u0075\u006d\u0062\u0065\u0072\u0020\u0022\u0025\u0073\u0022",_egedc .String ()); 1328 };_acfa ,_beccg :=buf .Peek (1);if _beccg ==_gd .EOF {break ;};if _beccg !=nil {_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u0020\u0025\u0073",_beccg );return nil ,_beccg ;};if _fdbfc &&(_acfa [0]=='-'||_acfa [0]=='+'){_cdbac ,_ :=buf .ReadByte (); 1329 _egedc .WriteByte (_cdbac );_fdbfc =false ;}else if IsDecimalDigit (_acfa [0]){_fggc ,_ :=buf .ReadByte ();_egedc .WriteByte (_fggc );}else if _acfa [0]=='.'{_afgg ,_ :=buf .ReadByte ();_egedc .WriteByte (_afgg );_dbbf =true ;}else if _acfa [0]=='e'||_acfa [0]=='E'{_fgcc ,_ :=buf .ReadByte (); 1330 _egedc .WriteByte (_fgcc );_dbbf =true ;_fdbfc =true ;}else {break ;};};var _bead PdfObject ;if _dbbf {_dgeg ,_aaggf :=_be .ParseFloat (_egedc .String (),64);if _aaggf !=nil {_df .Log .Debug ("\u0045\u0072r\u006f\u0072\u0020\u0070\u0061\u0072\u0073\u0069\u006e\u0067\u0020\u006e\u0075\u006d\u0062\u0065\u0072\u0020\u0025v\u0020\u0065\u0072\u0072\u003d\u0025v\u002e\u0020\u0055\u0073\u0069\u006e\u0067\u0020\u0030\u002e\u0030\u002e\u0020\u004fu\u0074\u0070u\u0074\u0020\u006d\u0061y\u0020\u0062\u0065\u0020\u0069n\u0063\u006f\u0072\u0072\u0065\u0063\u0074",_egedc .String (),_aaggf ); 1331 _dgeg =0.0;};_aaeg :=PdfObjectFloat (_dgeg );_bead =&_aaeg ;}else {_eebf ,_dafb :=_be .ParseInt (_egedc .String (),10,64);if _dafb !=nil {_df .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0070\u0061\u0072\u0073\u0069\u006e\u0067\u0020\u006e\u0075\u006db\u0065\u0072\u0020\u0025\u0076\u0020\u0065\u0072\u0072\u003d%\u0076\u002e\u0020\u0055\u0073\u0069\u006e\u0067\u0020\u0030\u002e\u0020\u004f\u0075\u0074\u0070\u0075\u0074 \u006d\u0061\u0079\u0020\u0062\u0065 \u0069\u006ec\u006f\u0072r\u0065c\u0074",_egedc .String (),_dafb ); 1332 _eebf =0;};_baee :=PdfObjectInteger (_eebf );_bead =&_baee ;};return _bead ,nil ;}; 1333 1334 // IsDecimalDigit checks if the character is a part of a decimal number string. 1335 func IsDecimalDigit (c byte )bool {return '0'<=c &&c <='9'}; 1336 1337 // IsPrintable checks if a character is printable. 1338 // Regular characters that are outside the range EXCLAMATION MARK(21h) 1339 // (!) to TILDE (7Eh) (~) should be written using the hexadecimal notation. 1340 func IsPrintable (c byte )bool {return 0x21<=c &&c <=0x7E};func _ggd (_cba *_gb .StdEncryptDict ,_dfdg *PdfObjectDictionary ){_dfdg .Set ("\u0052",MakeInteger (int64 (_cba .R )));_dfdg .Set ("\u0050",MakeInteger (int64 (_cba .P )));_dfdg .Set ("\u004f",MakeStringFromBytes (_cba .O )); 1341 _dfdg .Set ("\u0055",MakeStringFromBytes (_cba .U ));if _cba .R >=5{_dfdg .Set ("\u004f\u0045",MakeStringFromBytes (_cba .OE ));_dfdg .Set ("\u0055\u0045",MakeStringFromBytes (_cba .UE ));_dfdg .Set ("\u0045n\u0063r\u0079\u0070\u0074\u004d\u0065\u0074\u0061\u0064\u0061\u0074\u0061",MakeBool (_cba .EncryptMetadata )); 1342 if _cba .R > 5{_dfdg .Set ("\u0050\u0065\u0072m\u0073",MakeStringFromBytes (_cba .Perms ));};};}; 1343 1344 // PdfVersion returns version of the PDF file. 1345 func (_cddcg *PdfParser )PdfVersion ()Version {return _cddcg ._bdbfe }; 1346 1347 // IsHexadecimal checks if the PdfObjectString contains Hexadecimal data. 1348 func (_dfdfg *PdfObjectString )IsHexadecimal ()bool {return _dfdfg ._aae }; 1349 1350 // ResolveReference resolves reference if `o` is a *PdfObjectReference and returns the object referenced to. 1351 // Otherwise returns back `o`. 1352 func ResolveReference (obj PdfObject )PdfObject {if _cfeb ,_fbcg :=obj .(*PdfObjectReference );_fbcg {return _cfeb .Resolve ();};return obj ;}; 1353 1354 // RegisterCustomStreamEncoder register a custom encoder handler for certain filter. 1355 func RegisterCustomStreamEncoder (filterName string ,customStreamEncoder StreamEncoder ){_faed .Store (filterName ,customStreamEncoder );}; 1356 1357 // IsNullObject returns true if `obj` is a PdfObjectNull. 1358 func IsNullObject (obj PdfObject )bool {_ ,_babe :=TraceToDirectObject (obj ).(*PdfObjectNull );return _babe ;}; 1359 1360 // WriteString outputs the object as it is to be written to file. 1361 func (_abae *PdfObjectName )WriteString ()string {var _cdaa _d .Buffer ;if len (*_abae )> 127{_df .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a \u004e\u0061\u006d\u0065\u0020t\u006fo\u0020l\u006f\u006e\u0067\u0020\u0028\u0025\u0073)",*_abae );};_cdaa .WriteString ("\u002f"); 1362 for _ccedc :=0;_ccedc < len (*_abae );_ccedc ++{_ecdbg :=(*_abae )[_ccedc ];if !IsPrintable (_ecdbg )||_ecdbg =='#'||IsDelimiter (_ecdbg ){_cdaa .WriteString (_ea .Sprintf ("\u0023\u0025\u002e2\u0078",_ecdbg ));}else {_cdaa .WriteByte (_ecdbg );};};return _cdaa .String (); 1363 };const (StreamEncodingFilterNameFlate ="F\u006c\u0061\u0074\u0065\u0044\u0065\u0063\u006f\u0064\u0065";StreamEncodingFilterNameLZW ="\u004cZ\u0057\u0044\u0065\u0063\u006f\u0064e";StreamEncodingFilterNameDCT ="\u0044C\u0054\u0044\u0065\u0063\u006f\u0064e"; 1364 StreamEncodingFilterNameRunLength ="\u0052u\u006eL\u0065\u006e\u0067\u0074\u0068\u0044\u0065\u0063\u006f\u0064\u0065";StreamEncodingFilterNameASCIIHex ="\u0041\u0053\u0043\u0049\u0049\u0048\u0065\u0078\u0044e\u0063\u006f\u0064\u0065";StreamEncodingFilterNameASCII85 ="\u0041\u0053\u0043\u0049\u0049\u0038\u0035\u0044\u0065\u0063\u006f\u0064\u0065"; 1365 StreamEncodingFilterNameCCITTFax ="\u0043\u0043\u0049\u0054\u0054\u0046\u0061\u0078\u0044e\u0063\u006f\u0064\u0065";StreamEncodingFilterNameJBIG2 ="J\u0042\u0049\u0047\u0032\u0044\u0065\u0063\u006f\u0064\u0065";StreamEncodingFilterNameJPX ="\u004aP\u0058\u0044\u0065\u0063\u006f\u0064e"; 1366 StreamEncodingFilterNameRaw ="\u0052\u0061\u0077";); 1367 1368 // DecodeBytes decodes a slice of ASCII encoded bytes and returns the result. 1369 func (_bgbd *ASCIIHexEncoder )DecodeBytes (encoded []byte )([]byte ,error ){_geeg :=_d .NewReader (encoded );var _gdbe []byte ;for {_ebfe ,_feceg :=_geeg .ReadByte ();if _feceg !=nil {return nil ,_feceg ;};if _ebfe =='>'{break ;};if IsWhiteSpace (_ebfe ){continue ; 1370 };if (_ebfe >='a'&&_ebfe <='f')||(_ebfe >='A'&&_ebfe <='F')||(_ebfe >='0'&&_ebfe <='9'){_gdbe =append (_gdbe ,_ebfe );}else {_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0049\u006e\u0076\u0061\u006c\u0069d\u0020\u0061\u0073\u0063\u0069\u0069 \u0068\u0065\u0078\u0020\u0063\u0068\u0061\u0072\u0061\u0063\u0074\u0065\u0072 \u0028\u0025\u0063\u0029",_ebfe ); 1371 return nil ,_ea .Errorf ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0061\u0073\u0063\u0069\u0069\u0020\u0068e\u0078 \u0063\u0068\u0061\u0072\u0061\u0063\u0074\u0065\u0072\u0020\u0028\u0025\u0063\u0029",_ebfe );};};if len (_gdbe )%2==1{_gdbe =append (_gdbe ,'0'); 1372 };_df .Log .Trace ("\u0049\u006e\u0062\u006f\u0075\u006e\u0064\u0020\u0025\u0073",_gdbe );_gbae :=make ([]byte ,_ac .DecodedLen (len (_gdbe )));_ ,_cabfc :=_ac .Decode (_gbae ,_gdbe );if _cabfc !=nil {return nil ,_cabfc ;};return _gbae ,nil ;}; 1373 1374 // GetXrefOffset returns the offset of the xref table. 1375 func (_fbbb *PdfParser )GetXrefOffset ()int64 {return _fbbb ._cdca }; 1376 1377 // String returns a string describing `null`. 1378 func (_fccb *PdfObjectNull )String ()string {return "\u006e\u0075\u006c\u006c"}; 1379 1380 // MakeDecodeParams makes a new instance of an encoding dictionary based on 1381 // the current encoder settings. 1382 func (_cdeg *RawEncoder )MakeDecodeParams ()PdfObject {return nil }; 1383 1384 // MakeDecodeParams makes a new instance of an encoding dictionary based on the current encoder settings. 1385 func (_cagc *JBIG2Encoder )MakeDecodeParams ()PdfObject {return MakeDict ()}; 1386 1387 // EncodeBytes encodes slice of bytes into JBIG2 encoding format. 1388 // The input 'data' must be an image. In order to Decode it a user is responsible to 1389 // load the codec ('png', 'jpg'). 1390 // Returns jbig2 single page encoded document byte slice. The encoder uses DefaultPageSettings 1391 // to encode given image. 1392 func (_aada *JBIG2Encoder )EncodeBytes (data []byte )([]byte ,error ){const _dacbb ="\u004aB\u0049\u0047\u0032\u0045\u006e\u0063\u006f\u0064\u0065\u0072\u002eE\u006e\u0063\u006f\u0064\u0065\u0042\u0079\u0074\u0065\u0073";if _aada .ColorComponents !=1||_aada .BitsPerComponent !=1{return nil ,_dd .Errorf (_dacbb ,"\u0070\u0072\u006f\u0076\u0069\u0064\u0065\u0064\u0020i\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0069\u006e\u0070\u0075\u0074\u0020\u0069\u006d\u0061\u0067\u0065\u002e\u0020\u004a\u0042\u0049G\u0032\u0020E\u006e\u0063o\u0064\u0065\u0072\u0020\u0072\u0065\u0071\u0075\u0069\u0072\u0065\u0073\u0020bi\u006e\u0061\u0072\u0079\u0020\u0069\u006d\u0061\u0067e\u0073\u0020\u0064\u0061\u0074\u0061"); 1393 };var (_feaa *_dg .Bitmap ;_dfgb error ;);_decf :=(_aada .Width *_aada .Height )==len (data );if _decf {_feaa ,_dfgb =_dg .NewWithUnpaddedData (_aada .Width ,_aada .Height ,data );}else {_feaa ,_dfgb =_dg .NewWithData (_aada .Width ,_aada .Height ,data ); 1394 };if _dfgb !=nil {return nil ,_dfgb ;};_bfebb :=_aada .DefaultPageSettings ;if _dfgb =_bfebb .Validate ();_dfgb !=nil {return nil ,_dd .Wrap (_dfgb ,_dacbb ,"");};if _aada ._efaa ==nil {_aada ._efaa =_ecdf .InitEncodeDocument (_bfebb .FileMode );};switch _bfebb .Compression {case JB2Generic :if _dfgb =_aada ._efaa .AddGenericPage (_feaa ,_bfebb .DuplicatedLinesRemoval ); 1395 _dfgb !=nil {return nil ,_dd .Wrap (_dfgb ,_dacbb ,"");};case JB2SymbolCorrelation :return nil ,_dd .Error (_dacbb ,"s\u0079\u006d\u0062\u006f\u006c\u0020\u0063\u006f\u0072r\u0065\u006c\u0061\u0074\u0069\u006f\u006e e\u006e\u0063\u006f\u0064i\u006e\u0067\u0020\u006e\u006f\u0074\u0020\u0069\u006dpl\u0065\u006de\u006e\u0074\u0065\u0064\u0020\u0079\u0065\u0074"); 1396 case JB2SymbolRankHaus :return nil ,_dd .Error (_dacbb ,"\u0073y\u006d\u0062o\u006c\u0020\u0072a\u006e\u006b\u0020\u0068\u0061\u0075\u0073 \u0065\u006e\u0063\u006f\u0064\u0069n\u0067\u0020\u006e\u006f\u0074\u0020\u0069\u006d\u0070\u006c\u0065m\u0065\u006e\u0074\u0065\u0064\u0020\u0079\u0065\u0074"); 1397 default:return nil ,_dd .Error (_dacbb ,"\u0070\u0072\u006f\u0076i\u0064\u0065\u0064\u0020\u0069\u006e\u0076\u0061\u006c\u0069d\u0020c\u006f\u006d\u0070\u0072\u0065\u0073\u0073i\u006f\u006e");};return _aada .Encode ();}; 1398 1399 // EncryptInfo contains an information generated by the document encrypter. 1400 type EncryptInfo struct{Version ; 1401 1402 // Encrypt is an encryption dictionary that contains all necessary parameters. 1403 // It should be stored in all copies of the document trailer. 1404 Encrypt *PdfObjectDictionary ; 1405 1406 // ID0 and ID1 are IDs used in the trailer. Older algorithms such as RC4 uses them for encryption. 1407 ID0 ,ID1 string ;};type xrefType int ; 1408 1409 // WriteString outputs the object as it is to be written to file. 1410 func (_fgded *PdfIndirectObject )WriteString ()string {var _bbeb _cb .Builder ;_bbeb .WriteString (_be .FormatInt (_fgded .ObjectNumber ,10));_bbeb .WriteString ("\u0020\u0030\u0020\u0052");return _bbeb .String ();};var _dbgee =_f .MustCompile ("\u005e\\\u0073\u002a\u005b\u002d]\u002a\u0028\u005c\u0064\u002b)\u005cs\u002b(\u005c\u0064\u002b\u0029\u005c\u0073\u002bR"); 1411 1412 1413 // Elements returns a slice of the PdfObject elements in the array. 1414 // Preferred over accessing the array directly as type may be changed in future major versions (v3). 1415 func (_dfad *PdfObjectStreams )Elements ()[]PdfObject {if _dfad ==nil {return nil ;};return _dfad ._dgbb ;}; 1416 1417 // EncodeBytes encodes a bytes array and return the encoded value based on the encoder parameters. 1418 func (_agcec *RunLengthEncoder )EncodeBytes (data []byte )([]byte ,error ){_gedb :=_d .NewReader (data );var _bbfd []byte ;var _fbbg []byte ;_cda ,_baca :=_gedb .ReadByte ();if _baca ==_gd .EOF {return []byte {},nil ;}else if _baca !=nil {return nil ,_baca ; 1419 };_bee :=1;for {_fed ,_gfbe :=_gedb .ReadByte ();if _gfbe ==_gd .EOF {break ;}else if _gfbe !=nil {return nil ,_gfbe ;};if _fed ==_cda {if len (_fbbg )> 0{_fbbg =_fbbg [:len (_fbbg )-1];if len (_fbbg )> 0{_bbfd =append (_bbfd ,byte (len (_fbbg )-1));_bbfd =append (_bbfd ,_fbbg ...); 1420 };_bee =1;_fbbg =[]byte {};};_bee ++;if _bee >=127{_bbfd =append (_bbfd ,byte (257-_bee ),_cda );_bee =0;};}else {if _bee > 0{if _bee ==1{_fbbg =[]byte {_cda };}else {_bbfd =append (_bbfd ,byte (257-_bee ),_cda );};_bee =0;};_fbbg =append (_fbbg ,_fed ); 1421 if len (_fbbg )>=127{_bbfd =append (_bbfd ,byte (len (_fbbg )-1));_bbfd =append (_bbfd ,_fbbg ...);_fbbg =[]byte {};};};_cda =_fed ;};if len (_fbbg )> 0{_bbfd =append (_bbfd ,byte (len (_fbbg )-1));_bbfd =append (_bbfd ,_fbbg ...);}else if _bee > 0{_bbfd =append (_bbfd ,byte (257-_bee ),_cda ); 1422 };_bbfd =append (_bbfd ,128);return _bbfd ,nil ;}; 1423 1424 // FlattenObject returns the contents of `obj`. In other words, `obj` with indirect objects replaced 1425 // by their values. 1426 // The replacements are made recursively to a depth of traceMaxDepth. 1427 // NOTE: Dicts are sorted to make objects with same contents have the same PDF object strings. 1428 func FlattenObject (obj PdfObject )PdfObject {return _gded (obj ,0)}; 1429 1430 // String returns a string representation of the *PdfObjectString. 1431 func (_fgbf *PdfObjectString )String ()string {return _fgbf ._bcfef }; 1432 1433 // MakeIndirectObject creates an PdfIndirectObject with a specified direct object PdfObject. 1434 func MakeIndirectObject (obj PdfObject )*PdfIndirectObject {_bffb :=&PdfIndirectObject {};_bffb .PdfObject =obj ;return _bffb ;};func (_fefbd *PdfParser )skipComments ()error {if _ ,_gcgf :=_fefbd .skipSpaces ();_gcgf !=nil {return _gcgf ;};_bccg :=true ; 1435 for {_bafd ,_gdgc :=_fefbd ._gcec .Peek (1);if _gdgc !=nil {_df .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0025\u0073",_gdgc .Error ());return _gdgc ;};if _bccg &&_bafd [0]!='%'{return nil ;};_bccg =false ;if (_bafd [0]!='\r')&&(_bafd [0]!='\n'){_fefbd ._gcec .ReadByte (); 1436 }else {break ;};};return _fefbd .skipComments ();}; 1437 1438 // GetFilterArray returns the names of the underlying encoding filters in an array that 1439 // can be used as /Filter entry. 1440 func (_bfff *MultiEncoder )GetFilterArray ()*PdfObjectArray {_eddf :=make ([]PdfObject ,len (_bfff ._gbgba ));for _ebe ,_bgagg :=range _bfff ._gbgba {_eddf [_ebe ]=MakeName (_bgagg .GetFilterName ());};return MakeArray (_eddf ...);}; 1441 1442 // IsOctalDigit checks if a character can be part of an octal digit string. 1443 func IsOctalDigit (c byte )bool {return '0'<=c &&c <='7'};func (_bfdd *PdfParser )traceStreamLength (_fgad PdfObject )(PdfObject ,error ){_dcbag ,_eadb :=_fgad .(*PdfObjectReference );if _eadb {_aeae ,_gefbb :=_bfdd ._dbaad [_dcbag .ObjectNumber ];if _gefbb &&_aeae {_df .Log .Debug ("\u0053t\u0072\u0065a\u006d\u0020\u004c\u0065n\u0067\u0074\u0068 \u0072\u0065\u0066\u0065\u0072\u0065\u006e\u0063\u0065 u\u006e\u0072\u0065s\u006f\u006cv\u0065\u0064\u0020\u0028\u0069\u006cl\u0065\u0067a\u006c\u0029"); 1444 return nil ,_a .New ("\u0069\u006c\u006c\u0065ga\u006c\u0020\u0072\u0065\u0063\u0075\u0072\u0073\u0069\u0076\u0065\u0020\u006c\u006fo\u0070");};_bfdd ._dbaad [_dcbag .ObjectNumber ]=true ;};_aecb ,_bccf :=_bfdd .Resolve (_fgad );if _bccf !=nil {return nil ,_bccf ; 1445 };_df .Log .Trace ("\u0053\u0074\u0072\u0065\u0061\u006d\u0020\u006c\u0065\u006e\u0067\u0074h\u003f\u0020\u0025\u0073",_aecb );if _eadb {_bfdd ._dbaad [_dcbag .ObjectNumber ]=false ;};return _aecb ,nil ;};func (_ccgf *PdfParser )readTextLine ()(string ,error ){var _dddc _d .Buffer ; 1446 for {_dcga ,_bdegg :=_ccgf ._gcec .Peek (1);if _bdegg !=nil {_df .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0025\u0073",_bdegg .Error ());return _dddc .String (),_bdegg ;};if (_dcga [0]!='\r')&&(_dcga [0]!='\n'){_agadf ,_ :=_ccgf ._gcec .ReadByte (); 1447 _dddc .WriteByte (_agadf );}else {break ;};};return _dddc .String (),nil ;};func _gff (_fdcf int )cryptFilters {return cryptFilters {_gfb :_gc .NewFilterV2 (_fdcf )}}; 1448 1449 // GetNumbersAsFloat converts a list of pdf objects representing floats or integers to a slice of 1450 // float64 values. 1451 func GetNumbersAsFloat (objects []PdfObject )(_fbed []float64 ,_cbdd error ){for _ ,_caea :=range objects {_bfae ,_aaff :=GetNumberAsFloat (_caea );if _aaff !=nil {return nil ,_aaff ;};_fbed =append (_fbed ,_bfae );};return _fbed ,nil ;};func (_gda *FlateEncoder )postDecodePredict (_dabg []byte )([]byte ,error ){if _gda .Predictor > 1{if _gda .Predictor ==2{_df .Log .Trace ("\u0054\u0069\u0066\u0066\u0020\u0065\u006e\u0063\u006f\u0064\u0069\u006e\u0067"); 1452 _df .Log .Trace ("\u0043\u006f\u006c\u006f\u0072\u0073\u003a\u0020\u0025\u0064",_gda .Colors );_gdgd :=_gda .Columns *_gda .Colors ;if _gdgd < 1{return []byte {},nil ;};_dga :=len (_dabg )/_gdgd ;if len (_dabg )%_gdgd !=0{_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020T\u0049\u0046\u0046 \u0065\u006e\u0063\u006fd\u0069\u006e\u0067\u003a\u0020\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0072\u006f\u0077\u0020\u006c\u0065\u006e\u0067\u0074\u0068\u002e\u002e\u002e"); 1453 return nil ,_ea .Errorf ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0072\u006f\u0077 \u006c\u0065\u006e\u0067\u0074\u0068\u0020\u0028\u0025\u0064/\u0025\u0064\u0029",len (_dabg ),_gdgd );};if _gdgd %_gda .Colors !=0{return nil ,_ea .Errorf ("\u0069\u006ev\u0061\u006c\u0069\u0064 \u0072\u006fw\u0020\u006c\u0065\u006e\u0067\u0074\u0068\u0020(\u0025\u0064\u0029\u0020\u0066\u006f\u0072\u0020\u0063\u006f\u006c\u006fr\u0073\u0020\u0025\u0064",_gdgd ,_gda .Colors ); 1454 };if _gdgd > len (_dabg ){_df .Log .Debug ("\u0052\u006fw\u0020\u006c\u0065\u006e\u0067t\u0068\u0020\u0063\u0061\u006en\u006f\u0074\u0020\u0062\u0065\u0020\u006c\u006f\u006e\u0067\u0065\u0072\u0020\u0074\u0068\u0061\u006e\u0020\u0064\u0061\u0074\u0061\u0020\u006c\u0065\u006e\u0067\u0074\u0068\u0020\u0028\u0025\u0064\u002f\u0025\u0064\u0029",_gdgd ,len (_dabg )); 1455 return nil ,_a .New ("\u0072\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b\u0020e\u0072\u0072\u006f\u0072");};_df .Log .Trace ("i\u006e\u0070\u0020\u006fut\u0044a\u0074\u0061\u0020\u0028\u0025d\u0029\u003a\u0020\u0025\u0020\u0078",len (_dabg ),_dabg ); 1456 _gfeg :=_d .NewBuffer (nil );for _adbe :=0;_adbe < _dga ;_adbe ++{_dfbb :=_dabg [_gdgd *_adbe :_gdgd *(_adbe +1)];for _gdgb :=_gda .Colors ;_gdgb < _gdgd ;_gdgb ++{_dfbb [_gdgb ]+=_dfbb [_gdgb -_gda .Colors ];};_gfeg .Write (_dfbb );};_bbff :=_gfeg .Bytes (); 1457 _df .Log .Trace ("\u0050O\u0075t\u0044\u0061\u0074\u0061\u0020(\u0025\u0064)\u003a\u0020\u0025\u0020\u0078",len (_bbff ),_bbff );return _bbff ,nil ;}else if _gda .Predictor >=10&&_gda .Predictor <=15{_df .Log .Trace ("\u0050\u004e\u0047 \u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067"); 1458 _caed :=_gda .Columns *_gda .Colors +1;_cfc :=len (_dabg )/_caed ;if len (_dabg )%_caed !=0{return nil ,_ea .Errorf ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0072\u006f\u0077 \u006c\u0065\u006e\u0067\u0074\u0068\u0020\u0028\u0025\u0064/\u0025\u0064\u0029",len (_dabg ),_caed ); 1459 };if _caed > len (_dabg ){_df .Log .Debug ("\u0052\u006fw\u0020\u006c\u0065\u006e\u0067t\u0068\u0020\u0063\u0061\u006en\u006f\u0074\u0020\u0062\u0065\u0020\u006c\u006f\u006e\u0067\u0065\u0072\u0020\u0074\u0068\u0061\u006e\u0020\u0064\u0061\u0074\u0061\u0020\u006c\u0065\u006e\u0067\u0074\u0068\u0020\u0028\u0025\u0064\u002f\u0025\u0064\u0029",_caed ,len (_dabg )); 1460 return nil ,_a .New ("\u0072\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b\u0020e\u0072\u0072\u006f\u0072");};_feedb :=_d .NewBuffer (nil );_df .Log .Trace ("P\u0072\u0065\u0064\u0069ct\u006fr\u0020\u0063\u006f\u006c\u0075m\u006e\u0073\u003a\u0020\u0025\u0064",_gda .Columns ); 1461 _df .Log .Trace ("\u004ce\u006e\u0067\u0074\u0068:\u0020\u0025\u0064\u0020\u002f \u0025d\u0020=\u0020\u0025\u0064\u0020\u0072\u006f\u0077s",len (_dabg ),_caed ,_cfc );_dacg :=make ([]byte ,_caed );for _fdb :=0;_fdb < _caed ;_fdb ++{_dacg [_fdb ]=0;};_gec :=_gda .Colors ; 1462 for _egda :=0;_egda < _cfc ;_egda ++{_cbc :=_dabg [_caed *_egda :_caed *(_egda +1)];_dcda :=_cbc [0];switch _dcda {case _ega :case _bgec :for _gfa :=1+_gec ;_gfa < _caed ;_gfa ++{_cbc [_gfa ]+=_cbc [_gfa -_gec ];};case _dace :for _cfgb :=1;_cfgb < _caed ; 1463 _cfgb ++{_cbc [_cfgb ]+=_dacg [_cfgb ];};case _bfc :for _fdaf :=1;_fdaf < _gec +1;_fdaf ++{_cbc [_fdaf ]+=_dacg [_fdaf ]/2;};for _fgacd :=_gec +1;_fgacd < _caed ;_fgacd ++{_cbc [_fgacd ]+=byte ((int (_cbc [_fgacd -_gec ])+int (_dacg [_fgacd ]))/2);};case _agce :for _afed :=1; 1464 _afed < _caed ;_afed ++{var _dca ,_gebd ,_dfbbc byte ;_gebd =_dacg [_afed ];if _afed >=_gec +1{_dca =_cbc [_afed -_gec ];_dfbbc =_dacg [_afed -_gec ];};_cbc [_afed ]+=_cecd (_dca ,_gebd ,_dfbbc );};default:_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0049\u006e\u0076\u0061\u006c\u0069d\u0020\u0066\u0069\u006c\u0074\u0065r\u0020\u0062\u0079\u0074\u0065\u0020\u0028\u0025\u0064\u0029\u0020\u0040\u0072o\u0077\u0020\u0025\u0064",_dcda ,_egda ); 1465 return nil ,_ea .Errorf ("\u0069n\u0076\u0061\u006c\u0069\u0064\u0020\u0066\u0069\u006c\u0074\u0065r\u0020\u0062\u0079\u0074\u0065\u0020\u0028\u0025\u0064\u0029",_dcda );};copy (_dacg ,_cbc );_feedb .Write (_cbc [1:]);};_aec :=_feedb .Bytes ();return _aec ,nil ; 1466 }else {_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a \u0055\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u0020\u0070r\u0065\u0064\u0069\u0063\u0074\u006f\u0072 \u0028\u0025\u0064\u0029",_gda .Predictor );return nil ,_ea .Errorf ("\u0075\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064 \u0070\u0072\u0065\u0064\u0069\u0063\u0074\u006f\u0072\u0020(\u0025\u0064\u0029",_gda .Predictor ); 1467 };};return _dabg ,nil ;};const (DefaultJPEGQuality =75;);func (_fdf *PdfCrypt )encryptBytes (_efc []byte ,_fea string ,_cceb []byte )([]byte ,error ){_df .Log .Trace ("\u0045\u006e\u0063\u0072\u0079\u0070\u0074\u0020\u0062\u0079\u0074\u0065\u0073");_dgca ,_abga :=_fdf ._bde [_fea ]; 1468 if !_abga {return nil ,_ea .Errorf ("\u0075n\u006b\u006e\u006f\u0077n\u0020\u0063\u0072\u0079\u0070t\u0020f\u0069l\u0074\u0065\u0072\u0020\u0028\u0025\u0073)",_fea );};return _dgca .EncryptBytes (_efc ,_cceb );}; 1469 1470 // JBIG2CompressionType defines the enum compression type used by the JBIG2Encoder. 1471 type JBIG2CompressionType int ;func (_cc *PdfParser )lookupByNumberWrapper (_gcb int ,_fb bool )(PdfObject ,bool ,error ){_ga ,_bcg ,_cg :=_cc .lookupByNumber (_gcb ,_fb );if _cg !=nil {return nil ,_bcg ,_cg ;};if !_bcg &&_cc ._acg !=nil &&_cc ._acg ._age &&!_cc ._acg .isDecrypted (_ga ){_ba :=_cc ._acg .Decrypt (_ga ,0,0); 1472 if _ba !=nil {return nil ,_bcg ,_ba ;};};return _ga ,_bcg ,nil ;};func _ffe (_de PdfObject )(int64 ,int64 ,error ){if _deg ,_fg :=_de .(*PdfIndirectObject );_fg {return _deg .ObjectNumber ,_deg .GenerationNumber ,nil ;};if _ggb ,_fac :=_de .(*PdfObjectStream ); 1473 _fac {return _ggb .ObjectNumber ,_ggb .GenerationNumber ,nil ;};return 0,0,_a .New ("\u006e\u006ft\u0020\u0061\u006e\u0020\u0069\u006e\u0064\u0069\u0072\u0065\u0063\u0074\u002f\u0073\u0074\u0072\u0065\u0061\u006d\u0020\u006f\u0062je\u0063\u0074");}; 1474 1475 // MakeStreamDict makes a new instance of an encoding dictionary for a stream object. 1476 func (_egfe *RawEncoder )MakeStreamDict ()*PdfObjectDictionary {return MakeDict ()};func (_cccb *PdfObjectFloat )String ()string {return _ea .Sprintf ("\u0025\u0066",*_cccb )}; 1477 1478 // WriteString outputs the object as it is to be written to file. 1479 func (_cfbda *PdfObjectStream )WriteString ()string {var _dfcac _cb .Builder ;_dfcac .WriteString (_be .FormatInt (_cfbda .ObjectNumber ,10));_dfcac .WriteString ("\u0020\u0030\u0020\u0052");return _dfcac .String ();};func (_ccbgd *PdfParser )seekPdfVersionTopDown ()(int ,int ,error ){_ccbgd ._abdga .Seek (0,_gd .SeekStart ); 1480 _ccbgd ._gcec =_fd .NewReader (_ccbgd ._abdga );_ccdea :=20;_ebd :=make ([]byte ,_ccdea );for {_dgec ,_dbegc :=_ccbgd ._gcec .ReadByte ();if _dbegc !=nil {if _dbegc ==_gd .EOF {break ;}else {return 0,0,_dbegc ;};};if IsDecimalDigit (_dgec )&&_ebd [_ccdea -1]=='.'&&IsDecimalDigit (_ebd [_ccdea -2])&&_ebd [_ccdea -3]=='-'&&_ebd [_ccdea -4]=='F'&&_ebd [_ccdea -5]=='D'&&_ebd [_ccdea -6]=='P'{_gbcf :=int (_ebd [_ccdea -2]-'0'); 1481 _fcgc :=int (_dgec -'0');return _gbcf ,_fcgc ,nil ;};_ebd =append (_ebd [1:_ccdea ],_dgec );};return 0,0,_a .New ("\u0076\u0065\u0072\u0073\u0069\u006f\u006e\u0020\u006e\u006f\u0074\u0020f\u006f\u0075\u006e\u0064");}; 1482 1483 // HasDataAfterEOF checks if there is some data after EOF marker. 1484 func (_ffa ParserMetadata )HasDataAfterEOF ()bool {return _ffa ._dacf };func (_dgga *offsetReader )Seek (offset int64 ,whence int )(int64 ,error ){if whence ==_gd .SeekStart {offset +=_dgga ._fefc ;};_gcab ,_dcaa :=_dgga ._eacg .Seek (offset ,whence ); 1485 if _dcaa !=nil {return _gcab ,_dcaa ;};if whence ==_gd .SeekCurrent {_gcab -=_dgga ._fefc ;};if _gcab < 0{return 0,_a .New ("\u0063\u006f\u0072\u0065\u002eo\u0066\u0066\u0073\u0065\u0074\u0052\u0065\u0061\u0064\u0065\u0072\u002e\u0053e\u0065\u006b\u003a\u0020\u006e\u0065\u0067\u0061\u0074\u0069\u0076\u0065\u0020\u0070\u006f\u0073\u0069\u0074\u0069\u006f\u006e"); 1486 };return _gcab ,nil ;};func (_eaaf *PdfCrypt )authenticate (_abg []byte )(bool ,error ){_eaaf ._age =false ;_ceed :=_eaaf .securityHandler ();_ebg ,_ggff ,_dbee :=_ceed .Authenticate (&_eaaf ._bga ,_abg );if _dbee !=nil {return false ,_dbee ;}else if _ggff ==0||len (_ebg )==0{return false ,nil ; 1487 };_eaaf ._age =true ;_eaaf ._edb =_ebg ;return true ,nil ;}; 1488 1489 // GetIntVal returns the int value represented by the PdfObject directly or indirectly if contained within an 1490 // indirect object. On type mismatch the found bool flag returned is false and a nil pointer is returned. 1491 func GetIntVal (obj PdfObject )(_cacc int ,_edgg bool ){_bfddf ,_edgg :=TraceToDirectObject (obj ).(*PdfObjectInteger );if _edgg &&_bfddf !=nil {return int (*_bfddf ),true ;};return 0,false ;}; 1492 1493 // GetArray returns the *PdfObjectArray represented by the PdfObject directly or indirectly within an indirect 1494 // object. On type mismatch the found bool flag is false and a nil pointer is returned. 1495 func GetArray (obj PdfObject )(_dbcdd *PdfObjectArray ,_fffe bool ){_dbcdd ,_fffe =TraceToDirectObject (obj ).(*PdfObjectArray );return _dbcdd ,_fffe ;};func (_bcbae *PdfParser )parseNull ()(PdfObjectNull ,error ){_ ,_bgbdc :=_bcbae ._gcec .Discard (4); 1496 return PdfObjectNull {},_bgbdc ;};func (_aeb *PdfCrypt )checkAccessRights (_dcd []byte )(bool ,_gb .Permissions ,error ){_aad :=_aeb .securityHandler ();_bbfa ,_cdee ,_gbaaa :=_aad .Authenticate (&_aeb ._bga ,_dcd );if _gbaaa !=nil {return false ,0,_gbaaa ; 1497 }else if _cdee ==0||len (_bbfa )==0{return false ,0,nil ;};return true ,_cdee ,nil ;}; 1498 1499 // Elements returns a slice of the PdfObject elements in the array. 1500 func (_efaf *PdfObjectArray )Elements ()[]PdfObject {if _efaf ==nil {return nil ;};return _efaf ._cdea ;};func (_bgde *PdfObjectDictionary )setWithLock (_aebga PdfObjectName ,_cded PdfObject ,_dfcbd bool ){if _dfcbd {_bgde ._gfff .Lock ();defer _bgde ._gfff .Unlock (); 1501 };_ ,_bdcbb :=_bgde ._ccfa [_aebga ];if !_bdcbb {_bgde ._aggf =append (_bgde ._aggf ,_aebga );};_bgde ._ccfa [_aebga ]=_cded ;};func (_dabf *PdfParser )parseDetailedHeader ()(_ccc error ){_dabf ._abdga .Seek (0,_gd .SeekStart );_dabf ._gcec =_fd .NewReader (_dabf ._abdga ); 1502 _efed :=20;_eaag :=make ([]byte ,_efed );var (_dgcg bool ;_dcdb int ;);for {_ebfg ,_cagf :=_dabf ._gcec .ReadByte ();if _cagf !=nil {if _cagf ==_gd .EOF {break ;}else {return _cagf ;};};if IsDecimalDigit (_ebfg )&&_eaag [_efed -1]=='.'&&IsDecimalDigit (_eaag [_efed -2])&&_eaag [_efed -3]=='-'&&_eaag [_efed -4]=='F'&&_eaag [_efed -5]=='D'&&_eaag [_efed -6]=='P'&&_eaag [_efed -7]=='%'{_dabf ._bdbfe =Version {Major :int (_eaag [_efed -2]-'0'),Minor :int (_ebfg -'0')}; 1503 _dabf ._ffge ._ecef =_dcdb -7;_dgcg =true ;break ;};_dcdb ++;_eaag =append (_eaag [1:_efed ],_ebfg );};if !_dgcg {return _ea .Errorf ("n\u006f \u0066\u0069\u006c\u0065\u0020\u0068\u0065\u0061d\u0065\u0072\u0020\u0066ou\u006e\u0064");};_geaf ,_ccc :=_dabf ._gcec .ReadByte (); 1504 if _ccc ==_gd .EOF {return _ea .Errorf ("\u006eo\u0074\u0020\u0061\u0020\u0076\u0061\u006c\u0069\u0064\u0020\u0050d\u0066\u0020\u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074");};if _ccc !=nil {return _ccc ;};_dabf ._ffge ._eddgg =_geaf =='\n';_geaf ,_ccc =_dabf ._gcec .ReadByte (); 1505 if _ccc !=nil {return _ea .Errorf ("\u006e\u006f\u0074\u0020a\u0020\u0076\u0061\u006c\u0069\u0064\u0020\u0070\u0064\u0066 \u0064o\u0063\u0075\u006d\u0065\u006e\u0074\u003a \u0025\u0077",_ccc );};if _geaf !='%'{return nil ;};_bggaf :=make ([]byte ,4);_ ,_ccc =_dabf ._gcec .Read (_bggaf ); 1506 if _ccc !=nil {return _ea .Errorf ("\u006e\u006f\u0074\u0020a\u0020\u0076\u0061\u006c\u0069\u0064\u0020\u0070\u0064\u0066 \u0064o\u0063\u0075\u006d\u0065\u006e\u0074\u003a \u0025\u0077",_ccc );};_dabf ._ffge ._cdef =[4]byte {_bggaf [0],_bggaf [1],_bggaf [2],_bggaf [3]}; 1507 return nil ;}; 1508 1509 // ToFloat64Array returns a slice of all elements in the array as a float64 slice. An error is 1510 // returned if the array contains non-numeric objects (each element can be either PdfObjectInteger 1511 // or PdfObjectFloat). 1512 func (_bgafb *PdfObjectArray )ToFloat64Array ()([]float64 ,error ){var _fbcd []float64 ;for _ ,_gdfb :=range _bgafb .Elements (){switch _aegg :=_gdfb .(type ){case *PdfObjectInteger :_fbcd =append (_fbcd ,float64 (*_aegg ));case *PdfObjectFloat :_fbcd =append (_fbcd ,float64 (*_aegg )); 1513 default:return nil ,ErrTypeError ;};};return _fbcd ,nil ;};func (_egff *PdfParser )parseString ()(*PdfObjectString ,error ){_egff ._gcec .ReadByte ();var _debd _d .Buffer ;_ffgd :=1;for {_ccgb ,_caf :=_egff ._gcec .Peek (1);if _caf !=nil {return MakeString (_debd .String ()),_caf ; 1514 };if _ccgb [0]=='\\'{_egff ._gcec .ReadByte ();_gdec ,_bgcb :=_egff ._gcec .ReadByte ();if _bgcb !=nil {return MakeString (_debd .String ()),_bgcb ;};if IsOctalDigit (_gdec ){_acef ,_fbddg :=_egff ._gcec .Peek (2);if _fbddg !=nil {return MakeString (_debd .String ()),_fbddg ; 1515 };var _fegf []byte ;_fegf =append (_fegf ,_gdec );for _ ,_cdec :=range _acef {if IsOctalDigit (_cdec ){_fegf =append (_fegf ,_cdec );}else {break ;};};_egff ._gcec .Discard (len (_fegf )-1);_df .Log .Trace ("\u004e\u0075\u006d\u0065ri\u0063\u0020\u0073\u0074\u0072\u0069\u006e\u0067\u0020\u0022\u0025\u0073\u0022",_fegf ); 1516 _dcacf ,_fbddg :=_be .ParseUint (string (_fegf ),8,32);if _fbddg !=nil {return MakeString (_debd .String ()),_fbddg ;};_debd .WriteByte (byte (_dcacf ));continue ;};switch _gdec {case 'n':_debd .WriteRune ('\n');case 'r':_debd .WriteRune ('\r');case 't':_debd .WriteRune ('\t'); 1517 case 'b':_debd .WriteRune ('\b');case 'f':_debd .WriteRune ('\f');case '(':_debd .WriteRune ('(');case ')':_debd .WriteRune (')');case '\\':_debd .WriteRune ('\\');};continue ;}else if _ccgb [0]=='('{_ffgd ++;}else if _ccgb [0]==')'{_ffgd --;if _ffgd ==0{_egff ._gcec .ReadByte (); 1518 break ;};};_agga ,_ :=_egff ._gcec .ReadByte ();_debd .WriteByte (_agga );};return MakeString (_debd .String ()),nil ;}; 1519 1520 // ParseDict reads and parses a PDF dictionary object enclosed with '<<' and '>>' 1521 func (_agfb *PdfParser )ParseDict ()(*PdfObjectDictionary ,error ){_df .Log .Trace ("\u0052\u0065\u0061\u0064\u0069\u006e\u0067\u0020\u0050\u0044\u0046\u0020D\u0069\u0063\u0074\u0021");_cfdec :=MakeDict ();_cfdec ._fdad =_agfb ;_edg ,_ :=_agfb ._gcec .ReadByte (); 1522 if _edg !='<'{return nil ,_a .New ("\u0069\u006e\u0076a\u006c\u0069\u0064\u0020\u0064\u0069\u0063\u0074");};_edg ,_ =_agfb ._gcec .ReadByte ();if _edg !='<'{return nil ,_a .New ("\u0069\u006e\u0076a\u006c\u0069\u0064\u0020\u0064\u0069\u0063\u0074");};for {_agfb .skipSpaces (); 1523 _agfb .skipComments ();_ffcc ,_ccddb :=_agfb ._gcec .Peek (2);if _ccddb !=nil {return nil ,_ccddb ;};_df .Log .Trace ("D\u0069c\u0074\u0020\u0070\u0065\u0065\u006b\u003a\u0020%\u0073\u0020\u0028\u0025 x\u0029\u0021",string (_ffcc ),string (_ffcc ));if (_ffcc [0]=='>')&&(_ffcc [1]=='>'){_df .Log .Trace ("\u0045\u004f\u0046\u0020\u0064\u0069\u0063\u0074\u0069o\u006e\u0061\u0072\u0079"); 1524 _agfb ._gcec .ReadByte ();_agfb ._gcec .ReadByte ();break ;};_df .Log .Trace ("\u0050a\u0072s\u0065\u0020\u0074\u0068\u0065\u0020\u006e\u0061\u006d\u0065\u0021");_bgbf ,_ccddb :=_agfb .parseName ();_df .Log .Trace ("\u004be\u0079\u003a\u0020\u0025\u0073",_bgbf ); 1525 if _ccddb !=nil {_df .Log .Debug ("E\u0052\u0052\u004f\u0052\u0020\u0052e\u0074\u0075\u0072\u006e\u0069\u006e\u0067\u0020\u006ea\u006d\u0065\u0020e\u0072r\u0020\u0025\u0073",_ccddb );return nil ,_ccddb ;};if len (_bgbf )> 4&&_bgbf [len (_bgbf )-4:]=="\u006e\u0075\u006c\u006c"{_edeb :=_bgbf [0:len (_bgbf )-4]; 1526 _df .Log .Debug ("\u0054\u0061\u006b\u0069n\u0067\u0020\u0063\u0061\u0072\u0065\u0020\u006f\u0066\u0020n\u0075l\u006c\u0020\u0062\u0075\u0067\u0020\u0028%\u0073\u0029",_bgbf );_df .Log .Debug ("\u004e\u0065\u0077\u0020ke\u0079\u0020\u0022\u0025\u0073\u0022\u0020\u003d\u0020\u006e\u0075\u006c\u006c",_edeb ); 1527 _agfb .skipSpaces ();_dbgea ,_ :=_agfb ._gcec .Peek (1);if _dbgea [0]=='/'{_cfdec .Set (_edeb ,MakeNull ());continue ;};};_agfb .skipSpaces ();_ccec ,_ccddb :=_agfb .parseObject ();if _ccddb !=nil {return nil ,_ccddb ;};_cfdec .Set (_bgbf ,_ccec );if _df .Log .IsLogLevel (_df .LogLevelTrace ){_df .Log .Trace ("\u0064\u0069\u0063\u0074\u005b\u0025\u0073\u005d\u0020\u003d\u0020\u0025\u0073",_bgbf ,_ccec .String ()); 1528 };};_df .Log .Trace ("\u0072\u0065\u0074\u0075rn\u0069\u006e\u0067\u0020\u0050\u0044\u0046\u0020\u0044\u0069\u0063\u0074\u0021");return _cfdec ,nil ;}; 1529 1530 // MakeStreamDict make a new instance of an encoding dictionary for a stream object. 1531 func (_acff *ASCII85Encoder )MakeStreamDict ()*PdfObjectDictionary {_cdefe :=MakeDict ();_cdefe .Set ("\u0046\u0069\u006c\u0074\u0065\u0072",MakeName (_acff .GetFilterName ()));return _cdefe ;};type objectCache map[int ]PdfObject ; 1532 1533 // GetFloat returns the *PdfObjectFloat represented by the PdfObject directly or indirectly within an indirect 1534 // object. On type mismatch the found bool flag is false and a nil pointer is returned. 1535 func GetFloat (obj PdfObject )(_cfae *PdfObjectFloat ,_dabc bool ){_cfae ,_dabc =TraceToDirectObject (obj ).(*PdfObjectFloat );return _cfae ,_dabc ;}; 1536 1537 // ToIntegerArray returns a slice of all array elements as an int slice. An error is returned if the 1538 // array non-integer objects. Each element can only be PdfObjectInteger. 1539 func (_cbdg *PdfObjectArray )ToIntegerArray ()([]int ,error ){var _fabg []int ;for _ ,_fdcbb :=range _cbdg .Elements (){if _gggc ,_cdaaf :=_fdcbb .(*PdfObjectInteger );_cdaaf {_fabg =append (_fabg ,int (*_gggc ));}else {return nil ,ErrTypeError ;};};return _fabg ,nil ; 1540 }; 1541 1542 // Version represents a version of a PDF standard. 1543 type Version struct{Major int ;Minor int ;};func _afbe (_adff _gd .ReadSeeker ,_efbgf int64 )(*limitedReadSeeker ,error ){_ ,_gaab :=_adff .Seek (0,_gd .SeekStart );if _gaab !=nil {return nil ,_gaab ;};return &limitedReadSeeker {_cgfaf :_adff ,_dgfg :_efbgf },nil ; 1544 }; 1545 1546 // NewEncoderFromStream creates a StreamEncoder based on the stream's dictionary. 1547 func NewEncoderFromStream (streamObj *PdfObjectStream )(StreamEncoder ,error ){_cdcda :=TraceToDirectObject (streamObj .PdfObjectDictionary .Get ("\u0046\u0069\u006c\u0074\u0065\u0072"));if _cdcda ==nil {return NewRawEncoder (),nil ;};if _ ,_cdegg :=_cdcda .(*PdfObjectNull ); 1548 _cdegg {return NewRawEncoder (),nil ;};_egdf ,_dfcab :=_cdcda .(*PdfObjectName );if !_dfcab {_gbagf ,_agfa :=_cdcda .(*PdfObjectArray );if !_agfa {return nil ,_ea .Errorf ("\u0066\u0069\u006c\u0074\u0065\u0072 \u006e\u006f\u0074\u0020\u0061\u0020\u004e\u0061\u006d\u0065\u0020\u006f\u0072 \u0041\u0072\u0072\u0061\u0079\u0020\u006fb\u006a\u0065\u0063\u0074"); 1549 };if _gbagf .Len ()==0{return NewRawEncoder (),nil ;};if _gbagf .Len ()!=1{_fabgc ,_becd :=_daee (streamObj );if _becd !=nil {_df .Log .Error ("\u0046\u0061\u0069\u006c\u0065\u0064 \u0063\u0072\u0065\u0061\u0074\u0069\u006e\u0067\u0020\u006d\u0075\u006c\u0074i\u0020\u0065\u006e\u0063\u006f\u0064\u0065r\u003a\u0020\u0025\u0076",_becd ); 1550 return nil ,_becd ;};_df .Log .Trace ("\u004d\u0075\u006c\u0074\u0069\u0020\u0065\u006e\u0063:\u0020\u0025\u0073\u000a",_fabgc );return _fabgc ,nil ;};_cdcda =_gbagf .Get (0);_egdf ,_agfa =_cdcda .(*PdfObjectName );if !_agfa {return nil ,_ea .Errorf ("\u0066\u0069l\u0074\u0065\u0072\u0020a\u0072\u0072a\u0079\u0020\u006d\u0065\u006d\u0062\u0065\u0072 \u006e\u006f\u0074\u0020\u0061\u0020\u004e\u0061\u006d\u0065\u0020\u006fb\u006a\u0065\u0063\u0074"); 1551 };};if _bfdb ,_edfb :=_faed .Load (_egdf .String ());_edfb {return _bfdb .(StreamEncoder ),nil ;};switch *_egdf {case StreamEncodingFilterNameFlate :return _daca (streamObj ,nil );case StreamEncodingFilterNameLZW :return _bdbf (streamObj ,nil );case StreamEncodingFilterNameDCT :return _defa (streamObj ,nil ); 1552 case StreamEncodingFilterNameRunLength :return _efba (streamObj ,nil );case StreamEncodingFilterNameASCIIHex :return NewASCIIHexEncoder (),nil ;case StreamEncodingFilterNameASCII85 ,"\u0041\u0038\u0035":return NewASCII85Encoder (),nil ;case StreamEncodingFilterNameCCITTFax :return _dbad (streamObj ,nil ); 1553 case StreamEncodingFilterNameJBIG2 :return _gcda (streamObj ,nil );case StreamEncodingFilterNameJPX :return NewJPXEncoder (),nil ;};_df .Log .Debug ("E\u0052\u0052\u004f\u0052\u003a\u0020U\u006e\u0073\u0075\u0070\u0070\u006fr\u0074\u0065\u0064\u0020\u0065\u006e\u0063o\u0064\u0069\u006e\u0067\u0020\u006d\u0065\u0074\u0068\u006fd\u0021"); 1554 return nil ,_ea .Errorf ("\u0075\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u0020\u0065\u006e\u0063o\u0064i\u006e\u0067\u0020\u006d\u0065\u0074\u0068\u006f\u0064\u0020\u0028\u0025\u0073\u0029",*_egdf );}; 1555 1556 // MakeStreamDict makes a new instance of an encoding dictionary for a stream object. 1557 // Has the Filter set. Some other parameters are generated elsewhere. 1558 func (_acdc *DCTEncoder )MakeStreamDict ()*PdfObjectDictionary {_dada :=MakeDict ();_dada .Set ("\u0046\u0069\u006c\u0074\u0065\u0072",MakeName (_acdc .GetFilterName ()));return _dada ;}; 1559 1560 // WriteString outputs the object as it is to be written to file. 1561 func (_ffgabe *PdfObjectReference )WriteString ()string {var _bgcc _cb .Builder ;_bgcc .WriteString (_be .FormatInt (_ffgabe .ObjectNumber ,10));_bgcc .WriteString ("\u0020");_bgcc .WriteString (_be .FormatInt (_ffgabe .GenerationNumber ,10));_bgcc .WriteString ("\u0020\u0052"); 1562 return _bgcc .String ();};type limitedReadSeeker struct{_cgfaf _gd .ReadSeeker ;_dgfg int64 ;}; 1563 1564 // WriteString outputs the object as it is to be written to file. 1565 func (_adeac *PdfObjectFloat )WriteString ()string {return _be .FormatFloat (float64 (*_adeac ),'f',-1,64);}; 1566 1567 // RawEncoder implements Raw encoder/decoder (no encoding, pass through) 1568 type RawEncoder struct{}; 1569 1570 // NewASCII85Encoder makes a new ASCII85 encoder. 1571 func NewASCII85Encoder ()*ASCII85Encoder {_cdcf :=&ASCII85Encoder {};return _cdcf }; 1572 1573 // GetIndirect returns the *PdfIndirectObject represented by the PdfObject. On type mismatch the found bool flag is 1574 // false and a nil pointer is returned. 1575 func GetIndirect (obj PdfObject )(_aacag *PdfIndirectObject ,_ageg bool ){obj =ResolveReference (obj );_aacag ,_ageg =obj .(*PdfIndirectObject );return _aacag ,_ageg ;};var _bcbac =_f .MustCompile ("\u0028\u005c\u0064\u002b\u0029\u005c\u0073\u002b\u0028\u005c\u0064\u002b)\u005c\u0073\u002a\u0024"); 1576 func _dagdd (_edegf PdfObject )(*float64 ,error ){switch _bgcbb :=_edegf .(type ){case *PdfObjectFloat :_bgfe :=float64 (*_bgcbb );return &_bgfe ,nil ;case *PdfObjectInteger :_aaaae :=float64 (*_bgcbb );return &_aaaae ,nil ;case *PdfObjectNull :return nil ,nil ; 1577 };return nil ,ErrNotANumber ;}; 1578 1579 // GetCrypter returns the PdfCrypt instance which has information about the PDFs encryption. 1580 func (_cdbb *PdfParser )GetCrypter ()*PdfCrypt {return _cdbb ._acg }; 1581 1582 // CheckAccessRights checks access rights and permissions for a specified password. If either user/owner password is 1583 // specified, full rights are granted, otherwise the access rights are specified by the Permissions flag. 1584 // 1585 // The bool flag indicates that the user can access and view the file. 1586 // The AccessPermissions shows what access the user has for editing etc. 1587 // An error is returned if there was a problem performing the authentication. 1588 func (_dbff *PdfParser )CheckAccessRights (password []byte )(bool ,_gb .Permissions ,error ){if _dbff ._acg ==nil {return true ,_gb .PermOwner ,nil ;};return _dbff ._acg .checkAccessRights (password );};func (_fbcf *PdfParser )xrefNextObjectOffset (_adca int64 )int64 {_dfbfd :=int64 (0); 1589 if len (_fbcf ._ggaf .ObjectMap )==0{return 0;};if len (_fbcf ._ggaf ._ggf )==0{_ccae :=0;for _ ,_cbfeb :=range _fbcf ._ggaf .ObjectMap {if _cbfeb .Offset > 0{_ccae ++;};};if _ccae ==0{return 0;};_fbcf ._ggaf ._ggf =make ([]XrefObject ,_ccae );_bbgd :=0; 1590 for _ ,_bgbfg :=range _fbcf ._ggaf .ObjectMap {if _bgbfg .Offset > 0{_fbcf ._ggaf ._ggf [_bbgd ]=_bgbfg ;_bbgd ++;};};_g .Slice (_fbcf ._ggaf ._ggf ,func (_aceba ,_cabae int )bool {return _fbcf ._ggaf ._ggf [_aceba ].Offset < _fbcf ._ggaf ._ggf [_cabae ].Offset ; 1591 });};_gaad :=_g .Search (len (_fbcf ._ggaf ._ggf ),func (_gfefd int )bool {return _fbcf ._ggaf ._ggf [_gfefd ].Offset >=_adca });if _gaad < len (_fbcf ._ggaf ._ggf ){_dfbfd =_fbcf ._ggaf ._ggf [_gaad ].Offset ;};return _dfbfd ;};func _dbfe (_gaga _cf .Image )*JBIG2Image {_edbe :=_gaga .Base (); 1592 return &JBIG2Image {Data :_edbe .Data ,Width :_edbe .Width ,Height :_edbe .Height ,HasPadding :true };}; 1593 1594 // MakeStreamDict makes a new instance of an encoding dictionary for a stream object. 1595 func (_gacd *JBIG2Encoder )MakeStreamDict ()*PdfObjectDictionary {_begde :=MakeDict ();_begde .Set ("\u0046\u0069\u006c\u0074\u0065\u0072",MakeName (_gacd .GetFilterName ()));return _begde ;};func _ed (_feb XrefTable ){_df .Log .Debug ("\u003dX\u003d\u0058\u003d\u0058\u003d"); 1596 _df .Log .Debug ("X\u0072\u0065\u0066\u0020\u0074\u0061\u0062\u006c\u0065\u003a");_ggee :=0;for _ ,_aga :=range _feb .ObjectMap {_df .Log .Debug ("i\u002b\u0031\u003a\u0020\u0025\u0064 \u0028\u006f\u0062\u006a\u0020\u006eu\u006d\u003a\u0020\u0025\u0064\u0020\u0067e\u006e\u003a\u0020\u0025\u0064\u0029\u0020\u002d\u003e\u0020%\u0064",_ggee +1,_aga .ObjectNumber ,_aga .Generation ,_aga .Offset ); 1597 _ggee ++;};}; 1598 1599 // WriteString outputs the object as it is to be written to file. 1600 func (_acebe *PdfObjectDictionary )WriteString ()string {var _adbc _cb .Builder ;_adbc .WriteString ("\u003c\u003c");for _ ,_eabcf :=range _acebe ._aggf {_ggdff :=_acebe ._ccfa [_eabcf ];_adbc .WriteString (_eabcf .WriteString ());_adbc .WriteString ("\u0020"); 1601 _adbc .WriteString (_ggdff .WriteString ());};_adbc .WriteString ("\u003e\u003e");return _adbc .String ();};func _dbad (_cagec *PdfObjectStream ,_fbca *PdfObjectDictionary )(*CCITTFaxEncoder ,error ){_cdaf :=NewCCITTFaxEncoder ();_bcbb :=_cagec .PdfObjectDictionary ; 1602 if _bcbb ==nil {return _cdaf ,nil ;};if _fbca ==nil {_bdbd :=TraceToDirectObject (_bcbb .Get ("D\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0072\u006d\u0073"));if _bdbd !=nil {switch _efgfdg :=_bdbd .(type ){case *PdfObjectDictionary :_fbca =_efgfdg ;case *PdfObjectArray :if _efgfdg .Len ()==1{if _gac ,_efcdd :=GetDict (_efgfdg .Get (0)); 1603 _efcdd {_fbca =_gac ;};};default:_df .Log .Error ("\u0044\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0072\u006d\u0073\u0020\u006e\u006f\u0074 \u0061 \u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061\u0072\u0079\u0020\u0025\u0023\u0076",_bdbd );return nil ,_a .New ("\u0069\u006e\u0076\u0061li\u0064\u0020\u0044\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0072\u006d\u0073"); 1604 };};if _fbca ==nil {_df .Log .Error ("\u0044\u0065c\u006f\u0064\u0065\u0050\u0061\u0072\u006d\u0073\u0020\u006e\u006f\u0074\u0020\u0073\u0070\u0065\u0063\u0069\u0066\u0069\u0065\u0064 %\u0023\u0076",_bdbd );return nil ,_a .New ("\u0069\u006e\u0076\u0061li\u0064\u0020\u0044\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0072\u006d\u0073"); 1605 };};if _ccddd ,_bgace :=GetNumberAsInt64 (_fbca .Get ("\u004b"));_bgace ==nil {_cdaf .K =int (_ccddd );};if _dec ,_eedbg :=GetNumberAsInt64 (_fbca .Get ("\u0043o\u006c\u0075\u006d\u006e\u0073"));_eedbg ==nil {_cdaf .Columns =int (_dec );}else {_cdaf .Columns =1728; 1606 };if _fcag ,_cfed :=GetNumberAsInt64 (_fbca .Get ("\u0042\u006c\u0061\u0063\u006b\u0049\u0073\u0031"));_cfed ==nil {_cdaf .BlackIs1 =_fcag > 0;}else {if _bdae ,_fdcb :=GetBoolVal (_fbca .Get ("\u0042\u006c\u0061\u0063\u006b\u0049\u0073\u0031"));_fdcb {_cdaf .BlackIs1 =_bdae ; 1607 }else {if _cfbbf ,_bfd :=GetArray (_fbca .Get ("\u0044\u0065\u0063\u006f\u0064\u0065"));_bfd {_gcfd ,_dfdd :=_cfbbf .ToIntegerArray ();if _dfdd ==nil {_cdaf .BlackIs1 =_gcfd [0]==1&&_gcfd [1]==0;};};};};if _fecf ,_cacd :=GetNumberAsInt64 (_fbca .Get ("\u0045\u006ec\u006f\u0064\u0065d\u0042\u0079\u0074\u0065\u0041\u006c\u0069\u0067\u006e")); 1608 _cacd ==nil {_cdaf .EncodedByteAlign =_fecf > 0;}else {if _faff ,_cbfa :=GetBoolVal (_fbca .Get ("\u0045\u006ec\u006f\u0064\u0065d\u0042\u0079\u0074\u0065\u0041\u006c\u0069\u0067\u006e"));_cbfa {_cdaf .EncodedByteAlign =_faff ;};};if _dgbd ,_adba :=GetNumberAsInt64 (_fbca .Get ("\u0045n\u0064\u004f\u0066\u004c\u0069\u006ee")); 1609 _adba ==nil {_cdaf .EndOfLine =_dgbd > 0;}else {if _gdgde ,_cgdb :=GetBoolVal (_fbca .Get ("\u0045n\u0064\u004f\u0066\u004c\u0069\u006ee"));_cgdb {_cdaf .EndOfLine =_gdgde ;};};if _edbb ,_bfed :=GetNumberAsInt64 (_fbca .Get ("\u0052\u006f\u0077\u0073")); 1610 _bfed ==nil {_cdaf .Rows =int (_edbb );};_cdaf .EndOfBlock =true ;if _fdcab ,_dadaa :=GetNumberAsInt64 (_fbca .Get ("\u0045\u006e\u0064\u004f\u0066\u0042\u006c\u006f\u0063\u006b"));_dadaa ==nil {_cdaf .EndOfBlock =_fdcab > 0;}else {if _bafe ,_cgff :=GetBoolVal (_fbca .Get ("\u0045\u006e\u0064\u004f\u0066\u0042\u006c\u006f\u0063\u006b")); 1611 _cgff {_cdaf .EndOfBlock =_bafe ;};};if _cfcb ,_gbed :=GetNumberAsInt64 (_fbca .Get ("\u0044\u0061\u006d\u0061ge\u0064\u0052\u006f\u0077\u0073\u0042\u0065\u0066\u006f\u0072\u0065\u0045\u0072\u0072o\u0072"));_gbed !=nil {_cdaf .DamagedRowsBeforeError =int (_cfcb ); 1612 };_df .Log .Trace ("\u0064\u0065\u0063\u006f\u0064\u0065\u0020\u0070\u0061\u0072\u0061\u006ds\u003a\u0020\u0025\u0073",_fbca .String ());return _cdaf ,nil ;}; 1613 1614 // Clear resets the dictionary to an empty state. 1615 func (_cebec *PdfObjectDictionary )Clear (){_cebec ._aggf =[]PdfObjectName {};_cebec ._ccfa =map[PdfObjectName ]PdfObject {};_cebec ._gfff =&_c .Mutex {};}; 1616 1617 // LZWEncoder provides LZW encoding/decoding functionality. 1618 type LZWEncoder struct{Predictor int ;BitsPerComponent int ; 1619 1620 // For predictors 1621 Columns int ;Colors int ; 1622 1623 // LZW algorithm setting. 1624 EarlyChange int ;};func (_dfc *PdfCrypt )decryptBytes (_fdab []byte ,_bgfg string ,_daf []byte )([]byte ,error ){_df .Log .Trace ("\u0044\u0065\u0063\u0072\u0079\u0070\u0074\u0020\u0062\u0079\u0074\u0065\u0073");_afe ,_ccef :=_dfc ._bde [_bgfg ];if !_ccef {return nil ,_ea .Errorf ("\u0075n\u006b\u006e\u006f\u0077n\u0020\u0063\u0072\u0079\u0070t\u0020f\u0069l\u0074\u0065\u0072\u0020\u0028\u0025\u0073)",_bgfg ); 1625 };return _afe .DecryptBytes (_fdab ,_daf );}; 1626 1627 // EncodeBytes encodes the image data using either Group3 or Group4 CCITT facsimile (fax) encoding. 1628 // `data` is expected to be 1 color component, 1 bit per component. It is also valid to provide 8 BPC, 1 CC image like 1629 // a standard go image Gray data. 1630 func (_gbcb *CCITTFaxEncoder )EncodeBytes (data []byte )([]byte ,error ){var _ceeg _cf .Gray ;switch len (data ){case _gbcb .Rows *_gbcb .Columns :_gagc ,_edcc :=_cf .NewImage (_gbcb .Columns ,_gbcb .Rows ,8,1,data ,nil ,nil );if _edcc !=nil {return nil ,_edcc ; 1631 };_ceeg =_gagc .(_cf .Gray );case (_gbcb .Columns *_gbcb .Rows )+7>>3:_aebf ,_cfee :=_cf .NewImage (_gbcb .Columns ,_gbcb .Rows ,1,1,data ,nil ,nil );if _cfee !=nil {return nil ,_cfee ;};_gbbfg :=_aebf .(*_cf .Monochrome );if _cfee =_gbbfg .AddPadding (); 1632 _cfee !=nil {return nil ,_cfee ;};_ceeg =_gbbfg ;default:if len (data )< _cf .BytesPerLine (_gbcb .Columns ,1,1)*_gbcb .Rows {return nil ,_a .New ("p\u0072\u006f\u0076\u0069\u0064\u0065d\u0020\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020i\u006e\u0070\u0075t\u0020d\u0061\u0074\u0061"); 1633 };_dcdc ,_ebag :=_cf .NewImage (_gbcb .Columns ,_gbcb .Rows ,1,1,data ,nil ,nil );if _ebag !=nil {return nil ,_ebag ;};_fffg :=_dcdc .(*_cf .Monochrome );_ceeg =_fffg ;};_gga :=make ([][]byte ,_gbcb .Rows );for _ecafd :=0;_ecafd < _gbcb .Rows ;_ecafd ++{_fdff :=make ([]byte ,_gbcb .Columns ); 1634 for _dddg :=0;_dddg < _gbcb .Columns ;_dddg ++{_feg :=_ceeg .GrayAt (_dddg ,_ecafd );_fdff [_dddg ]=_feg .Y >>7;};_gga [_ecafd ]=_fdff ;};_geee :=&_dc .Encoder {K :_gbcb .K ,Columns :_gbcb .Columns ,EndOfLine :_gbcb .EndOfLine ,EndOfBlock :_gbcb .EndOfBlock ,BlackIs1 :_gbcb .BlackIs1 ,DamagedRowsBeforeError :_gbcb .DamagedRowsBeforeError ,Rows :_gbcb .Rows ,EncodedByteAlign :_gbcb .EncodedByteAlign }; 1635 return _geee .Encode (_gga ),nil ;}; 1636 1637 // Append appends PdfObject(s) to the streams. 1638 func (_cdcg *PdfObjectStreams )Append (objects ...PdfObject ){if _cdcg ==nil {_df .Log .Debug ("\u0057\u0061\u0072\u006e\u0020-\u0020\u0041\u0074\u0074\u0065\u006d\u0070\u0074\u0020\u0074\u006f\u0020\u0061p\u0070\u0065\u006e\u0064\u0020\u0074\u006f\u0020\u0061\u0020\u006e\u0069\u006c\u0020\u0073\u0074\u0072\u0065\u0061\u006d\u0073"); 1639 return ;};_cdcg ._dgbb =append (_cdcg ._dgbb ,objects ...);}; 1640 1641 // String returns the state of the bool as "true" or "false". 1642 func (_dacc *PdfObjectBool )String ()string {if *_dacc {return "\u0074\u0072\u0075\u0065";};return "\u0066\u0061\u006cs\u0065";}; 1643 1644 // GetObjectNums returns a sorted list of object numbers of the PDF objects in the file. 1645 func (_ceee *PdfParser )GetObjectNums ()[]int {var _cagee []int ;for _ ,_gfacf :=range _ceee ._ggaf .ObjectMap {_cagee =append (_cagee ,_gfacf .ObjectNumber );};_g .Ints (_cagee );return _cagee ;}; 1646 1647 // PdfObjectStreams represents the primitive PDF object streams. 1648 // 7.5.7 Object Streams (page 45). 1649 type PdfObjectStreams struct{PdfObjectReference ;_dgbb []PdfObject ;}; 1650 1651 // MakeObjectStreams creates an PdfObjectStreams from a list of PdfObjects. 1652 func MakeObjectStreams (objects ...PdfObject )*PdfObjectStreams {return &PdfObjectStreams {_dgbb :objects };};func (_fbgf *PdfParser )parsePdfVersion ()(int ,int ,error ){var _bgage int64 =20;_gccc :=make ([]byte ,_bgage );_fbgf ._abdga .Seek (0,_gd .SeekStart ); 1653 _fbgf ._abdga .Read (_gccc );var _ddfg error ;var _eabc ,_bdcc int ;if _fegb :=_efdd .FindStringSubmatch (string (_gccc ));len (_fegb )< 3{if _eabc ,_bdcc ,_ddfg =_fbgf .seekPdfVersionTopDown ();_ddfg !=nil {_df .Log .Debug ("F\u0061\u0069\u006c\u0065\u0064\u0020\u0072\u0065\u0063\u006f\u0076\u0065\u0072\u0079\u0020\u002d\u0020\u0075n\u0061\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0066\u0069nd\u0020\u0076\u0065r\u0073i\u006f\u006e"); 1654 return 0,0,_ddfg ;};_fbgf ._abdga ,_ddfg =_cdacc (_fbgf ._abdga ,_fbgf .GetFileOffset ()-8);if _ddfg !=nil {return 0,0,_ddfg ;};}else {if _eabc ,_ddfg =_be .Atoi (_fegb [1]);_ddfg !=nil {return 0,0,_ddfg ;};if _bdcc ,_ddfg =_be .Atoi (_fegb [2]);_ddfg !=nil {return 0,0,_ddfg ; 1655 };_fbgf .SetFileOffset (0);};_fbgf ._gcec =_fd .NewReader (_fbgf ._abdga );_df .Log .Debug ("\u0050\u0064\u0066\u0020\u0076\u0065\u0072\u0073\u0069\u006f\u006e\u0020%\u0064\u002e\u0025\u0064",_eabc ,_bdcc );return _eabc ,_bdcc ,nil ;};func _efba (_edaf *PdfObjectStream ,_bbgg *PdfObjectDictionary )(*RunLengthEncoder ,error ){return NewRunLengthEncoder (),nil ; 1656 }; 1657 1658 // MakeStreamDict makes a new instance of an encoding dictionary for a stream object. 1659 func (_bbgc *JPXEncoder )MakeStreamDict ()*PdfObjectDictionary {return MakeDict ()}; 1660 1661 // MakeStringFromBytes creates an PdfObjectString from a byte array. 1662 // This is more natural than MakeString as `data` is usually not utf-8 encoded. 1663 func MakeStringFromBytes (data []byte )*PdfObjectString {return MakeString (string (data ))};func _fbea (_ade *_gb .StdEncryptDict ,_eac *PdfObjectDictionary )error {R ,_bbf :=_eac .Get ("\u0052").(*PdfObjectInteger );if !_bbf {return _a .New ("\u0065\u006e\u0063\u0072y\u0070\u0074\u0020\u0064\u0069\u0063\u0074\u0069\u006f\u006ea\u0072y\u0020\u006d\u0069\u0073\u0073\u0069\u006eg\u0020\u0052"); 1664 };if *R < 2||*R > 6{return _ea .Errorf ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0052 \u0028\u0025\u0064\u0029",*R );};_ade .R =int (*R );O ,_bbf :=_eac .GetString ("\u004f");if !_bbf {return _a .New ("\u0065\u006e\u0063\u0072y\u0070\u0074\u0020\u0064\u0069\u0063\u0074\u0069\u006f\u006ea\u0072y\u0020\u006d\u0069\u0073\u0073\u0069\u006eg\u0020\u004f"); 1665 };if _ade .R ==5||_ade .R ==6{if len (O )< 48{return _ea .Errorf ("\u004c\u0065\u006e\u0067th\u0028\u004f\u0029\u0020\u003c\u0020\u0034\u0038\u0020\u0028\u0025\u0064\u0029",len (O ));};}else if len (O )!=32{return _ea .Errorf ("L\u0065n\u0067\u0074\u0068\u0028\u004f\u0029\u0020\u0021=\u0020\u0033\u0032\u0020(%\u0064\u0029",len (O )); 1666 };_ade .O =[]byte (O );U ,_bbf :=_eac .GetString ("\u0055");if !_bbf {return _a .New ("\u0065\u006e\u0063\u0072y\u0070\u0074\u0020\u0064\u0069\u0063\u0074\u0069\u006f\u006ea\u0072y\u0020\u006d\u0069\u0073\u0073\u0069\u006eg\u0020\u0055");};if _ade .R ==5||_ade .R ==6{if len (U )< 48{return _ea .Errorf ("\u004c\u0065\u006e\u0067th\u0028\u0055\u0029\u0020\u003c\u0020\u0034\u0038\u0020\u0028\u0025\u0064\u0029",len (U )); 1667 };}else if len (U )!=32{_df .Log .Debug ("\u0057\u0061r\u006e\u0069\u006e\u0067\u003a\u0020\u004c\u0065\u006e\u0067\u0074\u0068\u0028\u0055\u0029\u0020\u0021\u003d\u0020\u0033\u0032\u0020(%\u0064\u0029",len (U ));};_ade .U =[]byte (U );if _ade .R >=5{OE ,_bgc :=_eac .GetString ("\u004f\u0045"); 1668 if !_bgc {return _a .New ("\u0065\u006ec\u0072\u0079\u0070\u0074\u0020\u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061\u0072\u0079\u0020\u006d\u0069\u0073\u0073\u0069\u006eg \u004f\u0045");}else if len (OE )!=32{return _ea .Errorf ("L\u0065\u006e\u0067\u0074h(\u004fE\u0029\u0020\u0021\u003d\u00203\u0032\u0020\u0028\u0025\u0064\u0029",len (OE )); 1669 };_ade .OE =[]byte (OE );UE ,_bgc :=_eac .GetString ("\u0055\u0045");if !_bgc {return _a .New ("\u0065\u006ec\u0072\u0079\u0070\u0074\u0020\u0064\u0069\u0063\u0074\u0069\u006f\u006e\u0061\u0072\u0079\u0020\u006d\u0069\u0073\u0073\u0069\u006eg \u0055\u0045"); 1670 }else if len (UE )!=32{return _ea .Errorf ("L\u0065\u006e\u0067\u0074h(\u0055E\u0029\u0020\u0021\u003d\u00203\u0032\u0020\u0028\u0025\u0064\u0029",len (UE ));};_ade .UE =[]byte (UE );};P ,_bbf :=_eac .Get ("\u0050").(*PdfObjectInteger );if !_bbf {return _a .New ("\u0065\u006e\u0063\u0072\u0079\u0070\u0074 \u0064\u0069\u0063t\u0069\u006f\u006e\u0061r\u0079\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0070\u0065\u0072\u006d\u0069\u0073\u0073\u0069\u006f\u006e\u0073\u0020\u0061\u0074\u0074\u0072"); 1671 };_ade .P =_gb .Permissions (*P );if _ade .R ==6{Perms ,_befd :=_eac .GetString ("\u0050\u0065\u0072m\u0073");if !_befd {return _a .New ("\u0065\u006e\u0063\u0072\u0079\u0070\u0074\u0020\u0064\u0069\u0063\u0074\u0069\u006f\u006ea\u0072y\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0050\u0065\u0072\u006d\u0073"); 1672 }else if len (Perms )!=16{return _ea .Errorf ("\u004ce\u006e\u0067\u0074\u0068\u0028\u0050\u0065\u0072\u006d\u0073\u0029 \u0021\u003d\u0020\u0031\u0036\u0020\u0028\u0025\u0064\u0029",len (Perms ));};_ade .Perms =[]byte (Perms );};if _efa ,_cab :=_eac .Get ("\u0045n\u0063r\u0079\u0070\u0074\u004d\u0065\u0074\u0061\u0064\u0061\u0074\u0061").(*PdfObjectBool ); 1673 _cab {_ade .EncryptMetadata =bool (*_efa );}else {_ade .EncryptMetadata =true ;};return nil ;};type encryptDict struct{Filter string ;V int ;SubFilter string ;Length int ;StmF string ;StrF string ;EFF string ;CF map[string ]_gc .FilterDict ;}; 1674 1675 // GetFilterName returns the name of the encoding filter. 1676 func (_eegg *JBIG2Encoder )GetFilterName ()string {return StreamEncodingFilterNameJBIG2 }; 1677 1678 // GetString is a helper for Get that returns a string value. 1679 // Returns false if the key is missing or a value is not a string. 1680 func (_ffebg *PdfObjectDictionary )GetString (key PdfObjectName )(string ,bool ){_acfc :=_ffebg .Get (key );if _acfc ==nil {return "",false ;};_adead ,_fdeca :=_acfc .(*PdfObjectString );if !_fdeca {return "",false ;};return _adead .Str (),true ;};func (_eecde *PdfParser )rebuildXrefTable ()error {_bfedg :=XrefTable {}; 1681 _bfedg .ObjectMap =map[int ]XrefObject {};_ggda :=make ([]int ,0,len (_eecde ._ggaf .ObjectMap ));for _fabf :=range _eecde ._ggaf .ObjectMap {_ggda =append (_ggda ,_fabf );};_g .Ints (_ggda );for _ ,_ddca :=range _ggda {_ecdge :=_eecde ._ggaf .ObjectMap [_ddca ]; 1682 _adda ,_ ,_cgda :=_eecde .lookupByNumberWrapper (_ddca ,false );if _cgda !=nil {_df .Log .Debug ("\u0045\u0052RO\u0052\u003a\u0020U\u006e\u0061\u0062\u006ce t\u006f l\u006f\u006f\u006b\u0020\u0075\u0070\u0020ob\u006a\u0065\u0063\u0074\u0020\u0028\u0025s\u0029",_cgda ); 1683 _df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0058\u0072\u0065\u0066\u0020\u0074\u0061\u0062\u006c\u0065\u0020\u0063\u006fm\u0070\u006c\u0065\u0074\u0065\u006c\u0079\u0020\u0062\u0072\u006f\u006b\u0065\u006e\u0020\u002d\u0020\u0061\u0074\u0074\u0065\u006d\u0070\u0074\u0069\u006e\u0067\u0020\u0074\u006f \u0072\u0065\u0070\u0061\u0069r\u0020"); 1684 _gdba ,_eddge :=_eecde .repairRebuildXrefsTopDown ();if _eddge !=nil {_df .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0046\u0061\u0069\u006c\u0065\u0064\u0020\u0078\u0072\u0065\u0066\u0020\u0072\u0065\u0062\u0075\u0069l\u0064\u0020\u0072\u0065\u0070a\u0069\u0072 \u0028\u0025\u0073\u0029",_eddge ); 1685 return _eddge ;};_eecde ._ggaf =*_gdba ;_df .Log .Debug ("\u0052e\u0070\u0061\u0069\u0072e\u0064\u0020\u0078\u0072\u0065f\u0020t\u0061b\u006c\u0065\u0020\u0062\u0075\u0069\u006ct");return nil ;};_cafc ,_gefc ,_cgda :=_ffe (_adda );if _cgda !=nil {return _cgda ; 1686 };_ecdge .ObjectNumber =int (_cafc );_ecdge .Generation =int (_gefc );_bfedg .ObjectMap [int (_cafc )]=_ecdge ;};_eecde ._ggaf =_bfedg ;_df .Log .Debug ("N\u0065w\u0020\u0078\u0072\u0065\u0066\u0020\u0074\u0061b\u006c\u0065\u0020\u0062ui\u006c\u0074"); 1687 _ed (_eecde ._ggaf );return nil ;}; 1688 1689 // GetFilterName returns the name of the encoding filter. 1690 func (_ded *DCTEncoder )GetFilterName ()string {return StreamEncodingFilterNameDCT };func _cfcd (_fafc *PdfObjectDictionary )(_edfa *_cf .ImageBase ){var (_becca *PdfObjectInteger ;_bfbb bool ;);if _becca ,_bfbb =_fafc .Get ("\u0057\u0069\u0064t\u0068").(*PdfObjectInteger ); 1691 _bfbb {_edfa =&_cf .ImageBase {Width :int (*_becca )};}else {return nil ;};if _becca ,_bfbb =_fafc .Get ("\u0048\u0065\u0069\u0067\u0068\u0074").(*PdfObjectInteger );_bfbb {_edfa .Height =int (*_becca );};if _becca ,_bfbb =_fafc .Get ("\u0042\u0069t\u0073\u0050\u0065r\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074").(*PdfObjectInteger ); 1692 _bfbb {_edfa .BitsPerComponent =int (*_becca );};if _becca ,_bfbb =_fafc .Get ("\u0043o\u006co\u0072\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074\u0073").(*PdfObjectInteger );_bfbb {_edfa .ColorComponents =int (*_becca );};return _edfa ;}; 1693 1694 // GetPreviousRevisionParser returns PdfParser for the previous version of the Pdf document. 1695 func (_gcfde *PdfParser )GetPreviousRevisionParser ()(*PdfParser ,error ){if _gcfde ._eaae ==0{return nil ,_a .New ("\u0074\u0068\u0069\u0073 i\u0073\u0020\u0066\u0069\u0072\u0073\u0074\u0020\u0072\u0065\u0076\u0069\u0073\u0069o\u006e");};if _cgdd ,_ebff :=_gcfde ._dgef [_gcfde ]; 1696 _ebff {return _cgdd ,nil ;};_eacf ,_caee :=_gcfde .GetPreviousRevisionReadSeeker ();if _caee !=nil {return nil ,_caee ;};_dfda ,_caee :=NewParser (_eacf );_dfda ._dgef =_gcfde ._dgef ;if _caee !=nil {return nil ,_caee ;};_gcfde ._dgef [_gcfde ]=_dfda ; 1697 return _dfda ,nil ;};func (_aagg *PdfParser )resolveReference (_dbgeae *PdfObjectReference )(PdfObject ,bool ,error ){_ggef ,_bcag :=_aagg .ObjCache [int (_dbgeae .ObjectNumber )];if _bcag {return _ggef ,true ,nil ;};_afad ,_fgeb :=_aagg .LookupByReference (*_dbgeae ); 1698 if _fgeb !=nil {return nil ,false ,_fgeb ;};_aagg .ObjCache [int (_dbgeae .ObjectNumber )]=_afad ;return _afad ,false ,nil ;}; 1699 1700 // PdfObjectReference represents the primitive PDF reference object. 1701 type PdfObjectReference struct{_egcg *PdfParser ;ObjectNumber int64 ;GenerationNumber int64 ;};const (JB2Generic JBIG2CompressionType =iota ;JB2SymbolCorrelation ;JB2SymbolRankHaus ;); 1702 1703 // EncodeJBIG2Image encodes 'img' into jbig2 encoded bytes stream, using default encoder settings. 1704 func (_fbbe *JBIG2Encoder )EncodeJBIG2Image (img *JBIG2Image )([]byte ,error ){const _debf ="c\u006f\u0072\u0065\u002eEn\u0063o\u0064\u0065\u004a\u0042\u0049G\u0032\u0049\u006d\u0061\u0067\u0065";if _aaag :=_fbbe .AddPageImage (img ,&_fbbe .DefaultPageSettings ); 1705 _aaag !=nil {return nil ,_dd .Wrap (_aaag ,_debf ,"");};return _fbbe .Encode ();};func (_cge *PdfCrypt )isDecrypted (_adb PdfObject )bool {_ ,_cgg :=_cge ._gee [_adb ];if _cgg {_df .Log .Trace ("\u0041\u006c\u0072\u0065\u0061\u0064\u0079\u0020\u0064\u0065\u0063\u0072y\u0070\u0074\u0065\u0064"); 1706 return true ;};switch _cff :=_adb .(type ){case *PdfObjectStream :if _cge ._bga .R !=5{if _cdd ,_eeb :=_cff .Get ("\u0054\u0079\u0070\u0065").(*PdfObjectName );_eeb &&*_cdd =="\u0058\u0052\u0065\u0066"{return true ;};};case *PdfIndirectObject :if _ ,_cgg =_cge ._becc [int (_cff .ObjectNumber )]; 1707 _cgg {return true ;};switch _ebgd :=_cff .PdfObject .(type ){case *PdfObjectDictionary :_efgb :=true ;for _ ,_ceec :=range _gbaad {if _ebgd .Get (_ceec )==nil {_efgb =false ;break ;};};if _efgb {return true ;};};};_df .Log .Trace ("\u004e\u006f\u0074\u0020\u0064\u0065\u0063\u0072\u0079\u0070\u0074\u0065d\u0020\u0079\u0065\u0074"); 1708 return false ;}; 1709 1710 // UpdateParams updates the parameter values of the encoder. 1711 func (_bcde *RawEncoder )UpdateParams (params *PdfObjectDictionary ){}; 1712 1713 // WriteString outputs the object as it is to be written to file. 1714 func (_cggd *PdfObjectNull )WriteString ()string {return "\u006e\u0075\u006c\u006c"}; 1715 1716 // NewFlateEncoder makes a new flate encoder with default parameters, predictor 1 and bits per component 8. 1717 func NewFlateEncoder ()*FlateEncoder {_cca :=&FlateEncoder {};_cca .Predictor =1;_cca .BitsPerComponent =8;_cca .Colors =1;_cca .Columns =1;return _cca ;};var _faed _c .Map ; 1718 1719 // GetStringBytes is like GetStringVal except that it returns the string as a []byte. 1720 // It is for convenience. 1721 func GetStringBytes (obj PdfObject )(_cedaa []byte ,_bce bool ){_adef ,_bce :=TraceToDirectObject (obj ).(*PdfObjectString );if _bce {return _adef .Bytes (),true ;};return ;};var _eggcd =_f .MustCompile ("\u0025\u0025\u0045\u004f\u0046\u003f"); 1722 1723 // DecodeBytes decodes a multi-encoded slice of bytes by passing it through the 1724 // DecodeBytes method of the underlying encoders. 1725 func (_bcgd *MultiEncoder )DecodeBytes (encoded []byte )([]byte ,error ){_edaa :=encoded ;var _fdec error ;for _ ,_bace :=range _bcgd ._gbgba {_df .Log .Trace ("\u004du\u006c\u0074i\u0020\u0045\u006e\u0063o\u0064\u0065\u0072 \u0044\u0065\u0063\u006f\u0064\u0065\u003a\u0020\u0041pp\u006c\u0079\u0069n\u0067\u0020F\u0069\u006c\u0074\u0065\u0072\u003a \u0025\u0076 \u0025\u0054",_bace ,_bace ); 1726 _edaa ,_fdec =_bace .DecodeBytes (_edaa );if _fdec !=nil {return nil ,_fdec ;};};return _edaa ,nil ;};const JB2ImageAutoThreshold =-1.0; 1727 1728 // ReadBytesAt reads byte content at specific offset and length within the PDF. 1729 func (_bfde *PdfParser )ReadBytesAt (offset ,len int64 )([]byte ,error ){_eccba :=_bfde .GetFileOffset ();_ ,_ddec :=_bfde ._abdga .Seek (offset ,_gd .SeekStart );if _ddec !=nil {return nil ,_ddec ;};_cfdf :=make ([]byte ,len );_ ,_ddec =_gd .ReadAtLeast (_bfde ._abdga ,_cfdf ,int (len )); 1730 if _ddec !=nil {return nil ,_ddec ;};_bfde .SetFileOffset (_eccba );return _cfdf ,nil ;}; 1731 1732 // DecodeStream decodes a multi-encoded stream by passing it through the 1733 // DecodeStream method of the underlying encoders. 1734 func (_gdfg *MultiEncoder )DecodeStream (streamObj *PdfObjectStream )([]byte ,error ){return _gdfg .DecodeBytes (streamObj .Stream );};func _cebed (_geafe uint ,_eddagc ,_gdbg float64 )float64 {return (_eddagc +(float64 (_geafe )*(_gdbg -_eddagc )/255))*255; 1735 }; 1736 1737 // DecodeBytes decodes a slice of JBIG2 encoded bytes and returns the results. 1738 func (_febce *JBIG2Encoder )DecodeBytes (encoded []byte )([]byte ,error ){return _db .DecodeBytes (encoded ,_gg .Parameters {},_febce .Globals );}; 1739 1740 // HeaderPosition gets the file header position. 1741 func (_fbab ParserMetadata )HeaderPosition ()int {return _fbab ._ecef }; 1742 1743 // HeaderCommentBytes gets the header comment bytes. 1744 func (_bgaa ParserMetadata )HeaderCommentBytes ()[4]byte {return _bgaa ._cdef }; 1745 1746 // DecodeBytes decodes a slice of DCT encoded bytes and returns the result. 1747 func (_gdd *DCTEncoder )DecodeBytes (encoded []byte )([]byte ,error ){_gcga :=_d .NewReader (encoded );_daad ,_fge :=_bg .Decode (_gcga );if _fge !=nil {_df .Log .Debug ("\u0045r\u0072\u006f\u0072\u0020\u0064\u0065\u0063\u006f\u0064\u0069\u006eg\u0020\u0069\u006d\u0061\u0067\u0065\u003a\u0020\u0025\u0073",_fge ); 1748 return nil ,_fge ;};_gbad :=_daad .Bounds ();var _egfa =make ([]byte ,_gbad .Dx ()*_gbad .Dy ()*_gdd .ColorComponents *_gdd .BitsPerComponent /8);_aedb :=0;switch _gdd .ColorComponents {case 1:_bcbaa :=[]float64 {_gdd .Decode [0],_gdd .Decode [1]};for _fbfc :=_gbad .Min .Y ; 1749 _fbfc < _gbad .Max .Y ;_fbfc ++{for _eccb :=_gbad .Min .X ;_eccb < _gbad .Max .X ;_eccb ++{_fef :=_daad .At (_eccb ,_fbfc );if _gdd .BitsPerComponent ==16{_afgb ,_gfad :=_fef .(_fe .Gray16 );if !_gfad {return nil ,_a .New ("\u0063\u006fl\u006f\u0072\u0020t\u0079\u0070\u0065\u0020\u0065\u0072\u0072\u006f\u0072"); 1750 };_bggf :=_cebed (uint (_afgb .Y >>8),_bcbaa [0],_bcbaa [1]);_bafa :=_cebed (uint (_afgb .Y ),_bcbaa [0],_bcbaa [1]);_egfa [_aedb ]=byte (_bggf );_aedb ++;_egfa [_aedb ]=byte (_bafa );_aedb ++;}else {_cdbc ,_agcd :=_fef .(_fe .Gray );if !_agcd {return nil ,_a .New ("\u0063\u006fl\u006f\u0072\u0020t\u0079\u0070\u0065\u0020\u0065\u0072\u0072\u006f\u0072"); 1751 };_egfa [_aedb ]=byte (_cebed (uint (_cdbc .Y ),_bcbaa [0],_bcbaa [1]));_aedb ++;};};};case 3:_fdce :=[]float64 {_gdd .Decode [0],_gdd .Decode [1]};_ffcg :=[]float64 {_gdd .Decode [2],_gdd .Decode [3]};_efdg :=[]float64 {_gdd .Decode [4],_gdd .Decode [5]}; 1752 for _ebfd :=_gbad .Min .Y ;_ebfd < _gbad .Max .Y ;_ebfd ++{for _dfbf :=_gbad .Min .X ;_dfbf < _gbad .Max .X ;_dfbf ++{_agebc :=_daad .At (_dfbf ,_ebfd );if _gdd .BitsPerComponent ==16{_ddcg ,_bdcd :=_agebc .(_fe .RGBA64 );if !_bdcd {return nil ,_a .New ("\u0063\u006fl\u006f\u0072\u0020t\u0079\u0070\u0065\u0020\u0065\u0072\u0072\u006f\u0072"); 1753 };_dcff :=_cebed (uint (_ddcg .R >>8),_fdce [0],_fdce [1]);_cfbd :=_cebed (uint (_ddcg .R ),_fdce [0],_fdce [1]);_gaacf :=_cebed (uint (_ddcg .G >>8),_ffcg [0],_ffcg [1]);_aeg :=_cebed (uint (_ddcg .G ),_ffcg [0],_ffcg [1]);_gdfd :=_cebed (uint (_ddcg .B >>8),_efdg [0],_efdg [1]); 1754 _eabd :=_cebed (uint (_ddcg .B ),_efdg [0],_efdg [1]);_egfa [_aedb ]=byte (_dcff );_aedb ++;_egfa [_aedb ]=byte (_cfbd );_aedb ++;_egfa [_aedb ]=byte (_gaacf );_aedb ++;_egfa [_aedb ]=byte (_aeg );_aedb ++;_egfa [_aedb ]=byte (_gdfd );_aedb ++;_egfa [_aedb ]=byte (_eabd ); 1755 _aedb ++;}else {_ecgg ,_deb :=_agebc .(_fe .RGBA );if _deb {_eace :=_cebed (uint (_ecgg .R ),_fdce [0],_fdce [1]);_eaeg :=_cebed (uint (_ecgg .G ),_ffcg [0],_ffcg [1]);_fdee :=_cebed (uint (_ecgg .B ),_efdg [0],_efdg [1]);_egfa [_aedb ]=byte (_eace );_aedb ++; 1756 _egfa [_aedb ]=byte (_eaeg );_aedb ++;_egfa [_aedb ]=byte (_fdee );_aedb ++;}else {_gbbf ,_dbge :=_agebc .(_fe .YCbCr );if !_dbge {return nil ,_a .New ("\u0063\u006fl\u006f\u0072\u0020t\u0079\u0070\u0065\u0020\u0065\u0072\u0072\u006f\u0072");};_ccbf ,_dbgg ,_cdcd ,_ :=_gbbf .RGBA (); 1757 _cffe :=_cebed (uint (_ccbf >>8),_fdce [0],_fdce [1]);_cebd :=_cebed (uint (_dbgg >>8),_ffcg [0],_ffcg [1]);_ccbe :=_cebed (uint (_cdcd >>8),_efdg [0],_efdg [1]);_egfa [_aedb ]=byte (_cffe );_aedb ++;_egfa [_aedb ]=byte (_cebd );_aedb ++;_egfa [_aedb ]=byte (_ccbe ); 1758 _aedb ++;};};};};case 4:_bfb :=[]float64 {_gdd .Decode [0],_gdd .Decode [1]};_gbc :=[]float64 {_gdd .Decode [2],_gdd .Decode [3]};_abfg :=[]float64 {_gdd .Decode [4],_gdd .Decode [5]};_aeba :=[]float64 {_gdd .Decode [6],_gdd .Decode [7]};for _dadab :=_gbad .Min .Y ; 1759 _dadab < _gbad .Max .Y ;_dadab ++{for _bdeg :=_gbad .Min .X ;_bdeg < _gbad .Max .X ;_bdeg ++{_fafd :=_daad .At (_bdeg ,_dadab );_efda ,_abb :=_fafd .(_fe .CMYK );if !_abb {return nil ,_a .New ("\u0063\u006fl\u006f\u0072\u0020t\u0079\u0070\u0065\u0020\u0065\u0072\u0072\u006f\u0072"); 1760 };_efgf :=255-_cebed (uint (_efda .C ),_bfb [0],_bfb [1]);_cabd :=255-_cebed (uint (_efda .M ),_gbc [0],_gbc [1]);_geaae :=255-_cebed (uint (_efda .Y ),_abfg [0],_abfg [1]);_eeab :=255-_cebed (uint (_efda .K ),_aeba [0],_aeba [1]);_egfa [_aedb ]=byte (_efgf ); 1761 _aedb ++;_egfa [_aedb ]=byte (_cabd );_aedb ++;_egfa [_aedb ]=byte (_geaae );_aedb ++;_egfa [_aedb ]=byte (_eeab );_aedb ++;};};};return _egfa ,nil ;}; 1762 1763 // HasNonConformantStream implements core.ParserMetadata. 1764 func (_aed ParserMetadata )HasNonConformantStream ()bool {return _aed ._ecg }; 1765 1766 // PdfObjectName represents the primitive PDF name object. 1767 type PdfObjectName string ; 1768 1769 // Update updates multiple keys and returns the dictionary back so can be used in a chained fashion. 1770 func (_gaebd *PdfObjectDictionary )Update (objmap map[string ]PdfObject )*PdfObjectDictionary {_gaebd ._gfff .Lock ();defer _gaebd ._gfff .Unlock ();for _baba ,_fegg :=range objmap {_gaebd .setWithLock (PdfObjectName (_baba ),_fegg ,false );};return _gaebd ; 1771 }; 1772 1773 // EncodeBytes JPX encodes the passed in slice of bytes. 1774 func (_cfde *JPXEncoder )EncodeBytes (data []byte )([]byte ,error ){_df .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u003a\u0020\u0041t\u0074\u0065\u006dpt\u0069\u006e\u0067\u0020\u0074\u006f \u0075\u0073\u0065\u0020\u0075\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064 \u0065\u006e\u0063\u006f\u0064\u0069\u006e\u0067 \u0025\u0073",_cfde .GetFilterName ()); 1775 return data ,ErrNoJPXDecode ;}; 1776 1777 // PdfCrypt provides PDF encryption/decryption support. 1778 // The PDF standard supports encryption of strings and streams (Section 7.6). 1779 type PdfCrypt struct{_dgc encryptDict ;_bga _gb .StdEncryptDict ;_geg string ;_edb []byte ;_gee map[PdfObject ]bool ;_fag map[PdfObject ]bool ;_age bool ;_bde cryptFilters ;_ddfb string ;_fbe string ;_edd *PdfParser ;_becc map[int ]struct{};};func _ceda (_ggg _gc .Filter ,_ccdb _gb .AuthEvent )*PdfObjectDictionary {if _ccdb ==""{_ccdb =_gb .EventDocOpen ; 1780 };_efg :=MakeDict ();_efg .Set ("\u0054\u0079\u0070\u0065",MakeName ("C\u0072\u0079\u0070\u0074\u0046\u0069\u006c\u0074\u0065\u0072"));_efg .Set ("\u0041u\u0074\u0068\u0045\u0076\u0065\u006et",MakeName (string (_ccdb )));_efg .Set ("\u0043\u0046\u004d",MakeName (_ggg .Name ())); 1781 _efg .Set ("\u004c\u0065\u006e\u0067\u0074\u0068",MakeInteger (int64 (_ggg .KeyLength ())));return _efg ;}; 1782 1783 // NewLZWEncoder makes a new LZW encoder with default parameters. 1784 func NewLZWEncoder ()*LZWEncoder {_dega :=&LZWEncoder {};_dega .Predictor =1;_dega .BitsPerComponent =8;_dega .Colors =1;_dega .Columns =1;_dega .EarlyChange =1;return _dega ;}; 1785 1786 // Get returns the PdfObject corresponding to the specified key. 1787 // Returns a nil value if the key is not set. 1788 func (_accbc *PdfObjectDictionary )Get (key PdfObjectName )PdfObject {_accbc ._gfff .Lock ();defer _accbc ._gfff .Unlock ();_cdfb ,_ccce :=_accbc ._ccfa [key ];if !_ccce {return nil ;};return _cdfb ;}; 1789 1790 // GetAsFloat64Slice returns the array as []float64 slice. 1791 // Returns an error if not entirely numeric (only PdfObjectIntegers, PdfObjectFloats). 1792 func (_gcdb *PdfObjectArray )GetAsFloat64Slice ()([]float64 ,error ){var _fgbc []float64 ;for _ ,_daded :=range _gcdb .Elements (){_abfe ,_eccca :=GetNumberAsFloat (TraceToDirectObject (_daded ));if _eccca !=nil {return nil ,_ea .Errorf ("\u0061\u0072\u0072\u0061\u0079\u0020\u0065\u006c\u0065\u006d\u0065n\u0074\u0020\u006e\u006f\u0074\u0020\u0061\u0020\u006e\u0075m\u0062\u0065\u0072"); 1793 };_fgbc =append (_fgbc ,_abfe );};return _fgbc ,nil ;}; 1794 1795 // ParserMetadata gets the pdf parser metadata. 1796 func (_edeg *PdfParser )ParserMetadata ()(ParserMetadata ,error ){if !_edeg ._dcad {return ParserMetadata {},_ea .Errorf ("\u0070\u0061\u0072\u0073\u0065r\u0020\u0077\u0061\u0073\u0020\u006e\u006f\u0074\u0020\u006d\u0061\u0072\u006be\u0064\u0020\u0066\u006f\u0072\u0020\u0067\u0065\u0074\u0074\u0069\u006e\u0067\u0020\u0064\u0065\u0074\u0061\u0069\u006c\u0065\u0064\u0020\u006d\u0065\u0074\u0061\u0064\u0061\u0074a"); 1797 };return _edeg ._ffge ,nil ;}; 1798 1799 // GetParser returns the parser for lazy-loading or compare references. 1800 func (_dcggc *PdfObjectReference )GetParser ()*PdfParser {return _dcggc ._egcg }; 1801 1802 // EncodeBytes returns the passed in slice of bytes. 1803 // The purpose of the method is to satisfy the StreamEncoder interface. 1804 func (_dfca *RawEncoder )EncodeBytes (data []byte )([]byte ,error ){return data ,nil };const (XrefTypeTableEntry xrefType =iota ;XrefTypeObjectStream xrefType =iota ;); 1805 1806 // String returns a string representation of `name`. 1807 func (_cef *PdfObjectName )String ()string {return string (*_cef )}; 1808 1809 // AddEncoder adds the passed in encoder to the underlying encoder slice. 1810 func (_aadb *MultiEncoder )AddEncoder (encoder StreamEncoder ){_aadb ._gbgba =append (_aadb ._gbgba ,encoder );}; 1811 1812 // Encrypt an object with specified key. For numbered objects, 1813 // the key argument is not used and a new one is generated based 1814 // on the object and generation number. 1815 // Traverses through all the subobjects (recursive). 1816 // 1817 // Does not look up references.. That should be done prior to calling. 1818 func (_bcba *PdfCrypt )Encrypt (obj PdfObject ,parentObjNum ,parentGenNum int64 )error {if _bcba .isEncrypted (obj ){return nil ;};switch _eddg :=obj .(type ){case *PdfIndirectObject :_bcba ._fag [_eddg ]=true ;_df .Log .Trace ("\u0045\u006e\u0063\u0072\u0079\u0070\u0074\u0069\u006e\u0067 \u0069\u006e\u0064\u0069\u0072\u0065\u0063t\u0020\u0025\u0064\u0020\u0025\u0064\u0020\u006f\u0062\u006a\u0021",_eddg .ObjectNumber ,_eddg .GenerationNumber ); 1819 _dgda :=_eddg .ObjectNumber ;_cacf :=_eddg .GenerationNumber ;_bae :=_bcba .Encrypt (_eddg .PdfObject ,_dgda ,_cacf );if _bae !=nil {return _bae ;};return nil ;case *PdfObjectStream :_bcba ._fag [_eddg ]=true ;_geaa :=_eddg .PdfObjectDictionary ;if _dgf ,_aba :=_geaa .Get ("\u0054\u0079\u0070\u0065").(*PdfObjectName ); 1820 _aba &&*_dgf =="\u0058\u0052\u0065\u0066"{return nil ;};_acdg :=_eddg .ObjectNumber ;_efef :=_eddg .GenerationNumber ;_df .Log .Trace ("\u0045n\u0063\u0072\u0079\u0070t\u0069\u006e\u0067\u0020\u0073t\u0072e\u0061m\u0020\u0025\u0064\u0020\u0025\u0064\u0020!",_acdg ,_efef ); 1821 _bcc :=_gfb ;if _bcba ._dgc .V >=4{_bcc =_bcba ._ddfb ;_df .Log .Trace ("\u0074\u0068\u0069\u0073.s\u0074\u0072\u0065\u0061\u006d\u0046\u0069\u006c\u0074\u0065\u0072\u0020\u003d\u0020%\u0073",_bcba ._ddfb );if _eae ,_bdf :=_geaa .Get ("\u0046\u0069\u006c\u0074\u0065\u0072").(*PdfObjectArray ); 1822 _bdf {if _dbcd ,_cfa :=GetName (_eae .Get (0));_cfa {if *_dbcd =="\u0043\u0072\u0079p\u0074"{_bcc ="\u0049\u0064\u0065\u006e\u0074\u0069\u0074\u0079";if _eec ,_adfb :=_geaa .Get ("D\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0072\u006d\u0073").(*PdfObjectDictionary ); 1823 _adfb {if _ddae ,_gfbg :=_eec .Get ("\u004e\u0061\u006d\u0065").(*PdfObjectName );_gfbg {if _ ,_cdf :=_bcba ._bde [string (*_ddae )];_cdf {_df .Log .Trace ("\u0055\u0073\u0069\u006eg \u0073\u0074\u0072\u0065\u0061\u006d\u0020\u0066\u0069\u006c\u0074\u0065\u0072\u0020%\u0073",*_ddae ); 1824 _bcc =string (*_ddae );};};};};};};_df .Log .Trace ("\u0077\u0069\u0074\u0068\u0020\u0025\u0073\u0020\u0066i\u006c\u0074\u0065\u0072",_bcc );if _bcc =="\u0049\u0064\u0065\u006e\u0074\u0069\u0074\u0079"{return nil ;};};_efcg :=_bcba .Encrypt (_eddg .PdfObjectDictionary ,_acdg ,_efef ); 1825 if _efcg !=nil {return _efcg ;};_cae ,_efcg :=_bcba .makeKey (_bcc ,uint32 (_acdg ),uint32 (_efef ),_bcba ._edb );if _efcg !=nil {return _efcg ;};_eddg .Stream ,_efcg =_bcba .encryptBytes (_eddg .Stream ,_bcc ,_cae );if _efcg !=nil {return _efcg ;};_geaa .Set ("\u004c\u0065\u006e\u0067\u0074\u0068",MakeInteger (int64 (len (_eddg .Stream )))); 1826 return nil ;case *PdfObjectString :_df .Log .Trace ("\u0045n\u0063r\u0079\u0070\u0074\u0069\u006eg\u0020\u0073t\u0072\u0069\u006e\u0067\u0021");_egba :=_gfb ;if _bcba ._dgc .V >=4{_df .Log .Trace ("\u0077\u0069\u0074\u0068\u0020\u0025\u0073\u0020\u0066i\u006c\u0074\u0065\u0072",_bcba ._fbe ); 1827 if _bcba ._fbe =="\u0049\u0064\u0065\u006e\u0074\u0069\u0074\u0079"{return nil ;};_egba =_bcba ._fbe ;};_cfd ,_abe :=_bcba .makeKey (_egba ,uint32 (parentObjNum ),uint32 (parentGenNum ),_bcba ._edb );if _abe !=nil {return _abe ;};_gcd :=_eddg .Str ();_ddaa :=make ([]byte ,len (_gcd )); 1828 for _bgb :=0;_bgb < len (_gcd );_bgb ++{_ddaa [_bgb ]=_gcd [_bgb ];};_df .Log .Trace ("\u0045n\u0063\u0072\u0079\u0070\u0074\u0020\u0073\u0074\u0072\u0069\u006eg\u003a\u0020\u0025\u0073\u0020\u003a\u0020\u0025\u0020\u0078",_ddaa ,_ddaa );_ddaa ,_abe =_bcba .encryptBytes (_ddaa ,_egba ,_cfd ); 1829 if _abe !=nil {return _abe ;};_eddg ._bcfef =string (_ddaa );return nil ;case *PdfObjectArray :for _ ,_baeg :=range _eddg .Elements (){_dgcag :=_bcba .Encrypt (_baeg ,parentObjNum ,parentGenNum );if _dgcag !=nil {return _dgcag ;};};return nil ;case *PdfObjectDictionary :_aebg :=false ; 1830 if _aacc :=_eddg .Get ("\u0054\u0079\u0070\u0065");_aacc !=nil {_ddfbf ,_cbb :=_aacc .(*PdfObjectName );if _cbb &&*_ddfbf =="\u0053\u0069\u0067"{_aebg =true ;};};for _ ,_gaaf :=range _eddg .Keys (){_faa :=_eddg .Get (_gaaf );if _aebg &&string (_gaaf )=="\u0043\u006f\u006e\u0074\u0065\u006e\u0074\u0073"{continue ; 1831 };if string (_gaaf )!="\u0050\u0061\u0072\u0065\u006e\u0074"&&string (_gaaf )!="\u0050\u0072\u0065\u0076"&&string (_gaaf )!="\u004c\u0061\u0073\u0074"{_gbb :=_bcba .Encrypt (_faa ,parentObjNum ,parentGenNum );if _gbb !=nil {return _gbb ;};};};return nil ; 1832 };return nil ;}; 1833 1834 // SetImage sets the image base for given flate encoder. 1835 func (_cgac *FlateEncoder )SetImage (img *_cf .ImageBase ){_cgac ._dade =img };func (_abeaf *ASCII85Encoder )base256Tobase85 (_addd uint32 )[5]byte {_beba :=[5]byte {0,0,0,0,0};_ceg :=_addd ;for _abac :=0;_abac < 5;_abac ++{_bfba :=uint32 (1);for _aaaa :=0; 1836 _aaaa < 4-_abac ;_aaaa ++{_bfba *=85;};_fdba :=_ceg /_bfba ;_ceg =_ceg %_bfba ;_beba [_abac ]=byte (_fdba );};return _beba ;}; 1837 1838 // PdfParser parses a PDF file and provides access to the object structure of the PDF. 1839 type PdfParser struct{_bdbfe Version ;_abdga _gd .ReadSeeker ;_gcec *_fd .Reader ;_gccgc int64 ;_ggaf XrefTable ;_cdca int64 ;_dfbg *xrefType ;_aeede objectStreams ;_aagb *PdfObjectDictionary ;_acg *PdfCrypt ;_bgafa *PdfIndirectObject ;_fbae bool ;ObjCache objectCache ; 1840 _dbeed map[int ]bool ;_dbaad map[int64 ]bool ;_ffge ParserMetadata ;_dcad bool ;_decff []int64 ;_eaae int ;_cegb bool ;_adcg int64 ;_dgef map[*PdfParser ]*PdfParser ;_bddb []*PdfParser ;};