diff options
| author | leshe4ka46 <alex9102naid1@ya.ru> | 2025-10-19 14:47:59 +0300 |
|---|---|---|
| committer | leshe4ka46 <alex9102naid1@ya.ru> | 2025-10-19 14:47:59 +0300 |
| commit | e17a425dfb3382310fb5863f516dacdca9f44956 (patch) | |
| tree | 7babb3048d0eb20aa1e68e9b29c2acfa794ab96f /unipdf/internal/jbig2/jbig2.go | |
| parent | 091963a50c3bb2926f559f01c49e8f5bd03d2bfd (diff) | |
fuck the unipdf licencing
Diffstat (limited to 'unipdf/internal/jbig2/jbig2.go')
| -rw-r--r-- | unipdf/internal/jbig2/jbig2.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/unipdf/internal/jbig2/jbig2.go b/unipdf/internal/jbig2/jbig2.go new file mode 100644 index 0000000..9114a49 --- /dev/null +++ b/unipdf/internal/jbig2/jbig2.go @@ -0,0 +1,17 @@ +// +// Copyright 2020 FoxyUtils ehf. All rights reserved. +// +// This is a commercial product and requires a license to operate. +// A trial license can be obtained at https://unidoc.io +// +// DO NOT EDIT: generated by unitwist Go source code obfuscator. +// +// Use of this source code is governed by the UniDoc End User License Agreement +// terms that can be accessed at https://unidoc.io/eula/ + +package jbig2 ;import (_d "github.com/unidoc/unipdf/v4/internal/bitwise";_gd "github.com/unidoc/unipdf/v4/internal/jbig2/decoder";_ee "github.com/unidoc/unipdf/v4/internal/jbig2/document";_af "github.com/unidoc/unipdf/v4/internal/jbig2/document/segments"; +_e "github.com/unidoc/unipdf/v4/internal/jbig2/errors";_a "sort";);func DecodeBytes (encoded []byte ,parameters _gd .Parameters ,globals ...Globals )([]byte ,error ){var _gf Globals ;if len (globals )> 0{_gf =globals [0];};_c ,_f :=_gd .Decode (encoded ,parameters ,_gf .ToDocumentGlobals ()); +if _f !=nil {return nil ,_f ;};return _c .DecodeNextPage ();};func DecodeGlobals (encoded []byte )(Globals ,error ){const _fd ="\u0044\u0065\u0063\u006f\u0064\u0065\u0047\u006c\u006f\u0062\u0061\u006c\u0073";_ga :=_d .NewReader (encoded );_gdg ,_ea :=_ee .DecodeDocument (_ga ,nil ); +if _ea !=nil {return nil ,_e .Wrap (_ea ,_fd ,"");};if _gdg .GlobalSegments ==nil ||(_gdg .GlobalSegments .Segments ==nil ){return nil ,_e .Error (_fd ,"\u006eo\u0020\u0067\u006c\u006f\u0062\u0061\u006c\u0020\u0073\u0065\u0067m\u0065\u006e\u0074\u0073\u0020\u0066\u006f\u0075\u006e\u0064"); +};_cg :=Globals {};for _ ,_cd :=range _gdg .GlobalSegments .Segments {_cg [int (_cd .SegmentNumber )]=_cd ;};return _cg ,nil ;};type Globals map[int ]*_af .Header ;func (_de Globals )ToDocumentGlobals ()*_ee .Globals {if _de ==nil {return nil ;};_b :=[]*_af .Header {}; +for _ ,_gb :=range _de {_b =append (_b ,_gb );};_a .Slice (_b ,func (_ad ,_ed int )bool {return _b [_ad ].SegmentNumber < _b [_ed ].SegmentNumber });return &_ee .Globals {Segments :_b };};
\ No newline at end of file |
