2022-12-15 21:59:56 +00:00

22 lines
3.6 KiB
Go

//
// Copyright 2020 FoxyUtils ehf. All rights reserved.
//
// This is a commercial product and requires a license to operate.
// A trial license can be obtained at https://unidoc.io
//
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
//
// Use of this source code is governed by the UniDoc End User License Agreement
// terms that can be accessed at https://unidoc.io/eula/
package decoder ;import (_g "github.com/unidoc/unipdf/v3/internal/bitwise";_f "github.com/unidoc/unipdf/v3/internal/jbig2/bitmap";_ga "github.com/unidoc/unipdf/v3/internal/jbig2/document";_b "github.com/unidoc/unipdf/v3/internal/jbig2/errors";_a "image";
);func (_bd *Decoder )DecodeNextPage ()([]byte ,error ){_bd ._e ++;_gb :=_bd ._e ;return _bd .decodePage (_gb );};func (_ac *Decoder )DecodePageImage (pageNumber int )(_a .Image ,error ){const _ab ="\u0064\u0065\u0063od\u0065\u0072\u002e\u0044\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0067\u0065\u0049\u006d\u0061\u0067\u0065";
_fa ,_dg :=_ac .decodePageImage (pageNumber );if _dg !=nil {return nil ,_b .Wrap (_dg ,_ab ,"");};return _fa ,nil ;};func (_gbb *Decoder )decodePage (_ff int )([]byte ,error ){const _c ="\u0064\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0067\u0065";if _ff < 0{return nil ,_b .Errorf (_c ,"\u0069n\u0076\u0061\u006c\u0069d\u0020\u0070\u0061\u0067\u0065 \u006eu\u006db\u0065\u0072\u003a\u0020\u0027\u0025\u0064'",_ff );
};if _ff > int (_gbb ._bg .NumberOfPages ){return nil ,_b .Errorf (_c ,"p\u0061\u0067\u0065\u003a\u0020\u0027%\u0064\u0027\u0020\u006e\u006f\u0074 \u0066\u006f\u0075\u006e\u0064\u0020\u0069n\u0020\u0074\u0068\u0065\u0020\u0064\u0065\u0063\u006f\u0064e\u0072",_ff );
};_ge ,_fd :=_gbb ._bg .GetPage (_ff );if _fd !=nil {return nil ,_b .Wrap (_fd ,_c ,"");};_fde ,_fd :=_ge .GetBitmap ();if _fd !=nil {return nil ,_b .Wrap (_fd ,_c ,"");};_fde .InverseData ();if !_gbb ._aa .UnpaddedData {return _fde .Data ,nil ;};return _fde .GetUnpaddedData ();
};func (_bf *Decoder )DecodePage (pageNumber int )([]byte ,error ){return _bf .decodePage (pageNumber )};func Decode (input []byte ,parameters Parameters ,globals *_ga .Globals )(*Decoder ,error ){_fg :=_g .NewReader (input );_eg ,_fga :=_ga .DecodeDocument (_fg ,globals );
if _fga !=nil {return nil ,_fga ;};return &Decoder {_ad :_fg ,_bg :_eg ,_aa :parameters },nil ;};type Parameters struct{UnpaddedData bool ;Color _f .Color ;};func (_gbg *Decoder )decodePageImage (_de int )(_a .Image ,error ){const _dgd ="\u0064e\u0063o\u0064\u0065\u0050\u0061\u0067\u0065\u0049\u006d\u0061\u0067\u0065";
if _de < 0{return nil ,_b .Errorf (_dgd ,"\u0069n\u0076\u0061\u006c\u0069d\u0020\u0070\u0061\u0067\u0065 \u006eu\u006db\u0065\u0072\u003a\u0020\u0027\u0025\u0064'",_de );};if _de > int (_gbg ._bg .NumberOfPages ){return nil ,_b .Errorf (_dgd ,"p\u0061\u0067\u0065\u003a\u0020\u0027%\u0064\u0027\u0020\u006e\u006f\u0074 \u0066\u006f\u0075\u006e\u0064\u0020\u0069n\u0020\u0074\u0068\u0065\u0020\u0064\u0065\u0063\u006f\u0064e\u0072",_de );
};_abb ,_bb :=_gbg ._bg .GetPage (_de );if _bb !=nil {return nil ,_b .Wrap (_bb ,_dgd ,"");};_dd ,_bb :=_abb .GetBitmap ();if _bb !=nil {return nil ,_b .Wrap (_bb ,_dgd ,"");};_dd .InverseData ();return _dd .ToImage (),nil ;};type Decoder struct{_ad _g .StreamReader ;
_bg *_ga .Document ;_e int ;_aa Parameters ;};func (_acd *Decoder )PageNumber ()(int ,error ){const _dga ="\u0044e\u0063o\u0064\u0065\u0072\u002e\u0050a\u0067\u0065N\u0075\u006d\u0062\u0065\u0072";if _acd ._bg ==nil {return 0,_b .Error (_dga ,"d\u0065\u0063\u006f\u0064\u0065\u0072 \u006e\u006f\u0074\u0020\u0069\u006e\u0069\u0074\u0069a\u006c\u0069\u007ae\u0064 \u0079\u0065\u0074");
};return int (_acd ._bg .NumberOfPages ),nil ;};