mirror of
https://github.com/unidoc/unipdf.git
synced 2025-04-26 13:48:55 +08:00
208 lines
55 KiB
Go
208 lines
55 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 render ;import (_b "errors";_ge "fmt";_da "github.com/adrg/sysfont";_ed "github.com/unidoc/unipdf/v3/annotator";_dd "github.com/unidoc/unipdf/v3/common";_eb "github.com/unidoc/unipdf/v3/contentstream";_ef "github.com/unidoc/unipdf/v3/contentstream/draw";
|
|
_bb "github.com/unidoc/unipdf/v3/core";_ff "github.com/unidoc/unipdf/v3/internal/license";_de "github.com/unidoc/unipdf/v3/internal/transform";_gb "github.com/unidoc/unipdf/v3/model";_bd "github.com/unidoc/unipdf/v3/render/internal/context";_bbe "github.com/unidoc/unipdf/v3/render/internal/context/imagerender";
|
|
_cfa "golang.org/x/image/draw";_dc "image";_f "image/color";_ga "image/draw";_cc "image/jpeg";_a "image/png";_cf "math";_d "os";_c "path/filepath";_g "strings";);func _dfa (_efbb _bd .Gradient ,_bgf *_gb .PdfFunctionType3 ,_acg _gb .PdfColorspace ,_cec []float64 )(_bd .Gradient ,error ){var _fgef error ;
|
|
for _dcdb :=0;_dcdb < len (_bgf .Functions );_dcdb ++{if _dgc ,_dbed :=_bgf .Functions [_dcdb ].(*_gb .PdfFunctionType2 );_dbed {_efbb ,_fgef =_gace (_efbb ,_dgc ,_acg ,_cec [_dcdb +1],_dcdb ==0);if _fgef !=nil {return nil ,_fgef ;};};};return _efbb ,nil ;
|
|
};
|
|
|
|
// PdfShadingType defines PDF shading types.
|
|
// Source: PDF32000_2008.pdf. Chapter 8.7.4.5
|
|
type PdfShadingType int64 ;type renderer struct{_cfac float64 };
|
|
|
|
// RenderWithOpts converts the specified PDF page into an image, optionally flattens annotations and returns the result.
|
|
func (_aa *ImageDevice )RenderWithOpts (page *_gb .PdfPage ,skipFlattening bool )(_dc .Image ,error ){_gd ,_dac :=page .GetMediaBox ();if _dac !=nil {return nil ,_dac ;};_gd .Normalize ();_ebg :=page .CropBox ;var _dcf ,_faf float64 ;if _ebg !=nil {_ebg .Normalize ();
|
|
_dcf ,_faf =_ebg .Width (),_ebg .Height ();};_cb :=page .Rotate ;_ea ,_fb ,_ebf ,_gc :=_gd .Llx ,_gd .Lly ,_gd .Width (),_gd .Height ();_dcc :=_de .IdentityMatrix ();if _cb !=nil &&*_cb %360!=0&&*_cb %90==0{_gaf :=-float64 (*_cb );_ead :=_aagd (_ebf ,_gc ,_gaf );
|
|
_dcc =_dcc .Translate ((_ead .Width -_ebf )/2+_ebf /2,(_ead .Height -_gc )/2+_gc /2).Rotate (_gaf *_cf .Pi /180).Translate (-_ebf /2,-_gc /2);_ebf ,_gc =_ead .Width ,_ead .Height ;if _ebg !=nil {_bc :=_aagd (_dcf ,_faf ,_gaf );_dcf ,_faf =_bc .Width ,_bc .Height ;
|
|
};};if _ea !=0||_fb !=0{_dcc =_dcc .Translate (-_ea ,-_fb );};_aa ._cfac =1.0;if _aa .OutputWidth !=0{_ag :=_ebf ;if _ebg !=nil {_ag =_dcf ;};_aa ._cfac =float64 (_aa .OutputWidth )/_ag ;_ebf ,_gc ,_dcf ,_faf =_ebf *_aa ._cfac ,_gc *_aa ._cfac ,_dcf *_aa ._cfac ,_faf *_aa ._cfac ;
|
|
_dcc =_de .ScaleMatrix (_aa ._cfac ,_aa ._cfac ).Mult (_dcc );};_ebd :=_bbe .NewContext (int (_ebf ),int (_gc ));if _cg :=_aa .renderPage (_ebd ,page ,_dcc ,skipFlattening );_cg !=nil {return nil ,_cg ;};_dg :=_ebd .Image ();if _ebg !=nil {_gf ,_db :=(_ebg .Llx -_ea )*_aa ._cfac ,(_ebg .Lly -_fb )*_aa ._cfac ;
|
|
_af :=_dc .Rect (0,0,int (_dcf ),int (_faf ));_aga :=_dc .Pt (int (_gf ),int (_gc -_db -_faf ));_afd :=_dc .NewRGBA (_af );_ga .Draw (_afd ,_af ,_dg ,_aga ,_ga .Src );_dg =_afd ;};return _dg ,nil ;};
|
|
|
|
// ImageDevice is used to render PDF pages to image targets.
|
|
type ImageDevice struct{renderer ;
|
|
|
|
// OutputWidth represents the width of the rendered images in pixels.
|
|
// The heights of the output images are calculated based on the selected
|
|
// width and the original height of each rendered page.
|
|
OutputWidth int ;};func (_ebgc renderer )renderPage (_dcfa _bd .Context ,_gfc *_gb .PdfPage ,_ae _de .Matrix ,_cfe bool )error {if !_cfe {_ca :=_gb .FieldFlattenOpts {AnnotFilterFunc :func (_cfae *_gb .PdfAnnotation )bool {switch _cfae .GetContext ().(type ){case *_gb .PdfAnnotationLine :return true ;
|
|
case *_gb .PdfAnnotationSquare :return true ;case *_gb .PdfAnnotationCircle :return true ;case *_gb .PdfAnnotationPolygon :return true ;case *_gb .PdfAnnotationPolyLine :return true ;};return false ;}};_ebff :=_ed .FieldAppearance {};_bba :=_gfc .FlattenFieldsWithOpts (_ebff ,&_ca );
|
|
if _bba !=nil {_dd .Log .Debug ("\u0045\u0072r\u006f\u0072\u0020\u0064u\u0072\u0069n\u0067\u0020\u0061\u006e\u006e\u006f\u0074\u0061t\u0069\u006f\u006e\u0020\u0066\u006c\u0061\u0074\u0074\u0065\u006e\u0069n\u0067\u0020\u0025\u0076",_bba );};};_bdb ,_ebe :=_gfc .GetAllContentStreams ();
|
|
if _ebe !=nil {return _ebe ;};if _ad :=_ae ;!_ad .Identity (){_bdb =_ge .Sprintf ("%\u002e\u0032\u0066\u0020\u0025\u002e2\u0066\u0020\u0025\u002e\u0032\u0066 \u0025\u002e\u0032\u0066\u0020\u0025\u002e2\u0066\u0020\u0025\u002e\u0032\u0066\u0020\u0063\u006d\u0020%\u0073",_ad [0],_ad [1],_ad [3],_ad [4],_ad [6],_ad [7],_bdb );
|
|
};_dcfa .Translate (0,float64 (_dcfa .Height ()));_dcfa .Scale (1,-1);_dcfa .Push ();_dcfa .SetRGBA (1,1,1,1);_dcfa .DrawRectangle (0,0,float64 (_dcfa .Width ()),float64 (_dcfa .Height ()));_dcfa .Fill ();_dcfa .Pop ();_dcfa .SetLineWidth (1.0);_dcfa .SetRGBA (0,0,0,1);
|
|
return _ebgc .renderContentStream (_dcfa ,_bdb ,_gfc .Resources );};const (ShadingTypeFunctionBased PdfShadingType =1;ShadingTypeAxial PdfShadingType =2;ShadingTypeRadial PdfShadingType =3;ShadingTypeFreeForm PdfShadingType =4;ShadingTypeLatticeForm PdfShadingType =5;
|
|
ShadingTypeCoons PdfShadingType =6;ShadingTypeTensorProduct PdfShadingType =7;);
|
|
|
|
// Render converts the specified PDF page into an image, flattens annotations by default and returns the result.
|
|
func (_ba *ImageDevice )Render (page *_gb .PdfPage )(_dc .Image ,error ){return _ba .RenderWithOpts (page ,false );};func (_eea renderer )processShading (_aaac _bd .Context ,_fcb *_gb .PdfShading )(_bd .Gradient ,*_bb .PdfObjectArray ,error ){_ddfa :=int64 (*_fcb .ShadingType );
|
|
if _ddfa ==int64 (ShadingTypeAxial ){return _eea .processLinearShading (_aaac ,_fcb );}else if _ddfa ==int64 (ShadingTypeRadial ){return _eea .processRadialShading (_aaac ,_fcb );}else {_dd .Log .Debug (_ge .Sprintf ("\u0050r\u006f\u0063e\u0073\u0073\u0069n\u0067\u0020\u0067\u0072\u0061\u0064\u0069e\u006e\u0074\u0020\u0074\u0079\u0070e\u0020\u0025\u0064\u0020\u006e\u006f\u0074\u0020\u0079\u0065\u0074 \u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064",_ddfa ));
|
|
};return nil ,nil ,nil ;};func _ccdc (_efbe *_gb .Image ,_ffcg _f .Color )_dc .Image {_gbac ,_bgd :=int (_efbe .Width ),int (_efbe .Height );_baea :=_dc .NewRGBA (_dc .Rect (0,0,_gbac ,_bgd ));for _acaf :=0;_acaf < _bgd ;_acaf ++{for _dfec :=0;_dfec < _gbac ;
|
|
_dfec ++{_aee ,_gddb :=_efbe .ColorAt (_dfec ,_acaf );if _gddb !=nil {_dd .Log .Debug ("\u0057\u0041\u0052\u004e\u003a\u0020\u0063o\u0075\u006c\u0064\u0020\u006e\u006f\u0074\u0020\u0072\u0065\u0074\u0072\u0069\u0065v\u0065 \u0069\u006d\u0061\u0067\u0065\u0020m\u0061\u0073\u006b\u0020\u0076\u0061\u006cu\u0065\u0020\u0061\u0074\u0020\u0028\u0025\u0064\u002c\u0020\u0025\u0064\u0029\u002e\u0020\u004f\u0075\u0074\u0070\u0075\u0074\u0020\u006da\u0079\u0020\u0062\u0065\u0020\u0069\u006e\u0063\u006f\u0072\u0072\u0065\u0063t\u002e",_dfec ,_acaf );
|
|
continue ;};_bgae ,_adgc ,_adc ,_ :=_aee .RGBA ();var _dcae _f .Color ;if _bgae +_adgc +_adc ==0{_dcae =_ffcg ;}else {_dcae =_f .Transparent ;};_baea .Set (_dfec ,_acaf ,_dcae );};};return _baea ;};func (_dea renderer )processGradient (_bcdd _bd .Context ,_eed *_eb .ContentStreamOperation ,_dbe *_gb .PdfPageResources ,_fffc *_bb .PdfObjectName )(_bd .Gradient ,error ){if _cgga ,_effd :=_dbe .GetPatternByName (*_fffc );
|
|
_effd &&_cgga .IsShading (){_dbfa :=_cgga .GetAsShadingPattern ().Shading ;_ffbb ,_ ,_edb :=_dea .processShading (_bcdd ,_dbfa );if _edb !=nil {return nil ,_edb ;};return _ffbb ,nil ;};return nil ,nil ;};func _ffgf (_bgde ,_gbc _dc .Image )_dc .Image {_efgc ,_cgff :=_gbc .Bounds ().Size (),_bgde .Bounds ().Size ();
|
|
_aaed ,_dgb :=_efgc .X ,_efgc .Y ;if _cgff .X > _aaed {_aaed =_cgff .X ;};if _cgff .Y > _dgb {_dgb =_cgff .Y ;};_cecc :=_dc .Rect (0,0,_aaed ,_dgb );if _efgc .X !=_aaed ||_efgc .Y !=_dgb {_bcda :=_dc .NewRGBA (_cecc );_cfa .BiLinear .Scale (_bcda ,_cecc ,_bgde ,_gbc .Bounds (),_cfa .Over ,nil );
|
|
_gbc =_bcda ;};if _cgff .X !=_aaed ||_cgff .Y !=_dgb {_fdda :=_dc .NewRGBA (_cecc );_cfa .BiLinear .Scale (_fdda ,_cecc ,_bgde ,_bgde .Bounds (),_cfa .Over ,nil );_bgde =_fdda ;};_degb :=_dc .NewRGBA (_cecc );_cfa .DrawMask (_degb ,_cecc ,_bgde ,_dc .Point {},_gbc ,_dc .Point {},_cfa .Over );
|
|
return _degb ;};var (_baf =_b .New ("\u0074\u0079p\u0065\u0020\u0063h\u0065\u0063\u006b\u0020\u0065\u0072\u0072\u006f\u0072");_ege =_b .New ("\u0072\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b\u0020e\u0072\u0072\u006f\u0072"););func _fggc (_gga string ,_fcbd _dc .Image ,_fcab int )error {_gegef ,_bdfa :=_d .Create (_gga );
|
|
if _bdfa !=nil {return _bdfa ;};defer _gegef .Close ();return _cc .Encode (_gegef ,_fcbd ,&_cc .Options {Quality :_fcab });};func _fged (_bdbf *_gb .Image ,_gcfa _f .Color )_dc .Image {_aagf ,_fcc :=int (_bdbf .Width ),int (_bdbf .Height );_dbebf :=_dc .NewRGBA (_dc .Rect (0,0,_aagf ,_fcc ));
|
|
for _fbbc :=0;_fbbc < _fcc ;_fbbc ++{for _ffgbe :=0;_ffgbe < _aagf ;_ffgbe ++{_bbff ,_gdda :=_bdbf .ColorAt (_ffgbe ,_fbbc );if _gdda !=nil {_dd .Log .Debug ("\u0057\u0041\u0052\u004e\u003a\u0020\u0063o\u0075\u006c\u0064\u0020\u006e\u006f\u0074\u0020\u0072\u0065\u0074\u0072\u0069\u0065v\u0065 \u0069\u006d\u0061\u0067\u0065\u0020m\u0061\u0073\u006b\u0020\u0076\u0061\u006cu\u0065\u0020\u0061\u0074\u0020\u0028\u0025\u0064\u002c\u0020\u0025\u0064\u0029\u002e\u0020\u004f\u0075\u0074\u0070\u0075\u0074\u0020\u006da\u0079\u0020\u0062\u0065\u0020\u0069\u006e\u0063\u006f\u0072\u0072\u0065\u0063t\u002e",_ffgbe ,_fbbc );
|
|
continue ;};_egbe ,_daff ,_afcfb ,_ :=_bbff .RGBA ();var _bbdg _f .Color ;if _egbe +_daff +_afcfb ==0{_bbdg =_f .Transparent ;}else {_bbdg =_gcfa ;};_dbebf .Set (_ffgbe ,_fbbc ,_bbdg );};};return _dbebf ;};func _aagd (_ddab ,_fbbf ,_dbcg float64 )_ef .BoundingBox {return _ef .Path {Points :[]_ef .Point {_ef .NewPoint (0,0).Rotate (_dbcg ),_ef .NewPoint (_ddab ,0).Rotate (_dbcg ),_ef .NewPoint (0,_fbbf ).Rotate (_dbcg ),_ef .NewPoint (_ddab ,_fbbf ).Rotate (_dbcg )}}.GetBoundingBox ();
|
|
};func _adge (_cdf _bb .PdfObject ,_cff _f .Color )(_dc .Image ,error ){_gadbe ,_ebcd :=_bb .GetStream (_cdf );if !_ebcd {return nil ,nil ;};_ddc ,_dgac :=_gb .NewXObjectImageFromStream (_gadbe );if _dgac !=nil {return nil ,_dgac ;};_eefd ,_dgac :=_ddc .ToImage ();
|
|
if _dgac !=nil {return nil ,_dgac ;};return _ccdc (_eefd ,_cff ),nil ;};
|
|
|
|
// RenderToPath converts the specified PDF page into an image and saves the
|
|
// result at the specified location.
|
|
func (_gcd *ImageDevice )RenderToPath (page *_gb .PdfPage ,outputPath string )error {_eg ,_bf :=_gcd .Render (page );if _bf !=nil {return _bf ;};_cfg :=_g .ToLower (_c .Ext (outputPath ));if _cfg ==""{return _b .New ("\u0063\u006ful\u0064\u0020\u006eo\u0074\u0020\u0072\u0065cog\u006eiz\u0065\u0020\u006f\u0075\u0074\u0070\u0075t \u0066\u0069\u006c\u0065\u0020\u0074\u0079p\u0065");
|
|
};switch _cfg {case "\u002e\u0070\u006e\u0067":return _ebfa (outputPath ,_eg );case "\u002e\u006a\u0070\u0067","\u002e\u006a\u0070e\u0067":return _fggc (outputPath ,_eg ,100);};return _ge .Errorf ("\u0075\u006e\u0072\u0065\u0063\u006fg\u006e\u0069\u007a\u0065\u0064\u0020\u006f\u0075\u0074\u0070\u0075\u0074\u0020f\u0069\u006c\u0065\u0020\u0074\u0079\u0070e\u003a\u0020\u0025\u0073",_cfg );
|
|
};
|
|
|
|
// NewImageDevice returns a new image device.
|
|
func NewImageDevice ()*ImageDevice {const _fa ="r\u0065\u006e\u0064\u0065r.\u004ee\u0077\u0049\u006d\u0061\u0067e\u0044\u0065\u0076\u0069\u0063\u0065";_ff .TrackUse (_fa );return &ImageDevice {};};func _gffgf (_gfgb _bb .PdfObject ,_gafb _f .Color )(_dc .Image ,error ){_bef ,_feec :=_bb .GetStream (_gfgb );
|
|
if !_feec {return nil ,nil ;};_geb ,_bbfe :=_gb .NewXObjectImageFromStream (_bef );if _bbfe !=nil {return nil ,_bbfe ;};_fbe ,_bbfe :=_geb .ToImage ();if _bbfe !=nil {return nil ,_bbfe ;};return _fged (_fbe ,_gafb ),nil ;};func (_edf renderer )renderContentStream (_ab _bd .Context ,_cd string ,_fd *_gb .PdfPageResources )error {_baa ,_fe :=_eb .NewContentStreamParser (_cd ).Parse ();
|
|
if _fe !=nil {return _fe ;};_cdd :=_ab .TextState ();_cdd .GlobalScale =_edf ._cfac ;_bbd :=map[string ]*_bd .TextFont {};_gg :=_da .NewFinder (&_da .FinderOpts {Extensions :[]string {"\u002e\u0074\u0074\u0066","\u002e\u0074\u0074\u0063"}});var _df *_eb .ContentStreamOperation ;
|
|
_gba :=_eb .NewContentStreamProcessor (*_baa );_gba .AddHandler (_eb .HandlerConditionEnumAllOperands ,"",func (_fbc *_eb .ContentStreamOperation ,_fc _eb .GraphicsState ,_feb *_gb .PdfPageResources )error {_dd .Log .Debug ("\u0050\u0072\u006f\u0063\u0065\u0073\u0073\u0069\u006e\u0067\u0020\u0025\u0073",_fbc .Operand );
|
|
switch _fbc .Operand {case "\u0071":_ab .Push ();case "\u0051":_ab .Pop ();_cdd =_ab .TextState ();case "\u0063\u006d":if len (_fbc .Params )!=6{return _ege ;};_eff ,_fdf :=_bb .GetNumbersAsFloat (_fbc .Params );if _fdf !=nil {return _fdf ;};_bbg :=_de .NewMatrix (_eff [0],_eff [1],_eff [2],_eff [3],_eff [4],_eff [5]);
|
|
_dd .Log .Debug ("\u0047\u0072\u0061\u0070\u0068\u0069\u0063\u0073\u0020\u0073\u0074a\u0074\u0065\u0020\u006d\u0061\u0074\u0072\u0069\u0078\u003a \u0025\u002b\u0076",_bbg );_ab .SetMatrix (_ab .Matrix ().Mult (_bbg ));case "\u0077":if len (_fbc .Params )!=1{return _ege ;
|
|
};_adf ,_cca :=_bb .GetNumbersAsFloat (_fbc .Params );if _cca !=nil {return _cca ;};_ab .SetLineWidth (_adf [0]);case "\u004a":if len (_fbc .Params )!=1{return _ege ;};_aba ,_ffg :=_bb .GetIntVal (_fbc .Params [0]);if !_ffg {return _baf ;};switch _aba {case 0:_ab .SetLineCap (_bd .LineCapButt );
|
|
case 1:_ab .SetLineCap (_bd .LineCapRound );case 2:_ab .SetLineCap (_bd .LineCapSquare );default:_dd .Log .Debug ("\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u006c\u0069\u006ee\u0020\u0063\u0061\u0070\u0020\u0073\u0074\u0079\u006c\u0065:\u0020\u0025\u0064",_aba );
|
|
return _ege ;};case "\u006a":if len (_fbc .Params )!=1{return _ege ;};_ega ,_gafe :=_bb .GetIntVal (_fbc .Params [0]);if !_gafe {return _baf ;};switch _ega {case 0:_ab .SetLineJoin (_bd .LineJoinBevel );case 1:_ab .SetLineJoin (_bd .LineJoinRound );case 2:_ab .SetLineJoin (_bd .LineJoinBevel );
|
|
default:_dd .Log .Debug ("I\u006e\u0076\u0061\u006c\u0069\u0064 \u006c\u0069\u006e\u0065\u0020\u006a\u006f\u0069\u006e \u0073\u0074\u0079l\u0065:\u0020\u0025\u0064",_ega );return _ege ;};case "\u004d":if len (_fbc .Params )!=1{return _ege ;};_ddf ,_cgf :=_bb .GetNumbersAsFloat (_fbc .Params );
|
|
if _cgf !=nil {return _cgf ;};_ =_ddf ;_dd .Log .Debug ("\u004di\u0074\u0065\u0072\u0020l\u0069\u006d\u0069\u0074\u0020n\u006ft\u0020s\u0075\u0070\u0070\u006f\u0072\u0074\u0065d");case "\u0064":if len (_fbc .Params )!=2{return _ege ;};_ggd ,_aaa :=_bb .GetArray (_fbc .Params [0]);
|
|
if !_aaa {return _baf ;};_afe ,_aaa :=_bb .GetIntVal (_fbc .Params [1]);if !_aaa {_ ,_dca :=_bb .GetFloatVal (_fbc .Params [1]);if !_dca {return _baf ;};};_fg ,_dee :=_bb .GetNumbersAsFloat (_ggd .Elements ());if _dee !=nil {return _dee ;};_ab .SetDash (_fg ...);
|
|
_ =_afe ;_dd .Log .Debug ("\u004c\u0069n\u0065\u0020\u0064\u0061\u0073\u0068\u0020\u0070\u0068\u0061\u0073\u0065\u0020\u006e\u006f\u0074\u0020\u0073\u0075\u0070\u0070\u006frt\u0065\u0064");case "\u0072\u0069":_dd .Log .Debug ("\u0052\u0065\u006e\u0064\u0065\u0072\u0069\u006e\u0067\u0020i\u006e\u0074\u0065\u006e\u0074\u0020\u006eo\u0074\u0020\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064");
|
|
case "\u0069":_dd .Log .Debug ("\u0046\u006c\u0061\u0074\u006e\u0065\u0073\u0073\u0020\u0074\u006f\u006c\u0065\u0072\u0061n\u0063e\u0020\u006e\u006f\u0074\u0020\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064");case "\u0067\u0073":if len (_fbc .Params )!=1{return _ege ;
|
|
};_bfd ,_ccb :=_bb .GetName (_fbc .Params [0]);if !_ccb {return _baf ;};if _bfd ==nil {return _ege ;};_fafe ,_ccb :=_feb .GetExtGState (*_bfd );if !_ccb {_dd .Log .Debug ("\u0045\u0052\u0052OR\u003a\u0020\u0063\u006f\u0075\u006c\u0064\u0020\u006eo\u0074 \u0066i\u006ed\u0020\u0072\u0065\u0073\u006f\u0075\u0072\u0063\u0065\u003a\u0020\u0025\u0073",*_bfd );
|
|
return _b .New ("\u0072e\u0073o\u0075\u0072\u0063\u0065\u0020n\u006f\u0074 \u0066\u006f\u0075\u006e\u0064");};_ac ,_ccb :=_bb .GetDict (_fafe );if !_ccb {_dd .Log .Debug ("\u0045\u0052RO\u0052\u003a\u0020c\u006f\u0075\u006c\u0064 ge\u0074 g\u0072\u0061\u0070\u0068\u0069\u0063\u0073 s\u0074\u0061\u0074\u0065\u0020\u0064\u0069c\u0074");
|
|
return _baf ;};_dd .Log .Debug ("G\u0053\u0020\u0064\u0069\u0063\u0074\u003a\u0020\u0025\u0073",_ac .String ());_ddd :=_ac .Get ("\u0063\u0061");if _ddd !=nil {_bab ,_cgd :=_bb .GetNumberAsFloat (_ddd );if _cgd ==nil {_dbc ,_dga :=_fc .ColorspaceNonStroking .ColorToRGB (_fc .ColorNonStroking );
|
|
if _dga !=nil {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_dga );return _dga ;};_fbcg ,_fcd :=_dbc .(*_gb .PdfColorDeviceRGB );if !_fcd {_dd .Log .Debug ("\u0045\u0072\u0072\u006fr \u0063\u006f\u006e\u0076\u0065\u0072\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006co\u0072");
|
|
return _dga ;};_ab .SetFillRGBA (_fbcg .R (),_fbcg .G (),_fbcg .B (),_bab );};};case "\u006d":if len (_fbc .Params )!=2{_dd .Log .Debug ("\u0057\u0041\u0052\u004e\u003a\u0020\u0065\u0072\u0072o\u0072\u0020\u0077\u0068\u0069\u006c\u0065\u0020\u0070\u0072\u006f\u0063\u0065\u0073\u0073\u0069\u006e\u0067\u0020\u0060\u006d\u0060\u0020o\u0070\u0065r\u0061\u0074o\u0072\u003a\u0020\u0025\u0073\u002e\u0020\u004f\u0075\u0074\u0070\u0075\u0074 m\u0061\u0079\u0020\u0062\u0065\u0020\u0069\u006e\u0063o\u0072\u0072\u0065\u0063\u0074\u002e",_ege );
|
|
return nil ;};_dgad ,_aea :=_bb .GetNumbersAsFloat (_fbc .Params );if _aea !=nil {return _aea ;};_dd .Log .Debug ("M\u006f\u0076\u0065\u0020\u0074\u006f\u003a\u0020\u0025\u0076",_dgad );_ab .NewSubPath ();_ab .MoveTo (_dgad [0],_dgad [1]);case "\u006c":if len (_fbc .Params )!=2{_dd .Log .Debug ("\u0057\u0041\u0052\u004e\u003a\u0020\u0065\u0072\u0072o\u0072\u0020\u0077\u0068\u0069\u006c\u0065\u0020\u0070\u0072\u006f\u0063\u0065\u0073\u0073\u0069\u006e\u0067\u0020\u0060\u006c\u0060\u0020o\u0070\u0065r\u0061\u0074o\u0072\u003a\u0020\u0025\u0073\u002e\u0020\u004f\u0075\u0074\u0070\u0075\u0074 m\u0061\u0079\u0020\u0062\u0065\u0020\u0069\u006e\u0063o\u0072\u0072\u0065\u0063\u0074\u002e",_ege );
|
|
return nil ;};_ffd ,_be :=_bb .GetNumbersAsFloat (_fbc .Params );if _be !=nil {return _be ;};_ab .LineTo (_ffd [0],_ffd [1]);case "\u0063":if len (_fbc .Params )!=6{return _ege ;};_dfd ,_fag :=_bb .GetNumbersAsFloat (_fbc .Params );if _fag !=nil {return _fag ;
|
|
};_dd .Log .Debug ("\u0043u\u0062\u0069\u0063\u0020\u0062\u0065\u007a\u0069\u0065\u0072\u0020p\u0061\u0072\u0061\u006d\u0073\u003a\u0020\u0025\u002b\u0076",_dfd );_ab .CubicTo (_dfd [0],_dfd [1],_dfd [2],_dfd [3],_dfd [4],_dfd [5]);case "\u0076","\u0079":if len (_fbc .Params )!=4{return _ege ;
|
|
};_abg ,_cae :=_bb .GetNumbersAsFloat (_fbc .Params );if _cae !=nil {return _cae ;};_dd .Log .Debug ("\u0043u\u0062\u0069\u0063\u0020\u0062\u0065\u007a\u0069\u0065\u0072\u0020p\u0061\u0072\u0061\u006d\u0073\u003a\u0020\u0025\u002b\u0076",_abg );_ab .QuadraticTo (_abg [0],_abg [1],_abg [2],_abg [3]);
|
|
case "\u0068":_ab .ClosePath ();_ab .NewSubPath ();case "\u0072\u0065":if len (_fbc .Params )!=4{return _ege ;};_ce ,_dbb :=_bb .GetNumbersAsFloat (_fbc .Params );if _dbb !=nil {return _dbb ;};_ab .DrawRectangle (_ce [0],_ce [1],_ce [2],_ce [3]);_ab .NewSubPath ();
|
|
case "\u0053":_cdc ,_ggdd :=_fc .ColorspaceStroking .ColorToRGB (_fc .ColorStroking );if _ggdd !=nil {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_ggdd );
|
|
return _ggdd ;};_egc ,_fcdg :=_cdc .(*_gb .PdfColorDeviceRGB );if !_fcdg {_dd .Log .Debug ("\u0045\u0072\u0072\u006fr \u0063\u006f\u006e\u0076\u0065\u0072\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006co\u0072");return _ggdd ;};_ab .SetRGBA (_egc .R (),_egc .G (),_egc .B (),1);
|
|
_ab .Stroke ();case "\u0073":_fda ,_cdg :=_fc .ColorspaceStroking .ColorToRGB (_fc .ColorStroking );if _cdg !=nil {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_cdg );
|
|
return _cdg ;};_efg ,_bg :=_fda .(*_gb .PdfColorDeviceRGB );if !_bg {_dd .Log .Debug ("\u0045\u0072\u0072\u006fr \u0063\u006f\u006e\u0076\u0065\u0072\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006co\u0072");return _cdg ;};_ab .ClosePath ();_ab .NewSubPath ();
|
|
_ab .SetRGBA (_efg .R (),_efg .G (),_efg .B (),1);_ab .Stroke ();case "\u0066","\u0046":_cef ,_gcb :=_fc .ColorspaceNonStroking .ColorToRGB (_fc .ColorNonStroking );if _gcb !=nil {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_gcb );
|
|
return _gcb ;};switch _dce :=_cef .(type ){case *_gb .PdfColorDeviceRGB :_ab .SetRGBA (_dce .R (),_dce .G (),_dce .B (),1);_ab .SetFillRule (_bd .FillRuleWinding );_ab .Fill ();case *_gb .PdfColorPattern :_ab .Fill ();};_dd .Log .Debug ("\u0045\u0072\u0072\u006fr \u0063\u006f\u006e\u0076\u0065\u0072\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006co\u0072");
|
|
case "\u0066\u002a":_ec ,_dbbb :=_fc .ColorspaceNonStroking .ColorToRGB (_fc .ColorNonStroking );if _dbbb !=nil {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_dbbb );
|
|
return _dbbb ;};_gad ,_deg :=_ec .(*_gb .PdfColorDeviceRGB );if !_deg {_dd .Log .Debug ("\u0045\u0072\u0072\u006fr \u0063\u006f\u006e\u0076\u0065\u0072\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006co\u0072");return _dbbb ;};_ab .SetRGBA (_gad .R (),_gad .G (),_gad .B (),1);
|
|
_ab .SetFillRule (_bd .FillRuleEvenOdd );_ab .Fill ();case "\u0042":_bcd ,_bad :=_fc .ColorspaceNonStroking .ColorToRGB (_fc .ColorNonStroking );if _bad !=nil {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_bad );
|
|
return _bad ;};switch _ffa :=_bcd .(type ){case *_gb .PdfColorDeviceRGB :_ab .SetRGBA (_ffa .R (),_ffa .G (),_ffa .B (),1);_ab .SetFillRule (_bd .FillRuleWinding );_ab .FillPreserve ();_bcd ,_bad =_fc .ColorspaceStroking .ColorToRGB (_fc .ColorStroking );
|
|
if _bad !=nil {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_bad );return _bad ;};if _dddc ,_cce :=_bcd .(*_gb .PdfColorDeviceRGB );
|
|
_cce {_ab .SetRGBA (_dddc .R (),_dddc .G (),_dddc .B (),1);_ab .Stroke ();};case *_gb .PdfColorPattern :_ab .SetFillRule (_bd .FillRuleWinding );_ab .Fill ();_ab .StrokePattern ();};case "\u0042\u002a":_cagg ,_gfd :=_fc .ColorspaceNonStroking .ColorToRGB (_fc .ColorNonStroking );
|
|
if _gfd !=nil {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_gfd );return _gfd ;};switch _ffe :=_cagg .(type ){case *_gb .PdfColorDeviceRGB :_ab .SetRGBA (_ffe .R (),_ffe .G (),_ffe .B (),1);
|
|
_ab .SetFillRule (_bd .FillRuleEvenOdd );_ab .FillPreserve ();_cagg ,_gfd =_fc .ColorspaceStroking .ColorToRGB (_fc .ColorStroking );if _gfd !=nil {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_gfd );
|
|
return _gfd ;};if _ecb ,_ccbf :=_cagg .(*_gb .PdfColorDeviceRGB );_ccbf {_ab .SetRGBA (_ecb .R (),_ecb .G (),_ecb .B (),1);_ab .Stroke ();};case *_gb .PdfColorPattern :_ab .SetFillRule (_bd .FillRuleEvenOdd );_ab .Fill ();_ab .StrokePattern ();};case "\u0062":_ab .ClosePath ();
|
|
_gbb ,_cbe :=_fc .ColorspaceNonStroking .ColorToRGB (_fc .ColorNonStroking );if _cbe !=nil {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_cbe );
|
|
return _cbe ;};switch _dec :=_gbb .(type ){case *_gb .PdfColorDeviceRGB :_ab .SetRGBA (_dec .R (),_dec .G (),_dec .B (),1);_ab .NewSubPath ();_ab .SetFillRule (_bd .FillRuleWinding );_ab .FillPreserve ();_gbb ,_cbe =_fc .ColorspaceStroking .ColorToRGB (_fc .ColorStroking );
|
|
if _cbe !=nil {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_cbe );return _cbe ;};if _bcc ,_gac :=_gbb .(*_gb .PdfColorDeviceRGB );
|
|
_gac {_ab .SetRGBA (_bcc .R (),_bcc .G (),_bcc .B (),1);_ab .Stroke ();};case *_gb .PdfColorPattern :_ab .NewSubPath ();_ab .SetFillRule (_bd .FillRuleWinding );_ab .Fill ();_ab .StrokePattern ();};case "\u0062\u002a":_ab .ClosePath ();_cfad ,_deed :=_fc .ColorspaceNonStroking .ColorToRGB (_fc .ColorNonStroking );
|
|
if _deed !=nil {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_deed );return _deed ;};switch _cgc :=_cfad .(type ){case *_gb .PdfColorDeviceRGB :_ab .SetRGBA (_cgc .R (),_cgc .G (),_cgc .B (),1);
|
|
_ab .NewSubPath ();_ab .SetFillRule (_bd .FillRuleEvenOdd );_ab .FillPreserve ();_cfad ,_deed =_fc .ColorspaceStroking .ColorToRGB (_fc .ColorStroking );if _deed !=nil {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_deed );
|
|
return _deed ;};if _aag ,_gae :=_cfad .(*_gb .PdfColorDeviceRGB );_gae {_ab .SetRGBA (_aag .R (),_aag .G (),_aag .B (),1);_ab .Stroke ();};case *_gb .PdfColorPattern :_ab .NewSubPath ();_ab .SetFillRule (_bd .FillRuleEvenOdd );_ab .Fill ();_ab .StrokePattern ();
|
|
};case "\u006e":_ab .ClearPath ();case "\u0057":_ab .SetFillRule (_bd .FillRuleWinding );_ab .ClipPreserve ();case "\u0057\u002a":_ab .SetFillRule (_bd .FillRuleEvenOdd );_ab .ClipPreserve ();case "\u0072\u0067":_dgf ,_gfdg :=_fc .ColorNonStroking .(*_gb .PdfColorDeviceRGB );
|
|
if !_gfdg {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_fc .ColorNonStroking );return nil ;};_ab .SetFillRGBA (_dgf .R (),_dgf .G (),_dgf .B (),1);
|
|
case "\u0052\u0047":_fac ,_dfe :=_fc .ColorStroking .(*_gb .PdfColorDeviceRGB );if !_dfe {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_fc .ColorStroking );
|
|
return nil ;};_ab .SetStrokeRGBA (_fac .R (),_fac .G (),_fac .B (),1);case "\u006b":_ffb ,_dad :=_fc .ColorNonStroking .(*_gb .PdfColorDeviceCMYK );if !_dad {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_fc .ColorNonStroking );
|
|
return nil ;};_acb ,_eag :=_fc .ColorspaceNonStroking .ColorToRGB (_ffb );if _eag !=nil {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_fc .ColorNonStroking );
|
|
return nil ;};_cgfb ,_dad :=_acb .(*_gb .PdfColorDeviceRGB );if !_dad {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_acb );return nil ;
|
|
};_ab .SetFillRGBA (_cgfb .R (),_cgfb .G (),_cgfb .B (),1);case "\u004b":_gdg ,_fgg :=_fc .ColorStroking .(*_gb .PdfColorDeviceCMYK );if !_fgg {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_fc .ColorStroking );
|
|
return nil ;};_fee ,_cdb :=_fc .ColorspaceStroking .ColorToRGB (_gdg );if _cdb !=nil {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_fc .ColorStroking );
|
|
return nil ;};_cgce ,_fgg :=_fee .(*_gb .PdfColorDeviceRGB );if !_fgg {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_fee );return nil ;
|
|
};_ab .SetStrokeRGBA (_cgce .R (),_cgce .G (),_cgce .B (),1);case "\u0067":_eda ,_gfg :=_fc .ColorNonStroking .(*_gb .PdfColorDeviceGray );if !_gfg {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_fc .ColorNonStroking );
|
|
return nil ;};_efc ,_dde :=_fc .ColorspaceNonStroking .ColorToRGB (_eda );if _dde !=nil {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_fc .ColorNonStroking );
|
|
return nil ;};_ccab ,_gfg :=_efc .(*_gb .PdfColorDeviceRGB );if !_gfg {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_efc );return nil ;
|
|
};_ab .SetFillRGBA (_ccab .R (),_ccab .G (),_ccab .B (),1);case "\u0047":_feg ,_agb :=_fc .ColorStroking .(*_gb .PdfColorDeviceGray );if !_agb {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_fc .ColorStroking );
|
|
return nil ;};_dbf ,_ee :=_fc .ColorspaceStroking .ColorToRGB (_feg );if _ee !=nil {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_fc .ColorStroking );
|
|
return nil ;};_eada ,_agb :=_dbf .(*_gb .PdfColorDeviceRGB );if !_agb {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_dbf );return nil ;
|
|
};_ab .SetStrokeRGBA (_eada .R (),_eada .G (),_eada .B (),1);case "\u0063\u0073":if len (_fbc .Params )> 0{if _fca ,_fbb :=_bb .GetName (_fbc .Params [0]);_fbb &&_fca .String ()=="\u0050a\u0074\u0074\u0065\u0072\u006e"{break ;};};_gbad ,_bae :=_fc .ColorspaceNonStroking .ColorToRGB (_fc .ColorNonStroking );
|
|
if _bae !=nil {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_fc .ColorNonStroking );return nil ;};_bbf ,_ffdf :=_gbad .(*_gb .PdfColorDeviceRGB );
|
|
if !_ffdf {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_gbad );return nil ;};_ab .SetFillRGBA (_bbf .R (),_bbf .G (),_bbf .B (),1);
|
|
case "\u0073\u0063":_afg ,_bfa :=_fc .ColorspaceNonStroking .ColorToRGB (_fc .ColorNonStroking );if _bfa !=nil {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_fc .ColorNonStroking );
|
|
return nil ;};_ffc ,_dfda :=_afg .(*_gb .PdfColorDeviceRGB );if !_dfda {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_afg );return nil ;
|
|
};_ab .SetFillRGBA (_ffc .R (),_ffc .G (),_ffc .B (),1);case "\u0073\u0063\u006e":if len (_fbc .Params )> 0&&len (_df .Params )> 0{if _gde ,_fdd :=_bb .GetName (_df .Params [0]);_fdd &&_gde .String ()=="\u0050a\u0074\u0074\u0065\u0072\u006e"{if _dece ,_bdbd :=_bb .GetName (_fbc .Params [0]);
|
|
_bdbd {_edc ,_fgb :=_edf .processGradient (_ab ,_fbc ,_feb ,_dece );if _fgb !=nil {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0077\u0068\u0065\u006e\u0020\u0070\u0072o\u0063\u0065\u0073\u0073\u0069\u006eg\u0020\u0067\u0072\u0061\u0064\u0069\u0065\u006e\u0074\u0020\u0064\u0061\u0074a\u003a\u0020\u0025\u0076",_fgb );
|
|
break ;};if _edc ==nil {_dd .Log .Debug ("\u0055\u006ek\u006e\u006f\u0077n\u0020\u0067\u0072\u0061\u0064\u0069\u0065\u006e\u0074");break ;};_ab .SetFillStyle (_edc );_ab .SetStrokeStyle (_edc );break ;};};};_cbb ,_dacd :=_fc .ColorspaceNonStroking .ColorToRGB (_fc .ColorNonStroking );
|
|
if _dacd !=nil {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_fc .ColorNonStroking );return nil ;};_bcf ,_ddg :=_cbb .(*_gb .PdfColorDeviceRGB );
|
|
if !_ddg {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_cbb );return nil ;};_ab .SetFillRGBA (_bcf .R (),_bcf .G (),_bcf .B (),1);case "\u0043\u0053":if len (_fbc .Params )> 0{if _fgbc ,_gbg :=_bb .GetName (_fbc .Params [0]);
|
|
_gbg &&_fgbc .String ()=="\u0050a\u0074\u0074\u0065\u0072\u006e"{break ;};};_gcg ,_bdf :=_fc .ColorspaceStroking .ColorToRGB (_fc .ColorStroking );if _bdf !=nil {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_fc .ColorStroking );
|
|
return nil ;};_edfc ,_bdfe :=_gcg .(*_gb .PdfColorDeviceRGB );if !_bdfe {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_gcg );return nil ;
|
|
};_ab .SetStrokeRGBA (_edfc .R (),_edfc .G (),_edfc .B (),1);case "\u0053\u0043":_adfa ,_fddg :=_fc .ColorspaceStroking .ColorToRGB (_fc .ColorStroking );if _fddg !=nil {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_fc .ColorStroking );
|
|
return nil ;};_fgc ,_fegf :=_adfa .(*_gb .PdfColorDeviceRGB );if !_fegf {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_adfa );return nil ;
|
|
};_ab .SetStrokeRGBA (_fgc .R (),_fgc .G (),_fgc .B (),1);case "\u0053\u0043\u004e":if len (_fbc .Params )> 0&&len (_df .Params )> 0{if _geg ,_fdg :=_bb .GetName (_df .Params [0]);_fdg &&_geg .String ()=="\u0050a\u0074\u0074\u0065\u0072\u006e"{if _ecba ,_bbga :=_bb .GetName (_fbc .Params [0]);
|
|
_bbga {_ebgd ,_afea :=_edf .processGradient (_ab ,_fbc ,_feb ,_ecba );if _afea !=nil {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0077\u0068\u0065\u006e\u0020\u0070\u0072o\u0063\u0065\u0073\u0073\u0069\u006eg\u0020\u0067\u0072\u0061\u0064\u0069\u0065\u006e\u0074\u0020\u0064\u0061\u0074a\u003a\u0020\u0025\u0076",_afea );
|
|
break ;};if _ebgd ==nil {_dd .Log .Debug ("\u0055\u006ek\u006e\u006f\u0077n\u0020\u0067\u0072\u0061\u0064\u0069\u0065\u006e\u0074");break ;};_ab .SetFillStyle (_ebgd );_ab .SetStrokeStyle (_ebgd );break ;};};};_bgg ,_dgag :=_fc .ColorspaceStroking .ColorToRGB (_fc .ColorStroking );
|
|
if _dgag !=nil {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_fc .ColorStroking );return nil ;};_dced ,_dae :=_bgg .(*_gb .PdfColorDeviceRGB );
|
|
if !_dae {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0063\u006f\u006e\u0076\u0065r\u0074\u0069\u006e\u0067\u0020\u0063\u006f\u006c\u006f\u0072:\u0020\u0025\u0076",_bgg );return nil ;};_ab .SetStrokeRGBA (_dced .R (),_dced .G (),_dced .B (),1);
|
|
case "\u0073\u0068":if len (_fbc .Params )!=1{_dd .Log .Debug ("\u0049n\u0076\u0061\u006c\u0069\u0064\u0020\u0073\u0068\u0020\u0070\u0061r\u0061\u006d\u0073\u0020\u0066\u006f\u0072\u006d\u0061\u0074");break ;};_fec ,_agc :=_bb .GetName (_fbc .Params [0]);
|
|
if !_agc {_dd .Log .Debug ("F\u0061\u0069\u006c\u0065\u0064\u0020g\u0065\u0074\u0074\u0069\u006e\u0067\u0020\u0073\u0068a\u0064\u0069\u006eg\u0020n\u0061\u006d\u0065");break ;};_bdc ,_agc :=_feb .GetShadingByName (*_fec );if !_agc {_dd .Log .Debug ("F\u0061\u0069\u006c\u0065\u0064\u0020g\u0065\u0074\u0074\u0069\u006e\u0067\u0020\u0073\u0068a\u0064\u0069\u006eg\u0020d\u0061\u0074\u0061");
|
|
break ;};_fce ,_bga ,_ade :=_edf .processShading (_ab ,_bdc );if _ade !=nil {_dd .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0077\u0068\u0065\u006e\u0020\u0070\u0072\u006f\u0063\u0065\u0073\u0073\u0069\u006e\u0067\u0020\u0073\u0068a\u0064\u0069\u006e\u0067\u0020d\u0061\u0074a\u003a\u0020\u0025\u0076",_ade );
|
|
break ;};if _fce ==nil {_dd .Log .Debug ("\u0055\u006ek\u006e\u006f\u0077n\u0020\u0067\u0072\u0061\u0064\u0069\u0065\u006e\u0074");break ;};_cfaa ,_ade :=_bga .ToFloat64Array ();if _ade !=nil {_dd .Log .Debug ("\u0045\u0072r\u006f\u0072\u0020\u0070\u0061\u0072\u0073\u0069\u006e\u0067\u0020\u0063\u006f\u006f\u0072\u0064\u0069\u006e\u0061\u0074\u0065\u0073: \u0025\u0076",_ade );
|
|
break ;};_ab .DrawRectangle (_cfaa [0],_cfaa [1],_cfaa [2],_cfaa [3]);_ab .NewSubPath ();_ab .SetFillStyle (_fce );_ab .SetStrokeStyle (_fce );_ab .Fill ();case "\u0044\u006f":if len (_fbc .Params )!=1{return _ege ;};_bac ,_abga :=_bb .GetName (_fbc .Params [0]);
|
|
if !_abga {return _baf ;};_ ,_dfeb :=_feb .GetXObjectByName (*_bac );switch _dfeb {case _gb .XObjectTypeImage :_dd .Log .Debug ("\u0058\u004f\u0062\u006a\u0065\u0063\u0074\u0020\u0069\u006d\u0061\u0067e\u003a\u0020\u0025\u0073",_bac .String ());_fafg ,_eba :=_feb .GetXObjectImageByName (*_bac );
|
|
if _eba !=nil {return _eba ;};_agd ,_eba :=_fafg .ToImage ();if _eba !=nil {_dd .Log .Debug ("\u0052\u0065\u006e\u0064\u0065\u0072\u0069\u006e\u0067\u0020\u0072\u0065\u0073\u0075\u006c\u0074\u0020\u006day\u0020b\u0065\u0020\u0069\u006e\u0063\u006f\u006d\u0070\u006c\u0065\u0074\u0065.\u0020\u0049\u006d\u0061\u0067\u0065\u0020\u0063\u006f\u006e\u0076\u0065\u0072\u0073\u0069\u006f\u006e \u0065\u0072\u0072\u006f\u0072\u003a\u0020\u0025\u0076",_eba );
|
|
return nil ;};if _bbef :=_fafg .ColorSpace ;_bbef !=nil {var _cbd bool ;switch _bbef .(type ){case *_gb .PdfColorspaceSpecialIndexed :_cbd =true ;};if _cbd {if _fddb ,_dddd :=_bbef .ImageToRGB (*_agd );_dddd !=nil {_dd .Log .Debug ("\u0057\u0041\u0052\u004e\u003a\u0020\u0063\u006f\u0075\u006c\u0064\u0020\u006e\u006f\u0074\u0020\u0063\u006fnv\u0065r\u0074\u0020\u0069\u006d\u0061\u0067\u0065\u0020\u0074\u006f\u0020\u0052G\u0042\u002e\u0020\u004f\u0075\u0074\u0070\u0075\u0074\u0020\u006d\u0061\u0079\u0020\u0062\u0065\u0020i\u006e\u0063\u006f\u0072\u0072\u0065\u0063\u0074\u002e");
|
|
}else {_agd =&_fddb ;};};};_eee :=_ab .FillPattern ().ColorAt (0,0);var _egaf _dc .Image ;if _fafg .Mask !=nil {if _egaf ,_eba =_adge (_fafg .Mask ,_eee );_eba !=nil {_dd .Log .Debug ("\u0057\u0041\u0052\u004e\u003a \u0063\u006f\u0075\u006c\u0064 \u006eo\u0074\u0020\u0067\u0065\u0074\u0020\u0065\u0078\u0070\u006c\u0069\u0063\u0069\u0074\u0020\u0069\u006d\u0061\u0067e\u0020\u006d\u0061\u0073\u006b\u002e\u0020\u004f\u0075\u0074\u0070\u0075\u0074\u0020\u006d\u0061\u0079\u0020\u0062\u0065\u0020\u0069\u006e\u0063o\u0072\u0072\u0065\u0063\u0074\u002e");
|
|
};}else if _fafg .SMask !=nil {if _egaf ,_eba =_gffgf (_fafg .SMask ,_eee );_eba !=nil {_dd .Log .Debug ("W\u0041\u0052\u004e\u003a\u0020\u0063\u006f\u0075\u006c\u0064\u0020\u006e\u006f\u0074\u0020\u0067\u0065\u0074\u0020\u0073\u006f\u0066\u0074\u0020\u0069\u006da\u0067e\u0020\u006d\u0061\u0073k\u002e\u0020O\u0075\u0074\u0070\u0075\u0074\u0020\u006d\u0061\u0079\u0020\u0062\u0065\u0020\u0069\u006e\u0063\u006f\u0072\u0072\u0065\u0063\u0074\u002e");
|
|
};};var _ecc _dc .Image ;if _aed ,_ :=_bb .GetBoolVal (_fafg .ImageMask );_aed {_ecc =_ccdc (_agd ,_eee );}else {_ecc ,_eba =_agd .ToGoImage ();if _eba !=nil {_dd .Log .Debug ("\u0052\u0065\u006e\u0064\u0065\u0072\u0069\u006e\u0067\u0020\u0072\u0065\u0073\u0075\u006c\u0074\u0020\u006day\u0020b\u0065\u0020\u0069\u006e\u0063\u006f\u006d\u0070\u006c\u0065\u0074\u0065.\u0020\u0049\u006d\u0061\u0067\u0065\u0020\u0063\u006f\u006e\u0076\u0065\u0072\u0073\u0069\u006f\u006e \u0065\u0072\u0072\u006f\u0072\u003a\u0020\u0025\u0076",_eba );
|
|
return nil ;};};if _egaf !=nil {_ecc =_ffgf (_ecc ,_egaf );};_ggfc :=_ecc .Bounds ();_ab .Push ();_ab .Scale (1.0/float64 (_ggfc .Dx ()),-1.0/float64 (_ggfc .Dy ()));_ab .DrawImageAnchored (_ecc ,0,0,0,1);_ab .Pop ();case _gb .XObjectTypeForm :_dd .Log .Debug ("\u0058\u004fb\u006a\u0065\u0063t\u0020\u0066\u006f\u0072\u006d\u003a\u0020\u0025\u0073",_bac .String ());
|
|
_cgfe ,_aeb :=_feb .GetXObjectFormByName (*_bac );if _aeb !=nil {return _aeb ;};_dccc ,_aeb :=_cgfe .GetContentStream ();if _aeb !=nil {return _aeb ;};_cde :=_cgfe .Resources ;if _cde ==nil {_cde =_feb ;};_ab .Push ();if _cgfe .Matrix !=nil {_dfdg ,_fdff :=_bb .GetArray (_cgfe .Matrix );
|
|
if !_fdff {return _baf ;};_egg ,_fde :=_bb .GetNumbersAsFloat (_dfdg .Elements ());if _fde !=nil {return _fde ;};if len (_egg )!=6{return _ege ;};_fdgc :=_de .NewMatrix (_egg [0],_egg [1],_egg [2],_egg [3],_egg [4],_egg [5]);_ab .SetMatrix (_ab .Matrix ().Mult (_fdgc ));
|
|
};if _cgfe .BBox !=nil {_deef ,_adeb :=_bb .GetArray (_cgfe .BBox );if !_adeb {return _baf ;};_eeec ,_aae :=_bb .GetNumbersAsFloat (_deef .Elements ());if _aae !=nil {return _aae ;};if len (_eeec )!=4{_dd .Log .Debug ("\u004c\u0065\u006e\u0020\u003d\u0020\u0025\u0064",len (_eeec ));
|
|
return _ege ;};_ab .DrawRectangle (_eeec [0],_eeec [1],_eeec [2]-_eeec [0],_eeec [3]-_eeec [1]);_ab .SetRGBA (1,0,0,1);_ab .Clip ();}else {_dd .Log .Debug ("\u0045R\u0052\u004fR\u003a\u0020\u0052\u0065q\u0075\u0069\u0072e\u0064\u0020\u0042\u0042\u006f\u0078\u0020\u006d\u0069ss\u0069\u006e\u0067 \u006f\u006e \u0058\u004f\u0062\u006a\u0065\u0063t\u0020\u0046o\u0072\u006d");
|
|
};_aeb =_edf .renderContentStream (_ab ,string (_dccc ),_cde );if _aeb !=nil {return _aeb ;};_ab .Pop ();};case "\u0042\u0049":if len (_fbc .Params )!=1{return _ege ;};_faa ,_efb :=_fbc .Params [0].(*_eb .ContentStreamInlineImage );if !_efb {return nil ;
|
|
};_fff ,_gdd :=_faa .ToImage (_feb );if _gdd !=nil {_dd .Log .Debug ("\u0052\u0065\u006e\u0064\u0065\u0072\u0069\u006e\u0067\u0020\u0072\u0065\u0073\u0075\u006c\u0074\u0020\u006day\u0020b\u0065\u0020\u0069\u006e\u0063\u006f\u006d\u0070\u006c\u0065\u0074\u0065.\u0020\u0049\u006d\u0061\u0067\u0065\u0020\u0063\u006f\u006e\u0076\u0065\u0072\u0073\u0069\u006f\u006e \u0065\u0072\u0072\u006f\u0072\u003a\u0020\u0025\u0076",_gdd );
|
|
return nil ;};_gcbd ,_gdd :=_fff .ToGoImage ();if _gdd !=nil {_dd .Log .Debug ("\u0052\u0065\u006e\u0064\u0065\u0072\u0069\u006e\u0067\u0020\u0072\u0065\u0073\u0075\u006c\u0074\u0020\u006day\u0020b\u0065\u0020\u0069\u006e\u0063\u006f\u006d\u0070\u006c\u0065\u0074\u0065.\u0020\u0049\u006d\u0061\u0067\u0065\u0020\u0063\u006f\u006e\u0076\u0065\u0072\u0073\u0069\u006f\u006e \u0065\u0072\u0072\u006f\u0072\u003a\u0020\u0025\u0076",_gdd );
|
|
return nil ;};_gda :=_gcbd .Bounds ();_ab .Push ();_ab .Scale (1.0/float64 (_gda .Dx ()),-1.0/float64 (_gda .Dy ()));_ab .DrawImageAnchored (_gcbd ,0,0,0,1);_ab .Pop ();case "\u0042\u0054":_cdd .Reset ();case "\u0045\u0054":_cdd .Reset ();case "\u0054\u0072":if len (_fbc .Params )!=1{return _ege ;
|
|
};_bdd ,_eagd :=_bb .GetNumberAsFloat (_fbc .Params [0]);if _eagd !=nil {return _eagd ;};_cdd .Tr =_bd .TextRenderingMode (_bdd );case "\u0054\u004c":if len (_fbc .Params )!=1{return _ege ;};_cbbb ,_dfc :=_bb .GetNumberAsFloat (_fbc .Params [0]);if _dfc !=nil {return _dfc ;
|
|
};_cdd .Tl =_cbbb ;case "\u0054\u0063":if len (_fbc .Params )!=1{return _ege ;};_cgb ,_adea :=_bb .GetNumberAsFloat (_fbc .Params [0]);if _adea !=nil {return _adea ;};_dd .Log .Debug ("\u0054\u0063\u003a\u0020\u0025\u0076",_cgb );_cdd .Tc =_cgb ;case "\u0054\u0077":if len (_fbc .Params )!=1{return _ege ;
|
|
};_fcad ,_cbf :=_bb .GetNumberAsFloat (_fbc .Params [0]);if _cbf !=nil {return _cbf ;};_dd .Log .Debug ("\u0054\u0077\u003a\u0020\u0025\u0076",_fcad );_cdd .Tw =_fcad ;case "\u0054\u007a":if len (_fbc .Params )!=1{return _ege ;};_cba ,_decd :=_bb .GetNumberAsFloat (_fbc .Params [0]);
|
|
if _decd !=nil {return _decd ;};_cdd .Th =_cba ;case "\u0054\u0073":if len (_fbc .Params )!=1{return _ege ;};_ccd ,_ddda :=_bb .GetNumberAsFloat (_fbc .Params [0]);if _ddda !=nil {return _ddda ;};_cdd .Ts =_ccd ;case "\u0054\u0064":if len (_fbc .Params )!=2{return _ege ;
|
|
};_cbea ,_ffgd :=_bb .GetNumbersAsFloat (_fbc .Params );if _ffgd !=nil {return _ffgd ;};_dd .Log .Debug ("\u0054\u0064\u003a\u0020\u0025\u0076",_cbea );_cdd .ProcTd (_cbea [0],_cbea [1]);case "\u0054\u0044":if len (_fbc .Params )!=2{return _ege ;};_fdfg ,_eaf :=_bb .GetNumbersAsFloat (_fbc .Params );
|
|
if _eaf !=nil {return _eaf ;};_dd .Log .Debug ("\u0054\u0044\u003a\u0020\u0025\u0076",_fdfg );_cdd .ProcTD (_fdfg [0],_fdfg [1]);case "\u0054\u002a":_cdd .ProcTStar ();case "\u0054\u006d":if len (_fbc .Params )!=6{return _ege ;};_gadc ,_eaa :=_bb .GetNumbersAsFloat (_fbc .Params );
|
|
if _eaa !=nil {return _eaa ;};_dd .Log .Debug ("\u0054\u0065x\u0074\u0020\u006da\u0074\u0072\u0069\u0078\u003a\u0020\u0025\u002b\u0076",_gadc );_cdd .ProcTm (_gadc [0],_gadc [1],_gadc [2],_gadc [3],_gadc [4],_gadc [5]);case "\u0027":if len (_fbc .Params )!=1{return _ege ;
|
|
};_cgg ,_gcgg :=_bb .GetStringBytes (_fbc .Params [0]);if !_gcgg {return _baf ;};_dd .Log .Debug ("\u0027\u0020\u0073t\u0072\u0069\u006e\u0067\u003a\u0020\u0025\u0073",string (_cgg ));_cdd .ProcQ (_cgg ,_ab );case "\u0022":if len (_fbc .Params )!=3{return _ege ;
|
|
};_fcf ,_cee :=_bb .GetNumberAsFloat (_fbc .Params [0]);if _cee !=nil {return _cee ;};_fdab ,_cee :=_bb .GetNumberAsFloat (_fbc .Params [1]);if _cee !=nil {return _cee ;};_fbdg ,_bff :=_bb .GetStringBytes (_fbc .Params [2]);if !_bff {return _baf ;};_cdd .ProcDQ (_fbdg ,_fcf ,_fdab ,_ab );
|
|
case "\u0054\u006a":if len (_fbc .Params )!=1{return _ege ;};_gaca ,_afc :=_bb .GetStringBytes (_fbc .Params [0]);if !_afc {return _baf ;};_dd .Log .Debug ("\u0054j\u0020s\u0074\u0072\u0069\u006e\u0067\u003a\u0020\u0060\u0025\u0073\u0060",string (_gaca ));
|
|
_cdd .ProcTj (_gaca ,_ab );case "\u0054\u004a":if len (_fbc .Params )!=1{return _ege ;};_bgb ,_gab :=_bb .GetArray (_fbc .Params [0]);if !_gab {_dd .Log .Debug ("\u0054\u0079\u0070\u0065\u003a\u0020\u0025\u0054",_bgb );return _baf ;};_dd .Log .Debug ("\u0054\u004a\u0020\u0061\u0072\u0072\u0061\u0079\u003a\u0020\u0025\u002b\u0076",_bgb );
|
|
for _ ,_faaf :=range _bgb .Elements (){switch _bcdb :=_faaf .(type ){case *_bb .PdfObjectString :if _bcdb !=nil {_cdd .ProcTj (_bcdb .Bytes (),_ab );};case *_bb .PdfObjectFloat ,*_bb .PdfObjectInteger :_cefg ,_dda :=_bb .GetNumberAsFloat (_bcdb );if _dda ==nil {_cdd .Translate (-_cefg *0.001*_cdd .Tf .Size *_cdd .Th /100.0,0);
|
|
};};};case "\u0054\u0066":if len (_fbc .Params )!=2{return _ege ;};_dd .Log .Debug ("\u0025\u0023\u0076",_fbc .Params );_daeb ,_afcf :=_bb .GetName (_fbc .Params [0]);if !_afcf ||_daeb ==nil {_dd .Log .Debug ("\u0069\u006e\u0076\u0061l\u0069\u0064\u0020\u0066\u006f\u006e\u0074\u0020\u006e\u0061m\u0065 \u006f\u0062\u006a\u0065\u0063\u0074\u003a \u0025\u0076",_fbc .Params [0]);
|
|
return _baf ;};_dd .Log .Debug ("\u0046\u006f\u006e\u0074\u0020\u006e\u0061\u006d\u0065\u003a\u0020\u0025\u0073",_daeb .String ());_adg ,_gff :=_bb .GetNumberAsFloat (_fbc .Params [1]);if _gff !=nil {_dd .Log .Debug ("\u0069\u006e\u0076\u0061l\u0069\u0064\u0020\u0066\u006f\u006e\u0074\u0020\u0073\u0069z\u0065 \u006f\u0062\u006a\u0065\u0063\u0074\u003a \u0025\u0076",_fbc .Params [1]);
|
|
return _baf ;};_dd .Log .Debug ("\u0046\u006f\u006e\u0074\u0020\u0073\u0069\u007a\u0065\u003a\u0020\u0025\u0076",_adg );_eae ,_gaed :=_feb .GetFontByName (*_daeb );if !_gaed {_dd .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0046\u006f\u006e\u0074\u0020\u0025s\u0020\u006e\u006f\u0074\u0020\u0066\u006f\u0075\u006e\u0064",_daeb .String ());
|
|
return _b .New ("\u0066\u006f\u006e\u0074\u0020\u006e\u006f\u0074\u0020f\u006f\u0075\u006e\u0064");};_dd .Log .Debug ("\u0046\u006f\u006e\u0074\u003a\u0020\u0025\u0054",_eae );_ebb ,_afcf :=_bb .GetDict (_eae );if !_afcf {_dd .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0063\u006f\u0075l\u0064\u0020\u006e\u006f\u0074\u0020\u0067e\u0074\u0020\u0066\u006f\u006e\u0074\u0020\u0064\u0069\u0063\u0074");
|
|
return _baf ;};_deb ,_gff :=_gb .NewPdfFontFromPdfObject (_ebb );if _gff !=nil {_dd .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0063\u006f\u0075\u006c\u0064\u0020\u006e\u006f\u0074\u0020\u006c\u006f\u0061\u0064\u0020\u0066\u006fn\u0074\u0020\u0066\u0072\u006fm\u0020\u006fb\u006a\u0065\u0063\u0074");
|
|
return _gff ;};_caeg :=_deb .BaseFont ();if _caeg ==""{_caeg =_daeb .String ();};_ada ,_afcf :=_bbd [_caeg ];if !_afcf {_ada ,_gff =_bd .NewTextFont (_deb ,_adg );if _gff !=nil {_dd .Log .Debug ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_gff );};};
|
|
if _ada ==nil {if len (_caeg )> 7&&_caeg [6]=='+'{_caeg =_caeg [7:];};_effa :=[]string {_caeg ,"\u0054i\u006de\u0073\u0020\u004e\u0065\u0077\u0020\u0052\u006f\u006d\u0061\u006e","\u0041\u0072\u0069a\u006c","D\u0065\u006a\u0061\u0056\u0075\u0020\u0053\u0061\u006e\u0073"};
|
|
for _ ,_aec :=range _effa {_dd .Log .Debug ("\u0044\u0045\u0042\u0055\u0047\u003a \u0073\u0065\u0061\u0072\u0063\u0068\u0069\u006e\u0067\u0020\u0073\u0079\u0073t\u0065\u006d\u0020\u0066\u006f\u006e\u0074 \u0060\u0025\u0073\u0060",_aec );if _ada ,_afcf =_bbd [_aec ];
|
|
_afcf {break ;};_ecg :=_gg .Match (_aec );if _ecg ==nil {_dd .Log .Debug ("c\u006f\u0075\u006c\u0064\u0020\u006eo\u0074\u0020\u0066\u0069\u006e\u0064\u0020\u0066\u006fn\u0074\u0020\u0066i\u006ce\u0020\u0025\u0073",_aec );continue ;};_ada ,_gff =_bd .NewTextFontFromPath (_ecg .Filename ,_adg );
|
|
if _gff !=nil {_dd .Log .Debug ("c\u006f\u0075\u006c\u0064\u0020\u006eo\u0074\u0020\u006c\u006f\u0061\u0064\u0020\u0066\u006fn\u0074\u0020\u0066i\u006ce\u0020\u0025\u0073",_ecg .Filename );continue ;};_dd .Log .Debug ("\u0053\u0075\u0062\u0073\u0074\u0069t\u0075\u0074\u0069\u006e\u0067\u0020\u0066\u006f\u006e\u0074\u0020\u0025\u0073 \u0077\u0069\u0074\u0068\u0020\u0025\u0073 \u0028\u0025\u0073\u0029",_caeg ,_ecg .Name ,_ecg .Filename );
|
|
_bbd [_aec ]=_ada ;break ;};};if _ada ==nil {_dd .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0063\u006f\u0075\u006c\u0064\u0020n\u006f\u0074\u0020\u0066\u0069\u006ed\u0020\u0061\u006e\u0079\u0020\u0073\u0075\u0069\u0074\u0061\u0062\u006c\u0065 \u0066\u006f\u006e\u0074");
|
|
return _b .New ("\u0063\u006f\u0075\u006c\u0064\u0020\u006e\u006f\u0074\u0020\u0066\u0069\u006e\u0064\u0020a\u006ey\u0020\u0073\u0075\u0069\u0074\u0061\u0062\u006c\u0065\u0020\u0066\u006f\u006e\u0074");};_cdd .ProcTf (_ada .WithSize (_adg ,_deb ));case "\u0042\u004d\u0043","\u0042\u0044\u0043":case "\u0045\u004d\u0043":default:_dd .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0075\u006e\u0073u\u0070\u0070\u006f\u0072\u0074\u0065\u0064 \u006f\u0070\u0065\u0072\u0061\u006e\u0064\u003a\u0020\u0025\u0073",_fbc .Operand );
|
|
};_df =_fbc ;return nil ;});_fe =_gba .Process (_fd );if _fe !=nil {return _fe ;};return nil ;};func _gace (_bde _bd .Gradient ,_cgfbb *_gb .PdfFunctionType2 ,_bdbc _gb .PdfColorspace ,_bcfg float64 ,_ebc bool )(_bd .Gradient ,error ){switch _bdbc .(type ){case *_gb .PdfColorspaceDeviceRGB :if len (_cgfbb .C0 )!=3||len (_cgfbb .C1 )!=3{return nil ,_b .New ("\u0069\u006e\u0063\u006f\u0072\u0072\u0065\u0063\u0074\u0020\u0052\u0047\u0042\u0020\u0063o\u006co\u0072\u0020\u0061\u0072\u0072\u0061\u0079\u0020\u006c\u0065\u006e\u0067\u0074\u0068");
|
|
};_eedb :=_cgfbb .C0 ;_ffgb :=_cgfbb .C1 ;if _ebc {_bde .AddColorStop (0.0,_f .RGBA {R :uint8 (_eedb [0]*255),G :uint8 (_eedb [1]*255),B :uint8 (_eedb [2]*255),A :255});};_bde .AddColorStop (_bcfg ,_f .RGBA {R :uint8 (_ffgb [0]*255),G :uint8 (_ffgb [1]*255),B :uint8 (_ffgb [2]*255),A :255});
|
|
case *_gb .PdfColorspaceDeviceCMYK :if len (_cgfbb .C0 )!=4||len (_cgfbb .C1 )!=4{return nil ,_b .New ("\u0069\u006e\u0063\u006f\u0072\u0072e\u0063\u0074\u0020\u0043\u004d\u0059\u004b\u0020\u0063\u006f\u006c\u006f\u0072 \u0061\u0072\u0072\u0061\u0079\u0020\u006ce\u006e\u0067\u0074\u0068");
|
|
};_bacf :=_cgfbb .C0 ;_adgf :=_cgfbb .C1 ;if _ebc {_bde .AddColorStop (0.0,_f .CMYK {C :uint8 (_bacf [0]*255),M :uint8 (_bacf [1]*255),Y :uint8 (_bacf [2]*255),K :uint8 (_bacf [3]*255)});};_bde .AddColorStop (_bcfg ,_f .CMYK {C :uint8 (_adgf [0]*255),M :uint8 (_adgf [1]*255),Y :uint8 (_adgf [2]*255),K :uint8 (_adgf [3]*255)});
|
|
default:return nil ,_ge .Errorf ("u\u006e\u0073\u0075\u0070\u0070\u006fr\u0074\u0065\u0064\u0020\u0063\u006f\u006c\u006f\u0072 \u0073\u0070\u0061c\u0065:\u0020\u0025\u0073",_bdbc .String ());};return _bde ,nil ;};func (_gcf renderer )processRadialShading (_bccb _bd .Context ,_efae *_gb .PdfShading )(_bd .Gradient ,*_bb .PdfObjectArray ,error ){_bcdf :=_efae .GetContext ().(*_gb .PdfShadingType3 );
|
|
if len (_bcdf .Function )==0{return nil ,nil ,_b .New ("\u006e\u006f\u0020\u0067\u0072\u0061\u0064i\u0065\u006e\u0074 \u0066\u0075\u006e\u0063t\u0069\u006f\u006e\u0020\u0066\u006f\u0075\u006e\u0064\u002c\u0020\u0073\u006b\u0069\u0070\u0020\u0063\u006f\u006e\u0076\u0065\u0072\u0073\u0069\u006f\u006e");
|
|
};_ffad ,_ddad :=_bcdf .Coords .ToFloat64Array ();if _ddad !=nil {return nil ,nil ,_b .New ("\u0066\u0061\u0069l\u0065\u0064\u0020\u0067e\u0074\u0074\u0069\u006e\u0067\u0020\u0073h\u0061\u0064\u0069\u006e\u0067\u0020\u0070\u006f\u0073\u0069\u0074\u0069\u006f\u006e");
|
|
};_daf :=_efae .ColorSpace ;_agad :=_bb .MakeArrayFromFloats ([]float64 {0,0,1,1});var _ede ,_beg ,_ebdb ,_gef ,_gadb ,_fceb float64 ;_ede ,_beg =_bccb .Matrix ().Transform (_ffad [0],_ffad [1]);_ebdb ,_gef =_bccb .Matrix ().Transform (_ffad [3],_ffad [4]);
|
|
_gadb ,_ =_bccb .Matrix ().Transform (_ffad [2],0);_fceb ,_ =_bccb .Matrix ().Transform (_ffad [5],0);_bcdg ,_ :=_bccb .Matrix ().Translation ();_gadb -=_bcdg ;_fceb -=_bcdg ;for _caa ,_ccec :=range _ffad {if _caa ==2||_caa ==5{continue ;};if _ccec > 1.0{_cfd :=_cf .Min (_ede -_gadb ,_ebdb -_fceb );
|
|
_ece :=_cf .Min (_beg -_gadb ,_gef -_fceb );_cgbd :=_cf .Max (_ede +_gadb ,_ebdb +_fceb );_gaa :=_cf .Max (_beg +_gadb ,_gef +_fceb );_gcbb :=_cgbd -_cfd ;_ccdd :=_ece -_gaa ;_agad =_bb .MakeArrayFromFloats ([]float64 {_cfd ,_ece ,_gcbb ,_ccdd });break ;
|
|
};};_cbdf :=_bbe .NewRadialGradient (_ede ,_beg ,_gadb ,_ebdb ,_gef ,_fceb );if _eef ,_gbd :=_bcdf .Function [0].(*_gb .PdfFunctionType2 );_gbd {_cbdf ,_ddad =_gace (_cbdf ,_eef ,_daf ,1.0,true );}else if _aaf ,_dcg :=_bcdf .Function [0].(*_gb .PdfFunctionType3 );
|
|
_dcg {_fge :=append ([]float64 {0},_aaf .Bounds ...);_fge =append (_fge ,1.0);_cbdf ,_ddad =_dfa (_cbdf ,_aaf ,_daf ,_fge );};if _ddad !=nil {return nil ,nil ,_ddad ;};return _cbdf ,_agad ,nil ;};func _ebfa (_fdgg string ,_bacd _dc .Image )error {_aca ,_eab :=_d .Create (_fdgg );
|
|
if _eab !=nil {return _eab ;};defer _aca .Close ();return _a .Encode (_aca ,_bacd );};func (_gege renderer )processLinearShading (_bcb _bd .Context ,_abb *_gb .PdfShading )(_bd .Gradient ,*_bb .PdfObjectArray ,error ){_eagf :=_abb .GetContext ().(*_gb .PdfShadingType2 );
|
|
if len (_eagf .Function )==0{return nil ,nil ,_b .New ("\u006e\u006f\u0020\u0067\u0072\u0061\u0064i\u0065\u006e\u0074 \u0066\u0075\u006e\u0063t\u0069\u006f\u006e\u0020\u0066\u006f\u0075\u006e\u0064\u002c\u0020\u0073\u006b\u0069\u0070\u0020\u0063\u006f\u006e\u0076\u0065\u0072\u0073\u0069\u006f\u006e");
|
|
};_gbf ,_ged :=_eagf .Coords .ToFloat64Array ();if _ged !=nil {return nil ,nil ,_b .New ("\u0066\u0061\u0069l\u0065\u0064\u0020\u0067e\u0074\u0074\u0069\u006e\u0067\u0020\u0073h\u0061\u0064\u0069\u006e\u0067\u0020\u0070\u006f\u0073\u0069\u0074\u0069\u006f\u006e");
|
|
};_dcd :=_abb .ColorSpace ;_aaag ,_bcbg :=_bcb .Matrix ().Transform (_gbf [0],_gbf [1]);_gffg ,_bgac :=_bcb .Matrix ().Transform (_gbf [2],_gbf [3]);_egag :=_bbe .NewLinearGradient (_aaag ,_bcbg ,_gffg ,_bgac );_dbeb :=_bb .MakeArrayFromFloats ([]float64 {0,0,1,1});
|
|
for _ ,_bag :=range _gbf {if _bag > 1{_dbeb =_eagf .Coords ;break ;};};if _aage ,_egb :=_eagf .Function [0].(*_gb .PdfFunctionType2 );_egb {_egag ,_ged =_gace (_egag ,_aage ,_dcd ,1.0,true );}else if _ggg ,_dgae :=_eagf .Function [0].(*_gb .PdfFunctionType3 );
|
|
_dgae {_aaec :=append ([]float64 {0},_ggg .Bounds ...);_aaec =append (_aaec ,1.0);_egag ,_ged =_dfa (_egag ,_ggg ,_dcd ,_aaec );};return _egag ,_dbeb ,_ged ;}; |