unipdf/contentstream/contentstream.go
2020-10-05 19:28:24 +00:00

555 lines
109 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 contentstream provides functionality for parsing and creating content streams for PDF files.
//
// For processing and manipulating content streams, it allows parse the content stream into a list of
// operands that can then be processed further for rendering or extraction of information.
// The ContentStreamProcessor offers a basic engine for processing the content stream and can be used
// to render or modify the contents.
//
// For creating content streams, see NewContentCreator. It allows adding multiple operands and then can
// be converted to a string for embedding in a PDF file.
//
// The contentstream package uses the core and model packages.
package contentstream ;import (_bg "bufio";_gd "bytes";_e "encoding/hex";_b "errors";_dg "fmt";_cc "github.com/unidoc/unipdf/v3/common";_fc "github.com/unidoc/unipdf/v3/core";_c "github.com/unidoc/unipdf/v3/internal/imageutil";_bgc "github.com/unidoc/unipdf/v3/internal/transform";_ca "github.com/unidoc/unipdf/v3/model";_g "image/color";_d "image/jpeg";_ea "io";_f "math";_bc "strconv";);
// Add_s appends 's' operand to the content stream: Close and stroke the path.
//
// See section 8.5.3 "Path Painting Operators" and Table 60 (p. 143 PDF32000_2008).
func (_bcd *ContentCreator )Add_s ()*ContentCreator {_ddf :=ContentStreamOperation {};_ddf .Operand ="\u0073";_bcd ._fge =append (_bcd ._fge ,&_ddf );return _bcd ;};
// Add_Tstar appends 'T*' operand to the content stream:
// Move to the start of next line.
//
// See section 9.4.2 "Text Positioning Operators" and
// Table 108 (pp. 257-258 PDF32000_2008).
func (_cbd *ContentCreator )Add_Tstar ()*ContentCreator {_ccff :=ContentStreamOperation {};_ccff .Operand ="\u0054\u002a";_cbd ._fge =append (_cbd ._fge ,&_ccff );return _cbd ;};
// Add_Do adds 'Do' operation to the content stream:
// Displays an XObject (image or form) specified by `name`.
//
// See section 8.8 "External Objects" and Table 87 (pp. 209-220 PDF32000_2008).
func (_agb *ContentCreator )Add_Do (name _fc .PdfObjectName )*ContentCreator {_aae :=ContentStreamOperation {};_aae .Operand ="\u0044\u006f";_aae .Params =_cfcb ([]_fc .PdfObjectName {name });_agb ._fge =append (_agb ._fge ,&_aae );return _agb ;};
// Add_l adds 'l' operand to the content stream:
// Append a straight line segment from the current point to (x,y).
//
// See section 8.5.2 "Path Construction Operators" and Table 59 (pp. 140-141 PDF32000_2008).
func (_db *ContentCreator )Add_l (x ,y float64 )*ContentCreator {_cb :=ContentStreamOperation {};_cb .Operand ="\u006c";_cb .Params =_deec ([]float64 {x ,y });_db ._fge =append (_db ._fge ,&_cb );return _db ;};
// Add_scn appends 'scn' operand to the content stream:
// Same as SC but for nonstroking operations.
//
// See section 8.6.8 "Colour Operators" and Table 74 (p. 179-180 PDF32000_2008).
func (_aea *ContentCreator )Add_scn (c ...float64 )*ContentCreator {_ecd :=ContentStreamOperation {};_ecd .Operand ="\u0073\u0063\u006e";_ecd .Params =_deec (c );_aea ._fge =append (_aea ._fge ,&_ecd );return _aea ;};var _febg =map[string ]struct{}{"\u0062":struct{}{},"\u0042":struct{}{},"\u0062\u002a":struct{}{},"\u0042\u002a":struct{}{},"\u0042\u0044\u0043":struct{}{},"\u0042\u0049":struct{}{},"\u0042\u004d\u0043":struct{}{},"\u0042\u0054":struct{}{},"\u0042\u0058":struct{}{},"\u0063":struct{}{},"\u0063\u006d":struct{}{},"\u0043\u0053":struct{}{},"\u0063\u0073":struct{}{},"\u0064":struct{}{},"\u0064\u0030":struct{}{},"\u0064\u0031":struct{}{},"\u0044\u006f":struct{}{},"\u0044\u0050":struct{}{},"\u0045\u0049":struct{}{},"\u0045\u004d\u0043":struct{}{},"\u0045\u0054":struct{}{},"\u0045\u0058":struct{}{},"\u0066":struct{}{},"\u0046":struct{}{},"\u0066\u002a":struct{}{},"\u0047":struct{}{},"\u0067":struct{}{},"\u0067\u0073":struct{}{},"\u0068":struct{}{},"\u0069":struct{}{},"\u0049\u0044":struct{}{},"\u006a":struct{}{},"\u004a":struct{}{},"\u004b":struct{}{},"\u006b":struct{}{},"\u006c":struct{}{},"\u006d":struct{}{},"\u004d":struct{}{},"\u004d\u0050":struct{}{},"\u006e":struct{}{},"\u0071":struct{}{},"\u0051":struct{}{},"\u0072\u0065":struct{}{},"\u0052\u0047":struct{}{},"\u0072\u0067":struct{}{},"\u0072\u0069":struct{}{},"\u0073":struct{}{},"\u0053":struct{}{},"\u0053\u0043":struct{}{},"\u0073\u0063":struct{}{},"\u0053\u0043\u004e":struct{}{},"\u0073\u0063\u006e":struct{}{},"\u0073\u0068":struct{}{},"\u0054\u002a":struct{}{},"\u0054\u0063":struct{}{},"\u0054\u0064":struct{}{},"\u0054\u0044":struct{}{},"\u0054\u0066":struct{}{},"\u0054\u006a":struct{}{},"\u0054\u004a":struct{}{},"\u0054\u004c":struct{}{},"\u0054\u006d":struct{}{},"\u0054\u0072":struct{}{},"\u0054\u0073":struct{}{},"\u0054\u0077":struct{}{},"\u0054\u007a":struct{}{},"\u0076":struct{}{},"\u0077":struct{}{},"\u0057":struct{}{},"\u0057\u002a":struct{}{},"\u0079":struct{}{},"\u0027":struct{}{},"\u0022":struct{}{}};func (_efdf *ContentStreamInlineImage )String ()string {_cad :=_dg .Sprintf ("I\u006el\u0069\u006e\u0065\u0049\u006d\u0061\u0067\u0065(\u006c\u0065\u006e\u003d%d\u0029\u000a",len (_efdf ._cgbf ));if _efdf .BitsPerComponent !=nil {_cad +="\u002d\u0020\u0042\u0050\u0043\u0020"+_efdf .BitsPerComponent .WriteString ()+"\u000a";};if _efdf .ColorSpace !=nil {_cad +="\u002d\u0020\u0043S\u0020"+_efdf .ColorSpace .WriteString ()+"\u000a";};if _efdf .Decode !=nil {_cad +="\u002d\u0020\u0044\u0020"+_efdf .Decode .WriteString ()+"\u000a";};if _efdf .DecodeParms !=nil {_cad +="\u002d\u0020\u0044P\u0020"+_efdf .DecodeParms .WriteString ()+"\u000a";};if _efdf .Filter !=nil {_cad +="\u002d\u0020\u0046\u0020"+_efdf .Filter .WriteString ()+"\u000a";};if _efdf .Height !=nil {_cad +="\u002d\u0020\u0048\u0020"+_efdf .Height .WriteString ()+"\u000a";};if _efdf .ImageMask !=nil {_cad +="\u002d\u0020\u0049M\u0020"+_efdf .ImageMask .WriteString ()+"\u000a";};if _efdf .Intent !=nil {_cad +="\u002d \u0049\u006e\u0074\u0065\u006e\u0074 "+_efdf .Intent .WriteString ()+"\u000a";};if _efdf .Interpolate !=nil {_cad +="\u002d\u0020\u0049\u0020"+_efdf .Interpolate .WriteString ()+"\u000a";};if _efdf .Width !=nil {_cad +="\u002d\u0020\u0057\u0020"+_efdf .Width .WriteString ()+"\u000a";};return _cad ;};
// Add_Tf appends 'Tf' operand to the content stream:
// Set font and font size specified by font resource `fontName` and `fontSize`.
//
// See section 9.3 "Text State Parameters and Operators" and
// Table 105 (pp. 251-252 PDF32000_2008).
func (_cea *ContentCreator )Add_Tf (fontName _fc .PdfObjectName ,fontSize float64 )*ContentCreator {_cdb :=ContentStreamOperation {};_cdb .Operand ="\u0054\u0066";_cdb .Params =_cfcb ([]_fc .PdfObjectName {fontName });_cdb .Params =append (_cdb .Params ,_deec ([]float64 {fontSize })...);_cea ._fge =append (_cea ._fge ,&_cdb );return _cea ;};
// String returns `ops.Bytes()` as a string.
func (_ad *ContentStreamOperations )String ()string {return string (_ad .Bytes ())};
// Add_BT appends 'BT' operand to the content stream:
// Begin text.
//
// See section 9.4 "Text Objects" and Table 107 (p. 256 PDF32000_2008).
func (_fcc *ContentCreator )Add_BT ()*ContentCreator {_bgaf :=ContentStreamOperation {};_bgaf .Operand ="\u0042\u0054";_fcc ._fge =append (_fcc ._fge ,&_bgaf );return _fcc ;};
// Add_Tr appends 'Tr' operand to the content stream:
// Set text rendering mode.
//
// See section 9.3 "Text State Parameters and Operators" and
// Table 105 (pp. 251-252 PDF32000_2008).
func (_ecdf *ContentCreator )Add_Tr (render int64 )*ContentCreator {_faec :=ContentStreamOperation {};_faec .Operand ="\u0054\u0072";_faec .Params =_cda ([]int64 {render });_ecdf ._fge =append (_ecdf ._fge ,&_faec );return _ecdf ;};
// Add_d adds 'd' operand to the content stream: Set the line dash pattern.
//
// See section 8.4.4 "Graphic State Operators" and Table 57 (pp. 135-136 PDF32000_2008).
func (_gda *ContentCreator )Add_d (dashArray []int64 ,dashPhase int64 )*ContentCreator {_fdf :=ContentStreamOperation {};_fdf .Operand ="\u0064";_fdf .Params =[]_fc .PdfObject {};_fdf .Params =append (_fdf .Params ,_fc .MakeArrayFromIntegers64 (dashArray ));_fdf .Params =append (_fdf .Params ,_fc .MakeInteger (dashPhase ));_gda ._fge =append (_gda ._fge ,&_fdf );return _gda ;};
// Add_Tz appends 'Tz' operand to the content stream:
// Set horizontal scaling.
//
// See section 9.3 "Text State Parameters and Operators" and
// Table 105 (pp. 251-252 PDF32000_2008).
func (_dec *ContentCreator )Add_Tz (scale float64 )*ContentCreator {_dbc :=ContentStreamOperation {};_dbc .Operand ="\u0054\u007a";_dbc .Params =_deec ([]float64 {scale });_dec ._fge =append (_dec ._fge ,&_dbc );return _dec ;};func (_dda *ContentStreamParser )parseNumber ()(_fc .PdfObject ,error ){return _fc .ParseNumber (_dda ._face );};
// Add_W appends 'W' operand to the content stream:
// Modify the current clipping path by intersecting with the current path (nonzero winding rule).
//
// See section 8.5.4 "Clipping Path Operators" and Table 61 (p. 146 PDF32000_2008).
func (_febd *ContentCreator )Add_W ()*ContentCreator {_dgd :=ContentStreamOperation {};_dgd .Operand ="\u0057";_febd ._fge =append (_febd ._fge ,&_dgd );return _febd ;};
// Add_Tm appends 'Tm' operand to the content stream:
// Set the text line matrix.
//
// See section 9.4.2 "Text Positioning Operators" and
// Table 108 (pp. 257-258 PDF32000_2008).
func (_egeb *ContentCreator )Add_Tm (a ,b ,c ,d ,e ,f float64 )*ContentCreator {_gbbd :=ContentStreamOperation {};_gbbd .Operand ="\u0054\u006d";_gbbd .Params =_deec ([]float64 {a ,b ,c ,d ,e ,f });_egeb ._fge =append (_egeb ._fge ,&_gbbd );return _egeb ;};
// Bytes converts a set of content stream operations to a content stream byte presentation,
// i.e. the kind that can be stored as a PDF stream or string format.
func (_cf *ContentStreamOperations )Bytes ()[]byte {var _fce _gd .Buffer ;for _ ,_feb :=range *_cf {if _feb ==nil {continue ;};if _feb .Operand =="\u0042\u0049"{_fce .WriteString (_feb .Operand +"\u000a");_fce .WriteString (_feb .Params [0].WriteString ());}else {for _ ,_bcc :=range _feb .Params {_fce .WriteString (_bcc .WriteString ());_fce .WriteString ("\u0020");};_fce .WriteString (_feb .Operand +"\u000a");};};return _fce .Bytes ();};
// Operand returns true if `hce` is equivalent to HandlerConditionEnumOperand.
func (_cfga HandlerConditionEnum )Operand ()bool {return _cfga ==HandlerConditionEnumOperand };func (_cbe *ContentStreamProcessor )handleCommand_RG (_baa *ContentStreamOperation ,_fde *_ca .PdfPageResources )error {_aged :=_ca .NewPdfColorspaceDeviceRGB ();if len (_baa .Params )!=_aged .GetNumComponents (){_cc .Log .Debug ("I\u006e\u0076\u0061\u006c\u0069\u0064 \u006e\u0075\u006d\u0062\u0065\u0072 \u006f\u0066\u0020\u0070\u0061\u0072\u0061m\u0065\u0074\u0065\u0072\u0073\u0020\u0066\u006f\u0072\u0020R\u0047");_cc .Log .Debug ("\u004e\u0075mb\u0065\u0072\u0020%\u0064\u0020\u006e\u006ft m\u0061tc\u0068\u0069\u006e\u0067\u0020\u0063\u006flo\u0072\u0073\u0070\u0061\u0063\u0065\u0020%\u0054",len (_baa .Params ),_aged );return _b .New ("\u0069\u006e\u0076\u0061l\u0069\u0064\u0020\u006e\u0075\u006d\u0062\u0065\u0072\u0020o\u0066 \u0070\u0061\u0072\u0061\u006d\u0065\u0074e\u0072\u0073");};_eeab ,_agef :=_aged .ColorFromPdfObjects (_baa .Params );if _agef !=nil {return _agef ;};_cbe ._dcgd .ColorspaceStroking =_aged ;_cbe ._dcgd .ColorStroking =_eeab ;return nil ;};
// Add_y appends 'y' operand to the content stream: Append a Bezier curve to the current path from the
// current point to (x3,y3) with (x1, y1) and (x3,y3) as control points.
//
// See section 8.5.2 "Path Construction Operators" and Table 59 (pp. 140-141 PDF32000_2008).
func (_ccf *ContentCreator )Add_y (x1 ,y1 ,x3 ,y3 float64 )*ContentCreator {_cbf :=ContentStreamOperation {};_cbf .Operand ="\u0079";_cbf .Params =_deec ([]float64 {x1 ,y1 ,x3 ,y3 });_ccf ._fge =append (_ccf ._fge ,&_cbf );return _ccf ;};
// Operations returns the list of operations.
func (_fcd *ContentCreator )Operations ()*ContentStreamOperations {return &_fcd ._fge };
// WrapIfNeeded wraps the entire contents within q ... Q. If unbalanced, then adds extra Qs at the end.
// Only does if needed. Ensures that when adding new content, one start with all states
// in the default condition.
func (_be *ContentStreamOperations )WrapIfNeeded ()*ContentStreamOperations {if len (*_be )==0{return _be ;};if _be .isWrapped (){return _be ;};*_be =append ([]*ContentStreamOperation {{Operand :"\u0071"}},*_be ...);_bf :=0;for _ ,_fe :=range *_be {if _fe .Operand =="\u0071"{_bf ++;}else if _fe .Operand =="\u0051"{_bf --;};};for _bf > 0{*_be =append (*_be ,&ContentStreamOperation {Operand :"\u0051"});_bf --;};return _be ;};
// Add_m adds 'm' operand to the content stream: Move the current point to (x,y).
//
// See section 8.5.2 "Path Construction Operators" and Table 59 (pp. 140-141 PDF32000_2008).
func (_eefd *ContentCreator )Add_m (x ,y float64 )*ContentCreator {_dgfg :=ContentStreamOperation {};_dgfg .Operand ="\u006d";_dgfg .Params =_deec ([]float64 {x ,y });_eefd ._fge =append (_eefd ._fge ,&_dgfg );return _eefd ;};
// Add_cm adds 'cm' operation to the content stream: Modifies the current transformation matrix (ctm)
// of the graphics state.
//
// See section 8.4.4 "Graphic State Operators" and Table 57 (pp. 135-136 PDF32000_2008).
func (_de *ContentCreator )Add_cm (a ,b ,c ,d ,e ,f float64 )*ContentCreator {_ga :=ContentStreamOperation {};_ga .Operand ="\u0063\u006d";_ga .Params =_deec ([]float64 {a ,b ,c ,d ,e ,f });_de ._fge =append (_de ._fge ,&_ga );return _de ;};
// Transform returns coordinates x, y transformed by the CTM.
func (_faeg *GraphicsState )Transform (x ,y float64 )(float64 ,float64 ){return _faeg .CTM .Transform (x ,y );};
// Add_b appends 'b' operand to the content stream:
// Close, fill and then stroke the path (nonzero winding number rule).
//
// See section 8.5.3 "Path Painting Operators" and Table 60 (p. 143 PDF32000_2008).
func (_cbc *ContentCreator )Add_b ()*ContentCreator {_fgg :=ContentStreamOperation {};_fgg .Operand ="\u0062";_cbc ._fge =append (_cbc ._fge ,&_fgg );return _cbc ;};
// Add_ET appends 'ET' operand to the content stream:
// End text.
//
// See section 9.4 "Text Objects" and Table 107 (p. 256 PDF32000_2008).
func (_ccb *ContentCreator )Add_ET ()*ContentCreator {_ade :=ContentStreamOperation {};_ade .Operand ="\u0045\u0054";_ccb ._fge =append (_ccb ._fge ,&_ade );return _ccb ;};func (_bcbc *ContentStreamParser )parseNull ()(_fc .PdfObjectNull ,error ){_ ,_bafc :=_bcbc ._face .Discard (4);return _fc .PdfObjectNull {},_bafc ;};
// GetColorSpace returns the colorspace of the inline image.
func (_fbcd *ContentStreamInlineImage )GetColorSpace (resources *_ca .PdfPageResources )(_ca .PdfColorspace ,error ){if _fbcd .ColorSpace ==nil {_cc .Log .Debug ("\u0049\u006e\u006c\u0069\u006e\u0065\u0020\u0069\u006d\u0061\u0067\u0065\u0020\u006e\u006f\u0074\u0020\u0068\u0061\u0076i\u006e\u0067\u0020\u0073\u0070\u0065\u0063\u0069\u0066\u0069\u0065\u0064\u0020\u0063\u006f\u006c\u006f\u0072\u0073\u0070\u0061\u0063\u0065\u002c\u0020\u0061\u0073\u0073\u0075\u006di\u006e\u0067\u0020\u0047\u0072a\u0079");return _ca .NewPdfColorspaceDeviceGray (),nil ;};if _ebbf ,_dgc :=_fbcd .ColorSpace .(*_fc .PdfObjectArray );_dgc {return _cecge (_ebbf );};_gecd ,_eaa :=_fbcd .ColorSpace .(*_fc .PdfObjectName );if !_eaa {_cc .Log .Debug ("E\u0072\u0072\u006f\u0072\u003a\u0020I\u006e\u0076\u0061\u006c\u0069\u0064 \u006f\u0062\u006a\u0065\u0063\u0074\u0020t\u0079\u0070\u0065\u0020\u0028\u0025\u0054\u003b\u0025\u002bv\u0029",_fbcd .ColorSpace ,_fbcd .ColorSpace );return nil ,_b .New ("\u0074\u0079p\u0065\u0020\u0063h\u0065\u0063\u006b\u0020\u0065\u0072\u0072\u006f\u0072");};if *_gecd =="\u0047"||*_gecd =="\u0044\u0065\u0076\u0069\u0063\u0065\u0047\u0072\u0061\u0079"{return _ca .NewPdfColorspaceDeviceGray (),nil ;}else if *_gecd =="\u0052\u0047\u0042"||*_gecd =="\u0044e\u0076\u0069\u0063\u0065\u0052\u0047B"{return _ca .NewPdfColorspaceDeviceRGB (),nil ;}else if *_gecd =="\u0043\u004d\u0059\u004b"||*_gecd =="\u0044\u0065\u0076\u0069\u0063\u0065\u0043\u004d\u0059\u004b"{return _ca .NewPdfColorspaceDeviceCMYK (),nil ;}else if *_gecd =="\u0049"||*_gecd =="\u0049n\u0064\u0065\u0078\u0065\u0064"{return nil ,_b .New ("\u0075\u006e\u0073\u0075p\u0070\u006f\u0072\u0074\u0065\u0064\u0020\u0049\u006e\u0064e\u0078 \u0063\u006f\u006c\u006f\u0072\u0073\u0070a\u0063\u0065");}else {if resources .ColorSpace ==nil {_cc .Log .Debug ("\u0045\u0072r\u006f\u0072\u002c\u0020\u0075\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u0020\u0069\u006e\u006c\u0069\u006e\u0065\u0020\u0069\u006d\u0061\u0067\u0065\u0020\u0063\u006f\u006c\u006f\u0072\u0073\u0070\u0061\u0063\u0065\u003a\u0020\u0025\u0073",*_gecd );return nil ,_b .New ("\u0075n\u006bn\u006f\u0077\u006e\u0020\u0063o\u006c\u006fr\u0073\u0070\u0061\u0063\u0065");};_fgga ,_fdg :=resources .GetColorspaceByName (*_gecd );if !_fdg {_cc .Log .Debug ("\u0045\u0072r\u006f\u0072\u002c\u0020\u0075\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u0020\u0069\u006e\u006c\u0069\u006e\u0065\u0020\u0069\u006d\u0061\u0067\u0065\u0020\u0063\u006f\u006c\u006f\u0072\u0073\u0070\u0061\u0063\u0065\u003a\u0020\u0025\u0073",*_gecd );return nil ,_b .New ("\u0075n\u006bn\u006f\u0077\u006e\u0020\u0063o\u006c\u006fr\u0073\u0070\u0061\u0063\u0065");};return _fgga ,nil ;};};
// Bytes converts the content stream operations to a content stream byte presentation, i.e. the kind that can be
// stored as a PDF stream or string format.
func (_fca *ContentCreator )Bytes ()[]byte {return _fca ._fge .Bytes ()};
// Add_sh appends 'sh' operand to the content stream:
// Paints the shape and colour shading described by a shading dictionary specified by `name`,
// subject to the current clipping path
//
// See section 8.7.4 "Shading Patterns" and Table 77 (p. 190 PDF32000_2008).
func (_gea *ContentCreator )Add_sh (name _fc .PdfObjectName )*ContentCreator {_ef :=ContentStreamOperation {};_ef .Operand ="\u0073\u0068";_ef .Params =_cfcb ([]_fc .PdfObjectName {name });_gea ._fge =append (_gea ._fge ,&_ef );return _gea ;};func (_fbbg *ContentStreamProcessor )handleCommand_CS (_bceg *ContentStreamOperation ,_gecg *_ca .PdfPageResources )error {if len (_bceg .Params )< 1{_cc .Log .Debug ("\u0049\u006e\u0076\u0061\u006c\u0069d\u0020\u0063\u0073\u0020\u0063\u006f\u006d\u006d\u0061\u006e\u0064\u002c\u0020s\u006b\u0069\u0070\u0070\u0069\u006e\u0067 \u006f\u0076\u0065\u0072");return _b .New ("\u0074o\u006f \u0066\u0065\u0077\u0020\u0070a\u0072\u0061m\u0065\u0074\u0065\u0072\u0073");};if len (_bceg .Params )> 1{_cc .Log .Debug ("\u0063\u0073\u0020\u0063\u006f\u006d\u006d\u0061n\u0064\u0020\u0077it\u0068\u0020\u0074\u006f\u006f\u0020m\u0061\u006e\u0079\u0020\u0070\u0061\u0072\u0061\u006d\u0065\u0074\u0065\u0072\u0073\u0020-\u0020\u0063\u006f\u006e\u0074\u0069\u006e\u0075i\u006e\u0067");return _b .New ("\u0074\u006f\u006f\u0020ma\u006e\u0079\u0020\u0070\u0061\u0072\u0061\u006d\u0065\u0074\u0065\u0072\u0073");};_bgca ,_dbgg :=_bceg .Params [0].(*_fc .PdfObjectName );if !_dbgg {_cc .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020c\u0073\u0020\u0063o\u006d\u006d\u0061n\u0064\u0020w\u0069\u0074\u0068\u0020\u0069\u006ev\u0061li\u0064\u0020\u0070\u0061\u0072\u0061\u006d\u0065\u0074\u0065\u0072\u002c\u0020\u0073\u006b\u0069\u0070\u0070\u0069\u006e\u0067\u0020\u006f\u0076\u0065\u0072");return _b .New ("\u0074\u0079p\u0065\u0020\u0063h\u0065\u0063\u006b\u0020\u0065\u0072\u0072\u006f\u0072");};_fff ,_cgde :=_fbbg .getColorspace (string (*_bgca ),_gecg );if _cgde !=nil {return _cgde ;};_fbbg ._dcgd .ColorspaceStroking =_fff ;_dbad ,_cgde :=_fbbg .getInitialColor (_fff );if _cgde !=nil {return _cgde ;};_fbbg ._dcgd .ColorStroking =_dbad ;return nil ;};
// WriteString outputs the object as it is to be written to file.
func (_agd *ContentStreamInlineImage )WriteString ()string {var _dbdg _gd .Buffer ;_dgbd :="";if _agd .BitsPerComponent !=nil {_dgbd +="\u002f\u0042\u0050C\u0020"+_agd .BitsPerComponent .WriteString ()+"\u000a";};if _agd .ColorSpace !=nil {_dgbd +="\u002f\u0043\u0053\u0020"+_agd .ColorSpace .WriteString ()+"\u000a";};if _agd .Decode !=nil {_dgbd +="\u002f\u0044\u0020"+_agd .Decode .WriteString ()+"\u000a";};if _agd .DecodeParms !=nil {_dgbd +="\u002f\u0044\u0050\u0020"+_agd .DecodeParms .WriteString ()+"\u000a";};if _agd .Filter !=nil {_dgbd +="\u002f\u0046\u0020"+_agd .Filter .WriteString ()+"\u000a";};if _agd .Height !=nil {_dgbd +="\u002f\u0048\u0020"+_agd .Height .WriteString ()+"\u000a";};if _agd .ImageMask !=nil {_dgbd +="\u002f\u0049\u004d\u0020"+_agd .ImageMask .WriteString ()+"\u000a";};if _agd .Intent !=nil {_dgbd +="\u002f\u0049\u006e\u0074\u0065\u006e\u0074\u0020"+_agd .Intent .WriteString ()+"\u000a";};if _agd .Interpolate !=nil {_dgbd +="\u002f\u0049\u0020"+_agd .Interpolate .WriteString ()+"\u000a";};if _agd .Width !=nil {_dgbd +="\u002f\u0057\u0020"+_agd .Width .WriteString ()+"\u000a";};_dbdg .WriteString (_dgbd );_dbdg .WriteString ("\u0049\u0044\u0020");_dbdg .Write (_agd ._cgbf );_dbdg .WriteString ("\u000a\u0045\u0049\u000a");return _dbdg .String ();};
// All returns true if `hce` is equivalent to HandlerConditionEnumAllOperands.
func (_bfg HandlerConditionEnum )All ()bool {return _bfg ==HandlerConditionEnumAllOperands };
// ContentCreator is a builder for PDF content streams.
type ContentCreator struct{_fge ContentStreamOperations };
// Add_k appends 'k' operand to the content stream:
// Same as K but used for nonstroking operations.
//
// See section 8.6.8 "Colour Operators" and Table 74 (p. 179-180 PDF32000_2008).
func (_ebb *ContentCreator )Add_k (c ,m ,y ,k float64 )*ContentCreator {_fdd :=ContentStreamOperation {};_fdd .Operand ="\u006b";_fdd .Params =_deec ([]float64 {c ,m ,y ,k });_ebb ._fge =append (_ebb ._fge ,&_fdd );return _ebb ;};
// Add_SCN appends 'SCN' operand to the content stream:
// Same as SC but supports more colorspaces.
//
// See section 8.6.8 "Colour Operators" and Table 74 (p. 179-180 PDF32000_2008).
func (_aff *ContentCreator )Add_SCN (c ...float64 )*ContentCreator {_bfcd :=ContentStreamOperation {};_bfcd .Operand ="\u0053\u0043\u004e";_bfcd .Params =_deec (c );_aff ._fge =append (_aff ._fge ,&_bfcd );return _aff ;};func _cda (_acce []int64 )[]_fc .PdfObject {var _bda []_fc .PdfObject ;for _ ,_aad :=range _acce {_bda =append (_bda ,_fc .MakeInteger (_aad ));};return _bda ;};
// GraphicsState is a basic graphics state implementation for PDF processing.
// Initially only implementing and tracking a portion of the information specified. Easy to add more.
type GraphicsState struct{ColorspaceStroking _ca .PdfColorspace ;ColorspaceNonStroking _ca .PdfColorspace ;ColorStroking _ca .PdfColor ;ColorNonStroking _ca .PdfColor ;CTM _bgc .Matrix ;};
// Add_EMC appends 'EMC' operand to the content stream:
// Ends a marked-content sequence.
//
// See section 14.6 "Marked Content" and Table 320 (p. 561 PDF32000_2008).
func (_bcf *ContentCreator )Add_EMC ()*ContentCreator {_fee :=ContentStreamOperation {};_fee .Operand ="\u0045\u004d\u0043";_bcf ._fge =append (_bcf ._fge ,&_fee );return _bcf ;};func (_gdae *ContentStreamProcessor )getColorspace (_fceg string ,_daf *_ca .PdfPageResources )(_ca .PdfColorspace ,error ){switch _fceg {case "\u0044\u0065\u0076\u0069\u0063\u0065\u0047\u0072\u0061\u0079":return _ca .NewPdfColorspaceDeviceGray (),nil ;case "\u0044e\u0076\u0069\u0063\u0065\u0052\u0047B":return _ca .NewPdfColorspaceDeviceRGB (),nil ;case "\u0044\u0065\u0076\u0069\u0063\u0065\u0043\u004d\u0059\u004b":return _ca .NewPdfColorspaceDeviceCMYK (),nil ;case "\u0050a\u0074\u0074\u0065\u0072\u006e":return _ca .NewPdfColorspaceSpecialPattern (),nil ;};_bafcg ,_ddff :=_daf .GetColorspaceByName (_fc .PdfObjectName (_fceg ));if _ddff {return _bafcg ,nil ;};switch _fceg {case "\u0043a\u006c\u0047\u0072\u0061\u0079":return _ca .NewPdfColorspaceCalGray (),nil ;case "\u0043\u0061\u006c\u0052\u0047\u0042":return _ca .NewPdfColorspaceCalRGB (),nil ;case "\u004c\u0061\u0062":return _ca .NewPdfColorspaceLab (),nil ;};_cc .Log .Debug ("\u0055\u006e\u006b\u006e\u006f\u0077\u006e\u0020\u0063\u006f\u006c\u006f\u0072\u0073\u0070a\u0063e\u0020\u0072\u0065\u0071\u0075\u0065\u0073\u0074\u0065\u0064\u003a\u0020\u0025\u0073",_fceg );return nil ,_dg .Errorf ("\u0075\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064 \u0063\u006f\u006c\u006f\u0072\u0073\u0070\u0061\u0063\u0065:\u0020\u0025\u0073",_fceg );};
// Add_Tc appends 'Tc' operand to the content stream:
// Set character spacing.
//
// See section 9.3 "Text State Parameters and Operators" and
// Table 105 (pp. 251-252 PDF32000_2008).
func (_egf *ContentCreator )Add_Tc (charSpace float64 )*ContentCreator {_dad :=ContentStreamOperation {};_dad .Operand ="\u0054\u0063";_dad .Params =_deec ([]float64 {charSpace });_egf ._fge =append (_egf ._fge ,&_dad );return _egf ;};func (_aag *ContentStreamProcessor )handleCommand_cm (_gaea *ContentStreamOperation ,_agfb *_ca .PdfPageResources )error {if len (_gaea .Params )!=6{_cc .Log .Debug ("\u0045\u0052R\u004f\u0052\u003a\u0020\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u006e\u0075\u006d\u0062\u0065\u0072\u0020\u006f\u0066\u0020\u0070\u0061\u0072\u0061\u006d\u0065\u0074\u0065\u0072\u0073\u0020\u0066\u006f\u0072\u0020\u0063\u006d\u003a\u0020\u0025\u0064",len (_gaea .Params ));return _b .New ("\u0069\u006e\u0076\u0061l\u0069\u0064\u0020\u006e\u0075\u006d\u0062\u0065\u0072\u0020o\u0066 \u0070\u0061\u0072\u0061\u006d\u0065\u0074e\u0072\u0073");};_bgea ,_gdfc :=_fc .GetNumbersAsFloat (_gaea .Params );if _gdfc !=nil {return _gdfc ;};_fffb :=_bgc .NewMatrix (_bgea [0],_bgea [1],_bgea [2],_bgea [3],_bgea [4],_bgea [5]);_aag ._dcgd .CTM .Concat (_fffb );return nil ;};
// ExtractText parses and extracts all text data in content streams and returns as a string.
// Does not take into account Encoding table, the output is simply the character codes.
//
// Deprecated: More advanced text extraction is offered in package extractor with character encoding support.
func (_ac *ContentStreamParser )ExtractText ()(string ,error ){_bb ,_af :=_ac .Parse ();if _af !=nil {return "",_af ;};_dfb :=false ;_ec ,_aeb :=float64 (-1),float64 (-1);_ge :="";for _ ,_fg :=range *_bb {if _fg .Operand =="\u0042\u0054"{_dfb =true ;}else if _fg .Operand =="\u0045\u0054"{_dfb =false ;};if _fg .Operand =="\u0054\u0064"||_fg .Operand =="\u0054\u0044"||_fg .Operand =="\u0054\u002a"{_ge +="\u000a";};if _fg .Operand =="\u0054\u006d"{if len (_fg .Params )!=6{continue ;};_aaa ,_age :=_fg .Params [4].(*_fc .PdfObjectFloat );if !_age {_dgg ,_beb :=_fg .Params [4].(*_fc .PdfObjectInteger );if !_beb {continue ;};_aaa =_fc .MakeFloat (float64 (*_dgg ));};_fdc ,_age :=_fg .Params [5].(*_fc .PdfObjectFloat );if !_age {_gg ,_fa :=_fg .Params [5].(*_fc .PdfObjectInteger );if !_fa {continue ;};_fdc =_fc .MakeFloat (float64 (*_gg ));};if _aeb ==-1{_aeb =float64 (*_fdc );}else if _aeb > float64 (*_fdc ){_ge +="\u000a";_ec =float64 (*_aaa );_aeb =float64 (*_fdc );continue ;};if _ec ==-1{_ec =float64 (*_aaa );}else if _ec < float64 (*_aaa ){_ge +="\u0009";_ec =float64 (*_aaa );};};if _dfb &&_fg .Operand =="\u0054\u004a"{if len (_fg .Params )< 1{continue ;};_dfg ,_ggd :=_fg .Params [0].(*_fc .PdfObjectArray );if !_ggd {return "",_dg .Errorf ("\u0069\u006ev\u0061\u006c\u0069\u0064 \u0070\u0061r\u0061\u006d\u0065\u0074\u0065\u0072\u0020\u0074y\u0070\u0065\u002c\u0020\u006e\u006f\u0020\u0061\u0072\u0072\u0061\u0079 \u0028\u0025\u0054\u0029",_fg .Params [0]);};for _ ,_adg :=range _dfg .Elements (){switch _cg :=_adg .(type ){case *_fc .PdfObjectString :_ge +=_cg .Str ();case *_fc .PdfObjectFloat :if *_cg < -100{_ge +="\u0020";};case *_fc .PdfObjectInteger :if *_cg < -100{_ge +="\u0020";};};};}else if _dfb &&_fg .Operand =="\u0054\u006a"{if len (_fg .Params )< 1{continue ;};_bbd ,_cfd :=_fg .Params [0].(*_fc .PdfObjectString );if !_cfd {return "",_dg .Errorf ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0070\u0061\u0072\u0061\u006de\u0074\u0065\u0072\u0020\u0074\u0079p\u0065\u002c\u0020\u006e\u006f\u0074\u0020\u0073\u0074\u0072\u0069\u006e\u0067 \u0028\u0025\u0054\u0029",_fg .Params [0]);};_ge +=_bbd .Str ();};};return _ge ,nil ;};
// Add_SCN_pattern appends 'SCN' operand to the content stream for pattern `name`:
// SCN with name attribute (for pattern). Syntax: c1 ... cn name SCN.
//
// See section 8.6.8 "Colour Operators" and Table 74 (p. 179-180 PDF32000_2008).
func (_ege *ContentCreator )Add_SCN_pattern (name _fc .PdfObjectName ,c ...float64 )*ContentCreator {_fef :=ContentStreamOperation {};_fef .Operand ="\u0053\u0043\u004e";_fef .Params =_deec (c );_fef .Params =append (_fef .Params ,_fc .MakeName (string (name )));_ege ._fge =append (_ege ._fge ,&_fef );return _ege ;};
// Add_re appends 're' operand to the content stream:
// Append a rectangle to the current path as a complete subpath, with lower left corner (x,y).
//
// See section 8.5.2 "Path Construction Operators" and Table 59 (pp. 140-141 PDF32000_2008).
func (_bcb *ContentCreator )Add_re (x ,y ,width ,height float64 )*ContentCreator {_dbg :=ContentStreamOperation {};_dbg .Operand ="\u0072\u0065";_dbg .Params =_deec ([]float64 {x ,y ,width ,height });_bcb ._fge =append (_bcb ._fge ,&_dbg );return _bcb ;};func _gfcb (_ccd *ContentStreamInlineImage )(*_fc .DCTEncoder ,error ){_dgb :=_fc .NewDCTEncoder ();_cce :=_gd .NewReader (_ccd ._cgbf );_dbga ,_bbdc :=_d .DecodeConfig (_cce );if _bbdc !=nil {_cc .Log .Debug ("\u0045\u0072\u0072or\u0020\u0064\u0065\u0063\u006f\u0064\u0069\u006e\u0067\u0020\u0066\u0069\u006c\u0065\u003a\u0020\u0025\u0073",_bbdc );return nil ,_bbdc ;};switch _dbga .ColorModel {case _g .RGBAModel :_dgb .BitsPerComponent =8;_dgb .ColorComponents =3;case _g .RGBA64Model :_dgb .BitsPerComponent =16;_dgb .ColorComponents =3;case _g .GrayModel :_dgb .BitsPerComponent =8;_dgb .ColorComponents =1;case _g .Gray16Model :_dgb .BitsPerComponent =16;_dgb .ColorComponents =1;case _g .CMYKModel :_dgb .BitsPerComponent =8;_dgb .ColorComponents =4;case _g .YCbCrModel :_dgb .BitsPerComponent =8;_dgb .ColorComponents =3;default:return nil ,_b .New ("\u0075\u006e\u0073up\u0070\u006f\u0072\u0074\u0065\u0064\u0020\u0063\u006f\u006c\u006f\u0072\u0020\u006d\u006f\u0064\u0065\u006c");};_dgb .Width =_dbga .Width ;_dgb .Height =_dbga .Height ;_cc .Log .Trace ("\u0044\u0043T\u0020\u0045\u006ec\u006f\u0064\u0065\u0072\u003a\u0020\u0025\u002b\u0076",_dgb );return _dgb ,nil ;};
// Add_q adds 'q' operand to the content stream: Pushes the current graphics state on the stack.
//
// See section 8.4.4 "Graphic State Operators" and Table 57 (pp. 135-136 PDF32000_2008).
func (_ggdd *ContentCreator )Add_q ()*ContentCreator {_eef :=ContentStreamOperation {};_eef .Operand ="\u0071";_ggdd ._fge =append (_ggdd ._fge ,&_eef );return _ggdd ;};func _cfcb (_dede []_fc .PdfObjectName )[]_fc .PdfObject {var _addc []_fc .PdfObject ;for _ ,_abbd :=range _dede {_addc =append (_addc ,_fc .MakeName (string (_abbd )));};return _addc ;};
// NewInlineImageFromImage makes a new content stream inline image object from an image.
func NewInlineImageFromImage (img _ca .Image ,encoder _fc .StreamEncoder )(*ContentStreamInlineImage ,error ){if encoder ==nil {encoder =_fc .NewRawEncoder ();};encoder .UpdateParams (img .GetParamsDict ());_dbac :=ContentStreamInlineImage {};if img .ColorComponents ==1{_dbac .ColorSpace =_fc .MakeName ("\u0047");}else if img .ColorComponents ==3{_dbac .ColorSpace =_fc .MakeName ("\u0052\u0047\u0042");}else if img .ColorComponents ==4{_dbac .ColorSpace =_fc .MakeName ("\u0043\u004d\u0059\u004b");}else {_cc .Log .Debug ("\u0049\u006e\u0076\u0061\u006c\u0069\u0064 \u006e\u0075\u006db\u0065\u0072\u0020o\u0066\u0020c\u006f\u006c\u006f\u0072\u0020\u0063o\u006dpo\u006e\u0065\u006e\u0074\u0073\u0020\u0066\u006f\u0072\u0020\u0069\u006e\u006c\u0069\u006e\u0065\u0020\u0069\u006d\u0061\u0067\u0065\u003a\u0020\u0025\u0064",img .ColorComponents );return nil ,_b .New ("\u0069\u006e\u0076al\u0069\u0064\u0020\u006e\u0075\u006d\u0062\u0065\u0072 \u006ff\u0020c\u006fl\u006f\u0072\u0020\u0063\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074\u0073");};_dbac .BitsPerComponent =_fc .MakeInteger (img .BitsPerComponent );_dbac .Width =_fc .MakeInteger (img .Width );_dbac .Height =_fc .MakeInteger (img .Height );_adff ,_bbdcg :=encoder .EncodeBytes (img .Data );if _bbdcg !=nil {return nil ,_bbdcg ;};_dbac ._cgbf =_adff ;_cag :=encoder .GetFilterName ();if _cag !=_fc .StreamEncodingFilterNameRaw {_dbac .Filter =_fc .MakeName (_cag );};return &_dbac ,nil ;};func (_ebcg *ContentStreamParser )skipComments ()error {if _ ,_cfc :=_ebcg .skipSpaces ();_cfc !=nil {return _cfc ;};_fcdc :=true ;for {_def ,_eff :=_ebcg ._face .Peek (1);if _eff !=nil {_cc .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u0020\u0025\u0073",_eff .Error ());return _eff ;};if _fcdc &&_def [0]!='%'{return nil ;};_fcdc =false ;if (_def [0]!='\r')&&(_def [0]!='\n'){_ebcg ._face .ReadByte ();}else {break ;};};return _ebcg .skipComments ();};func (_dfag *ContentStreamParser )parseDict ()(*_fc .PdfObjectDictionary ,error ){_cc .Log .Trace ("\u0052\u0065\u0061\u0064i\u006e\u0067\u0020\u0063\u006f\u006e\u0074\u0065\u006e\u0074 \u0073t\u0072\u0065\u0061\u006d\u0020\u0064\u0069c\u0074\u0021");_daee :=_fc .MakeDict ();_caf ,_ :=_dfag ._face .ReadByte ();if _caf !='<'{return nil ,_b .New ("\u0069\u006e\u0076a\u006c\u0069\u0064\u0020\u0064\u0069\u0063\u0074");};_caf ,_ =_dfag ._face .ReadByte ();if _caf !='<'{return nil ,_b .New ("\u0069\u006e\u0076a\u006c\u0069\u0064\u0020\u0064\u0069\u0063\u0074");};for {_dfag .skipSpaces ();_dfc ,_fbde :=_dfag ._face .Peek (2);if _fbde !=nil {return nil ,_fbde ;};_cc .Log .Trace ("D\u0069c\u0074\u0020\u0070\u0065\u0065\u006b\u003a\u0020%\u0073\u0020\u0028\u0025 x\u0029\u0021",string (_dfc ),string (_dfc ));if (_dfc [0]=='>')&&(_dfc [1]=='>'){_cc .Log .Trace ("\u0045\u004f\u0046\u0020\u0064\u0069\u0063\u0074\u0069o\u006e\u0061\u0072\u0079");_dfag ._face .ReadByte ();_dfag ._face .ReadByte ();break ;};_cc .Log .Trace ("\u0050a\u0072s\u0065\u0020\u0074\u0068\u0065\u0020\u006e\u0061\u006d\u0065\u0021");_cffe ,_fbde :=_dfag .parseName ();_cc .Log .Trace ("\u004be\u0079\u003a\u0020\u0025\u0073",_cffe );if _fbde !=nil {_cc .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",_fbde );return nil ,_fbde ;};if len (_cffe )> 4&&_cffe [len (_cffe )-4:]=="\u006e\u0075\u006c\u006c"{_ccae :=_cffe [0:len (_cffe )-4];_cc .Log .Trace ("\u0054\u0061\u006b\u0069n\u0067\u0020\u0063\u0061\u0072\u0065\u0020\u006f\u0066\u0020n\u0075l\u006c\u0020\u0062\u0075\u0067\u0020\u0028%\u0073\u0029",_cffe );_cc .Log .Trace ("\u004e\u0065\u0077\u0020ke\u0079\u0020\u0022\u0025\u0073\u0022\u0020\u003d\u0020\u006e\u0075\u006c\u006c",_ccae );_dfag .skipSpaces ();_bea ,_ :=_dfag ._face .Peek (1);if _bea [0]=='/'{_daee .Set (_ccae ,_fc .MakeNull ());continue ;};};_dfag .skipSpaces ();_gdc ,_ ,_fbde :=_dfag .parseObject ();if _fbde !=nil {return nil ,_fbde ;};_daee .Set (_cffe ,_gdc );_cc .Log .Trace ("\u0064\u0069\u0063\u0074\u005b\u0025\u0073\u005d\u0020\u003d\u0020\u0025\u0073",_cffe ,_gdc .String ());};return _daee ,nil ;};
// Add_scn_pattern appends 'scn' operand to the content stream for pattern `name`:
// scn with name attribute (for pattern). Syntax: c1 ... cn name scn.
//
// See section 8.6.8 "Colour Operators" and Table 74 (p. 179-180 PDF32000_2008).
func (_gac *ContentCreator )Add_scn_pattern (name _fc .PdfObjectName ,c ...float64 )*ContentCreator {_bbe :=ContentStreamOperation {};_bbe .Operand ="\u0073\u0063\u006e";_bbe .Params =_deec (c );_bbe .Params =append (_bbe .Params ,_fc .MakeName (string (name )));_gac ._fge =append (_gac ._fge ,&_bbe );return _gac ;};
// Add_S appends 'S' operand to the content stream: Stroke the path.
//
// See section 8.5.3 "Path Painting Operators" and Table 60 (p. 143 PDF32000_2008).
func (_ada *ContentCreator )Add_S ()*ContentCreator {_beec :=ContentStreamOperation {};_beec .Operand ="\u0053";_ada ._fge =append (_ada ._fge ,&_beec );return _ada ;};func (_ccbc *ContentStreamParser )parseName ()(_fc .PdfObjectName ,error ){_fbd :="";_fcccf :=false ;for {_affd ,_bgcca :=_ccbc ._face .Peek (1);if _bgcca ==_ea .EOF {break ;};if _bgcca !=nil {return _fc .PdfObjectName (_fbd ),_bgcca ;};if !_fcccf {if _affd [0]=='/'{_fcccf =true ;_ccbc ._face .ReadByte ();}else {_cc .Log .Error ("N\u0061\u006d\u0065\u0020\u0073\u0074a\u0072\u0074\u0069\u006e\u0067\u0020\u0077\u0069\u0074h\u0020\u0025\u0073 \u0028%\u0020\u0078\u0029",_affd ,_affd );return _fc .PdfObjectName (_fbd ),_dg .Errorf ("\u0069n\u0076a\u006c\u0069\u0064\u0020\u006ea\u006d\u0065:\u0020\u0028\u0025\u0063\u0029",_affd [0]);};}else {if _fc .IsWhiteSpace (_affd [0]){break ;}else if (_affd [0]=='/')||(_affd [0]=='[')||(_affd [0]=='(')||(_affd [0]==']')||(_affd [0]=='<')||(_affd [0]=='>'){break ;}else if _affd [0]=='#'{_ebcf ,_fdcf :=_ccbc ._face .Peek (3);if _fdcf !=nil {return _fc .PdfObjectName (_fbd ),_fdcf ;};_ccbc ._face .Discard (3);_cbfc ,_fdcf :=_e .DecodeString (string (_ebcf [1:3]));if _fdcf !=nil {return _fc .PdfObjectName (_fbd ),_fdcf ;};_fbd +=string (_cbfc );}else {_bgb ,_ :=_ccbc ._face .ReadByte ();_fbd +=string (_bgb );};};};return _fc .PdfObjectName (_fbd ),nil ;};
// Add_BMC appends 'BMC' operand to the content stream:
// Begins a marked-content sequence terminated by a balancing EMC operator.
// `tag` shall be a name object indicating the role or significance of
// the sequence.
//
// See section 14.6 "Marked Content" and Table 320 (p. 561 PDF32000_2008).
func (_ffe *ContentCreator )Add_BMC (tag _fc .PdfObjectName )*ContentCreator {_eee :=ContentStreamOperation {};_eee .Operand ="\u0042\u004d\u0043";_eee .Params =_cfcb ([]_fc .PdfObjectName {tag });_ffe ._fge =append (_ffe ._fge ,&_eee );return _ffe ;};
// Add_v appends 'v' operand to the content stream: Append a Bezier curve to the current path from the
// current point to (x3,y3) with the current point and (x2,y2) as control points.
//
// See section 8.5.2 "Path Construction Operators" and Table 59 (pp. 140-141 PDF32000_2008).
func (_gff *ContentCreator )Add_v (x2 ,y2 ,x3 ,y3 float64 )*ContentCreator {_gcb :=ContentStreamOperation {};_gcb .Operand ="\u0076";_gcb .Params =_deec ([]float64 {x2 ,y2 ,x3 ,y3 });_gff ._fge =append (_gff ._fge ,&_gcb );return _gff ;};
// ToImage exports the inline image to Image which can be transformed or exported easily.
// Page resources are needed to look up colorspace information.
func (_bgee *ContentStreamInlineImage )ToImage (resources *_ca .PdfPageResources )(*_ca .Image ,error ){_bdc ,_adgf :=_bgee .toImageBase (resources );if _adgf !=nil {return nil ,_adgf ;};_ggdb ,_adgf :=_egfc (_bgee );if _adgf !=nil {return nil ,_adgf ;};_cc .Log .Trace ("\u0065n\u0063o\u0064\u0065\u0072\u003a\u0020\u0025\u002b\u0076\u0020\u0025\u0054",_ggdb ,_ggdb );_cc .Log .Trace ("\u0069\u006e\u006c\u0069\u006e\u0065\u0020\u0069\u006d\u0061\u0067\u0065:\u0020\u0025\u002b\u0076",_bgee );_cdbb ,_adgf :=_ggdb .DecodeBytes (_bgee ._cgbf );if _adgf !=nil {return nil ,_adgf ;};_bcbd :=&_ca .Image {Width :int64 (_bdc .Width ),Height :int64 (_bdc .Height ),BitsPerComponent :int64 (_bdc .BitsPerComponent ),ColorComponents :_bdc .ColorComponents ,Data :_cdbb };if len (_bdc .Decode )> 0{for _adc :=0;_adc < len (_bdc .Decode );_adc ++{_bdc .Decode [_adc ]*=float64 ((int (1)<<uint (_bdc .BitsPerComponent ))-1);};_bcbd .SetDecode (_bdc .Decode );};return _bcbd ,nil ;};
// IsMask checks if an image is a mask.
// The image mask entry in the image dictionary specifies that the image data shall be used as a stencil
// mask for painting in the current color. The mask data is 1bpc, grayscale.
func (_ecdce *ContentStreamInlineImage )IsMask ()(bool ,error ){if _ecdce .ImageMask !=nil {_cdba ,_bca :=_ecdce .ImageMask .(*_fc .PdfObjectBool );if !_bca {_cc .Log .Debug ("\u0049m\u0061\u0067\u0065\u0020\u006d\u0061\u0073\u006b\u0020\u006e\u006ft\u0020\u0061\u0020\u0062\u006f\u006f\u006c\u0065\u0061\u006e");return false ,_b .New ("\u0069\u006e\u0076\u0061li\u0064\u0020\u006f\u0062\u006a\u0065\u0063\u0074\u0020\u0074\u0079\u0070\u0065");};return bool (*_cdba ),nil ;};return false ,nil ;};func _bbf (_gcd *ContentStreamInlineImage )(*_fc .MultiEncoder ,error ){_aebc :=_fc .NewMultiEncoder ();var _cebc *_fc .PdfObjectDictionary ;var _gaef []_fc .PdfObject ;if _ccbf :=_gcd .DecodeParms ;_ccbf !=nil {_cff ,_dba :=_ccbf .(*_fc .PdfObjectDictionary );if _dba {_cebc =_cff ;};_bgccd ,_fed :=_ccbf .(*_fc .PdfObjectArray );if _fed {for _ ,_aac :=range _bgccd .Elements (){if _gcf ,_ebc :=_aac .(*_fc .PdfObjectDictionary );_ebc {_gaef =append (_gaef ,_gcf );}else {_gaef =append (_gaef ,nil );};};};};_abc :=_gcd .Filter ;if _abc ==nil {return nil ,_dg .Errorf ("\u0066\u0069\u006c\u0074\u0065\u0072\u0020\u006d\u0069s\u0073\u0069\u006e\u0067");};_abg ,_fbf :=_abc .(*_fc .PdfObjectArray );if !_fbf {return nil ,_dg .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");};for _gef ,_adb :=range _abg .Elements (){_cgd ,_acg :=_adb .(*_fc .PdfObjectName );if !_acg {return nil ,_dg .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");};var _gfe _fc .PdfObject ;if _cebc !=nil {_gfe =_cebc ;}else {if len (_gaef )> 0{if _gef >=len (_gaef ){return nil ,_dg .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");};_gfe =_gaef [_gef ];};};var _daef *_fc .PdfObjectDictionary ;if _dcg ,_bfb :=_gfe .(*_fc .PdfObjectDictionary );_bfb {_daef =_dcg ;};if *_cgd ==_fc .StreamEncodingFilterNameFlate ||*_cgd =="\u0046\u006c"{_gedg ,_bedf :=_cca (_gcd ,_daef );if _bedf !=nil {return nil ,_bedf ;};_aebc .AddEncoder (_gedg );}else if *_cgd ==_fc .StreamEncodingFilterNameLZW {_cceb ,_cfb :=_ebf (_gcd ,_daef );if _cfb !=nil {return nil ,_cfb ;};_aebc .AddEncoder (_cceb );}else if *_cgd ==_fc .StreamEncodingFilterNameASCIIHex {_ebfd :=_fc .NewASCIIHexEncoder ();_aebc .AddEncoder (_ebfd );}else if *_cgd ==_fc .StreamEncodingFilterNameASCII85 ||*_cgd =="\u0041\u0038\u0035"{_dcc :=_fc .NewASCII85Encoder ();_aebc .AddEncoder (_dcc );}else {_cc .Log .Error ("U\u006e\u0073\u0075\u0070po\u0072t\u0065\u0064\u0020\u0066\u0069l\u0074\u0065\u0072\u0020\u0025\u0073",*_cgd );return nil ,_dg .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 _aebc ,nil ;};
// Add_Tw appends 'Tw' operand to the content stream:
// Set word spacing.
//
// See section 9.3 "Text State Parameters and Operators" and
// Table 105 (pp. 251-252 PDF32000_2008).
func (_bgcc *ContentCreator )Add_Tw (wordSpace float64 )*ContentCreator {_dcb :=ContentStreamOperation {};_dcb .Operand ="\u0054\u0077";_dcb .Params =_deec ([]float64 {wordSpace });_bgcc ._fge =append (_bgcc ._fge ,&_dcb );return _bgcc ;};func (_fbca *ContentStreamProcessor )handleCommand_G (_egfga *ContentStreamOperation ,_gfgg *_ca .PdfPageResources )error {_cfeg :=_ca .NewPdfColorspaceDeviceGray ();if len (_egfga .Params )!=_cfeg .GetNumComponents (){_cc .Log .Debug ("I\u006e\u0076\u0061\u006c\u0069\u0064 \u006e\u0075\u006d\u0062\u0065\u0072 \u006f\u0066\u0020\u0070\u0061\u0072\u0061m\u0065\u0074\u0065\u0072\u0073\u0020\u0066\u006f\u0072\u0020S\u0043");_cc .Log .Debug ("\u004e\u0075mb\u0065\u0072\u0020%\u0064\u0020\u006e\u006ft m\u0061tc\u0068\u0069\u006e\u0067\u0020\u0063\u006flo\u0072\u0073\u0070\u0061\u0063\u0065\u0020%\u0054",len (_egfga .Params ),_cfeg );return _b .New ("\u0069\u006e\u0076\u0061l\u0069\u0064\u0020\u006e\u0075\u006d\u0062\u0065\u0072\u0020o\u0066 \u0070\u0061\u0072\u0061\u006d\u0065\u0074e\u0072\u0073");};_adca ,_edad :=_cfeg .ColorFromPdfObjects (_egfga .Params );if _edad !=nil {return _edad ;};_fbca ._dcgd .ColorspaceStroking =_cfeg ;_fbca ._dcgd .ColorStroking =_adca ;return nil ;};func _deec (_dbf []float64 )[]_fc .PdfObject {var _cggg []_fc .PdfObject ;for _ ,_affe :=range _dbf {_cggg =append (_cggg ,_fc .MakeFloat (_affe ));};return _cggg ;};
// NewContentStreamProcessor returns a new ContentStreamProcessor for operations `ops`.
func NewContentStreamProcessor (ops []*ContentStreamOperation )*ContentStreamProcessor {_egeg :=ContentStreamProcessor {};_egeg ._ecaa =GraphicStateStack {};_aeg :=GraphicsState {};_egeg ._dcgd =_aeg ;_egeg ._gdaa =[]handlerEntry {};_egeg ._acbgb =0;_egeg ._aeaf =ops ;return &_egeg ;};func (_ggdg *ContentStreamParser )parseObject ()(_aafa _fc .PdfObject ,_gcfb bool ,_cbdf error ){_ggdg .skipSpaces ();for {_efdg ,_egdf :=_ggdg ._face .Peek (2);if _egdf !=nil {return nil ,false ,_egdf ;};_cc .Log .Trace ("\u0050e\u0065k\u0020\u0073\u0074\u0072\u0069\u006e\u0067\u003a\u0020\u0025\u0073",string (_efdg ));if _efdg [0]=='%'{_ggdg .skipComments ();continue ;}else if _efdg [0]=='/'{_aded ,_effc :=_ggdg .parseName ();_cc .Log .Trace ("\u002d\u003e\u004ea\u006d\u0065\u003a\u0020\u0027\u0025\u0073\u0027",_aded );return &_aded ,false ,_effc ;}else if _efdg [0]=='('{_cc .Log .Trace ("\u002d>\u0053\u0074\u0072\u0069\u006e\u0067!");_fbbc ,_cecf :=_ggdg .parseString ();return _fbbc ,false ,_cecf ;}else if _efdg [0]=='<'&&_efdg [1]!='<'{_cc .Log .Trace ("\u002d\u003e\u0048\u0065\u0078\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0021");_bbfd ,_eeb :=_ggdg .parseHexString ();return _bbfd ,false ,_eeb ;}else if _efdg [0]=='['{_cc .Log .Trace ("\u002d\u003e\u0041\u0072\u0072\u0061\u0079\u0021");_edf ,_bgce :=_ggdg .parseArray ();return _edf ,false ,_bgce ;}else if _fc .IsFloatDigit (_efdg [0])||(_efdg [0]=='-'&&_fc .IsFloatDigit (_efdg [1])){_cc .Log .Trace ("\u002d>\u004e\u0075\u006d\u0062\u0065\u0072!");_fcgd ,_dfdc :=_ggdg .parseNumber ();return _fcgd ,false ,_dfdc ;}else if _efdg [0]=='<'&&_efdg [1]=='<'{_daa ,_bgg :=_ggdg .parseDict ();return _daa ,false ,_bgg ;}else {_cc .Log .Trace ("\u002d>\u004fp\u0065\u0072\u0061\u006e\u0064 \u006f\u0072 \u0062\u006f\u006f\u006c\u003f");_efdg ,_ =_ggdg ._face .Peek (5);_fgcd :=string (_efdg );_cc .Log .Trace ("\u0063\u006f\u006e\u0074\u0020\u0050\u0065\u0065\u006b\u0020\u0073\u0074r\u003a\u0020\u0025\u0073",_fgcd );if (len (_fgcd )> 3)&&(_fgcd [:4]=="\u006e\u0075\u006c\u006c"){_egb ,_edfa :=_ggdg .parseNull ();return &_egb ,false ,_edfa ;}else if (len (_fgcd )> 4)&&(_fgcd [:5]=="\u0066\u0061\u006cs\u0065"){_edg ,_dgbde :=_ggdg .parseBool ();return &_edg ,false ,_dgbde ;}else if (len (_fgcd )> 3)&&(_fgcd [:4]=="\u0074\u0072\u0075\u0065"){_fgcf ,_aefac :=_ggdg .parseBool ();return &_fgcf ,false ,_aefac ;};_ecag ,_gdgd :=_ggdg .parseOperand ();if _gdgd !=nil {return _ecag ,false ,_gdgd ;};if len (_ecag .String ())< 1{return _ecag ,false ,ErrInvalidOperand ;};return _ecag ,true ,nil ;};};};
// Parse parses all commands in content stream, returning a list of operation data.
func (_ffeg *ContentStreamParser )Parse ()(*ContentStreamOperations ,error ){_febc :=ContentStreamOperations {};for {_fec :=ContentStreamOperation {};for {_cfg ,_bce ,_fbed :=_ffeg .parseObject ();if _fbed !=nil {if _fbed ==_ea .EOF {return &_febc ,nil ;};return &_febc ,_fbed ;};if _bce {_fec .Operand ,_ =_fc .GetStringVal (_cfg );_febc =append (_febc ,&_fec );break ;}else {_fec .Params =append (_fec .Params ,_cfg );};};if _fec .Operand =="\u0042\u0049"{_cgg ,_afc :=_ffeg .ParseInlineImage ();if _afc !=nil {return &_febc ,_afc ;};_fec .Params =append (_fec .Params ,_cgg );};};};
// Add_c adds 'c' operand to the content stream: Append a Bezier curve to the current path from
// the current point to (x3,y3) with (x1,x1) and (x2,y2) as control points.
//
// See section 8.5.2 "Path Construction Operators" and Table 59 (pp. 140-141 PDF32000_2008).
func (_fae *ContentCreator )Add_c (x1 ,y1 ,x2 ,y2 ,x3 ,y3 float64 )*ContentCreator {_dd :=ContentStreamOperation {};_dd .Operand ="\u0063";_dd .Params =_deec ([]float64 {x1 ,y1 ,x2 ,y2 ,x3 ,y3 });_fae ._fge =append (_fae ._fge ,&_dd );return _fae ;};func (_bgfg *ContentStreamProcessor )handleCommand_rg (_bgfgf *ContentStreamOperation ,_eaaf *_ca .PdfPageResources )error {_cdbe :=_ca .NewPdfColorspaceDeviceRGB ();if len (_bgfgf .Params )!=_cdbe .GetNumComponents (){_cc .Log .Debug ("I\u006e\u0076\u0061\u006c\u0069\u0064 \u006e\u0075\u006d\u0062\u0065\u0072 \u006f\u0066\u0020\u0070\u0061\u0072\u0061m\u0065\u0074\u0065\u0072\u0073\u0020\u0066\u006f\u0072\u0020S\u0043");_cc .Log .Debug ("\u004e\u0075mb\u0065\u0072\u0020%\u0064\u0020\u006e\u006ft m\u0061tc\u0068\u0069\u006e\u0067\u0020\u0063\u006flo\u0072\u0073\u0070\u0061\u0063\u0065\u0020%\u0054",len (_bgfgf .Params ),_cdbe );return _b .New ("\u0069\u006e\u0076\u0061l\u0069\u0064\u0020\u006e\u0075\u006d\u0062\u0065\u0072\u0020o\u0066 \u0070\u0061\u0072\u0061\u006d\u0065\u0074e\u0072\u0073");};_aecg ,_dcd :=_cdbe .ColorFromPdfObjects (_bgfgf .Params );if _dcd !=nil {return _dcd ;};_bgfg ._dcgd .ColorspaceNonStroking =_cdbe ;_bgfg ._dcgd .ColorNonStroking =_aecg ;return nil ;};
// ContentStreamOperation represents an operation in PDF contentstream which consists of
// an operand and parameters.
type ContentStreamOperation struct{Params []_fc .PdfObject ;Operand string ;};
// RotateDeg applies a rotation to the transformation matrix.
func (_ebd *ContentCreator )RotateDeg (angle float64 )*ContentCreator {_cga :=_f .Cos (angle *_f .Pi /180.0);_adf :=_f .Sin (angle *_f .Pi /180.0);_bcg :=-_f .Sin (angle *_f .Pi /180.0);_gf :=_f .Cos (angle *_f .Pi /180.0);return _ebd .Add_cm (_cga ,_adf ,_bcg ,_gf ,0,0);};func (_eca *ContentStreamParser )parseOperand ()(*_fc .PdfObjectString ,error ){var _ebea []byte ;for {_adad ,_efaa :=_eca ._face .Peek (1);if _efaa !=nil {return _fc .MakeString (string (_ebea )),_efaa ;};if _fc .IsDelimiter (_adad [0]){break ;};if _fc .IsWhiteSpace (_adad [0]){break ;};_fbbb ,_ :=_eca ._face .ReadByte ();_ebea =append (_ebea ,_fbbb );};return _fc .MakeString (string (_ebea )),nil ;};
// Translate applies a simple x-y translation to the transformation matrix.
func (_cgb *ContentCreator )Translate (tx ,ty float64 )*ContentCreator {return _cgb .Add_cm (1,0,0,1,tx ,ty );};func _gdfa (_ede []_fc .PdfObjectString )[]_fc .PdfObject {var _ffege []_fc .PdfObject ;for _ ,_efdfa :=range _ede {_ffege =append (_ffege ,_fc .MakeString (_efdfa .Str ()));};return _ffege ;};
// Add_n appends 'n' operand to the content stream:
// End the path without filling or stroking.
//
// See section 8.5.3 "Path Painting Operators" and Table 60 (p. 143 PDF32000_2008).
func (_ddb *ContentCreator )Add_n ()*ContentCreator {_dbe :=ContentStreamOperation {};_dbe .Operand ="\u006e";_ddb ._fge =append (_ddb ._fge ,&_dbe );return _ddb ;};
// Add_w adds 'w' operand to the content stream, which sets the line width.
//
// See section 8.4.4 "Graphic State Operators" and Table 57 (pp. 135-136 PDF32000_2008).
func (_feg *ContentCreator )Add_w (lineWidth float64 )*ContentCreator {_dea :=ContentStreamOperation {};_dea .Operand ="\u0077";_dea .Params =_deec ([]float64 {lineWidth });_feg ._fge =append (_feg ._fge ,&_dea );return _feg ;};func (_gaac *ContentStreamProcessor )getInitialColor (_bddb _ca .PdfColorspace )(_ca .PdfColor ,error ){switch _aega :=_bddb .(type ){case *_ca .PdfColorspaceDeviceGray :return _ca .NewPdfColorDeviceGray (0.0),nil ;case *_ca .PdfColorspaceDeviceRGB :return _ca .NewPdfColorDeviceRGB (0.0,0.0,0.0),nil ;case *_ca .PdfColorspaceDeviceCMYK :return _ca .NewPdfColorDeviceCMYK (0.0,0.0,0.0,1.0),nil ;case *_ca .PdfColorspaceCalGray :return _ca .NewPdfColorCalGray (0.0),nil ;case *_ca .PdfColorspaceCalRGB :return _ca .NewPdfColorCalRGB (0.0,0.0,0.0),nil ;case *_ca .PdfColorspaceLab :_cbb :=0.0;_ecf :=0.0;_ccbb :=0.0;if _aega .Range [0]> 0{_cbb =_aega .Range [0];};if _aega .Range [2]> 0{_ecf =_aega .Range [2];};return _ca .NewPdfColorLab (_cbb ,_ecf ,_ccbb ),nil ;case *_ca .PdfColorspaceICCBased :if _aega .Alternate ==nil {_cc .Log .Trace ("\u0049\u0043\u0043\u0020\u0042\u0061\u0073\u0065\u0064\u0020\u006eo\u0074\u0020\u0064\u0065\u0066\u0069\u006e\u0065d\u0020-\u0020\u0061\u0074\u0074\u0065\u006d\u0070\u0074\u0069\u006e\u0067\u0020\u0066\u0061\u006c\u006c\u0020\u0062a\u0063\u006b\u0020\u0028\u004e\u0020\u003d\u0020\u0025\u0064\u0029",_aega .N );if _aega .N ==1{_cc .Log .Trace ("\u0046\u0061\u006c\u006c\u0069\u006e\u0067\u0020\u0062\u0061\u0063k\u0020\u0074\u006f\u0020\u0044\u0065\u0076\u0069\u0063\u0065G\u0072\u0061\u0079");return _gaac .getInitialColor (_ca .NewPdfColorspaceDeviceGray ());}else if _aega .N ==3{_cc .Log .Trace ("\u0046a\u006c\u006c\u0069\u006eg\u0020\u0062\u0061\u0063\u006b \u0074o\u0020D\u0065\u0076\u0069\u0063\u0065\u0052\u0047B");return _gaac .getInitialColor (_ca .NewPdfColorspaceDeviceRGB ());}else if _aega .N ==4{_cc .Log .Trace ("\u0046\u0061\u006c\u006c\u0069\u006e\u0067\u0020\u0062\u0061\u0063k\u0020\u0074\u006f\u0020\u0044\u0065\u0076\u0069\u0063\u0065C\u004d\u0059\u004b");return _gaac .getInitialColor (_ca .NewPdfColorspaceDeviceCMYK ());}else {return nil ,_b .New ("a\u006c\u0074\u0065\u0072\u006e\u0061t\u0065\u0020\u0073\u0070\u0061\u0063e\u0020\u006e\u006f\u0074\u0020\u0064\u0065f\u0069\u006e\u0065\u0064\u0020\u0066\u006f\u0072\u0020\u0049C\u0043");};};return _gaac .getInitialColor (_aega .Alternate );case *_ca .PdfColorspaceSpecialIndexed :if _aega .Base ==nil {return nil ,_b .New ("\u0069\u006e\u0064\u0065\u0078\u0065\u0064\u0020\u0062\u0061\u0073e\u0020\u006e\u006f\u0074\u0020\u0073\u0070\u0065\u0063\u0069f\u0069\u0065\u0064");};return _gaac .getInitialColor (_aega .Base );case *_ca .PdfColorspaceSpecialSeparation :if _aega .AlternateSpace ==nil {return nil ,_b .New ("\u0061\u006ct\u0065\u0072\u006e\u0061\u0074\u0065\u0020\u0073\u0070\u0061\u0063\u0065\u0020\u006e\u006f\u0074\u0020\u0073\u0070\u0065\u0063\u0069fi\u0065\u0064");};return _gaac .getInitialColor (_aega .AlternateSpace );case *_ca .PdfColorspaceDeviceN :if _aega .AlternateSpace ==nil {return nil ,_b .New ("\u0061\u006ct\u0065\u0072\u006e\u0061\u0074\u0065\u0020\u0073\u0070\u0061\u0063\u0065\u0020\u006e\u006f\u0074\u0020\u0073\u0070\u0065\u0063\u0069fi\u0065\u0064");};return _gaac .getInitialColor (_aega .AlternateSpace );case *_ca .PdfColorspaceSpecialPattern :return nil ,nil ;};_cc .Log .Debug ("Un\u0061\u0062l\u0065\u0020\u0074\u006f\u0020\u0064\u0065\u0074\u0065r\u006d\u0069\u006e\u0065\u0020\u0069\u006e\u0069\u0074\u0069\u0061\u006c\u0020\u0063\u006f\u006c\u006f\u0072\u0020\u0066\u006f\u0072\u0020\u0075\u006e\u006b\u006e\u006fw\u006e \u0063\u006f\u006c\u006f\u0072\u0073\u0070\u0061c\u0065:\u0020\u0025T",_bddb );return nil ,_b .New ("\u0075\u006e\u0073\u0075pp\u006f\u0072\u0074\u0065\u0064\u0020\u0063\u006f\u006c\u006f\u0072\u0073\u0070\u0061c\u0065");};
// Add_Ts appends 'Ts' operand to the content stream:
// Set text rise.
//
// See section 9.3 "Text State Parameters and Operators" and
// Table 105 (pp. 251-252 PDF32000_2008).
func (_eefa *ContentCreator )Add_Ts (rise float64 )*ContentCreator {_egfg :=ContentStreamOperation {};_egfg .Operand ="\u0054\u0073";_egfg .Params =_deec ([]float64 {rise });_eefa ._fge =append (_eefa ._fge ,&_egfg );return _eefa ;};
// GraphicStateStack represents a stack of GraphicsState.
type GraphicStateStack []GraphicsState ;func (_gdeg *ContentStreamParser )parseHexString ()(*_fc .PdfObjectString ,error ){_gdeg ._face .ReadByte ();_fdaf :=[]byte ("\u0030\u0031\u0032\u003345\u0036\u0037\u0038\u0039\u0061\u0062\u0063\u0064\u0065\u0066\u0041\u0042\u0043\u0044E\u0046");var _eaf []byte ;for {_gdeg .skipSpaces ();_efe ,_geba :=_gdeg ._face .Peek (1);if _geba !=nil {return _fc .MakeString (""),_geba ;};if _efe [0]=='>'{_gdeg ._face .ReadByte ();break ;};_dgag ,_ :=_gdeg ._face .ReadByte ();if _gd .IndexByte (_fdaf ,_dgag )>=0{_eaf =append (_eaf ,_dgag );};};if len (_eaf )%2==1{_eaf =append (_eaf ,'0');};_dfd ,_ :=_e .DecodeString (string (_eaf ));return _fc .MakeHexString (string (_dfd )),nil ;};
// Scale applies x-y scaling to the transformation matrix.
func (_gbb *ContentCreator )Scale (sx ,sy float64 )*ContentCreator {return _gbb .Add_cm (sx ,0,0,sy ,0,0);};
// Add_W_starred appends 'W*' operand to the content stream:
// Modify the current clipping path by intersecting with the current path (even odd rule).
//
// See section 8.5.4 "Clipping Path Operators" and Table 61 (p. 146 PDF32000_2008).
func (_aec *ContentCreator )Add_W_starred ()*ContentCreator {_bge :=ContentStreamOperation {};_bge .Operand ="\u0057\u002a";_aec ._fge =append (_aec ._fge ,&_bge );return _aec ;};
// ContentStreamParser represents a content stream parser for parsing content streams in PDFs.
type ContentStreamParser struct{_face *_bg .Reader };
// Add_gs adds 'gs' operand to the content stream: Set the graphics state.
//
// See section 8.4.4 "Graphic State Operators" and Table 57 (pp. 135-136 PDF32000_2008).
func (_dae *ContentCreator )Add_gs (dictName _fc .PdfObjectName )*ContentCreator {_ecbb :=ContentStreamOperation {};_ecbb .Operand ="\u0067\u0073";_ecbb .Params =_cfcb ([]_fc .PdfObjectName {dictName });_dae ._fge =append (_dae ._fge ,&_ecbb );return _dae ;};
// Add_cs appends 'cs' operand to the content stream:
// Same as CS but for non-stroking operations.
//
// See section 8.6.8 "Colour Operators" and Table 74 (p. 179-180 PDF32000_2008).
func (_bac *ContentCreator )Add_cs (name _fc .PdfObjectName )*ContentCreator {_bd :=ContentStreamOperation {};_bd .Operand ="\u0063\u0073";_bd .Params =_cfcb ([]_fc .PdfObjectName {name });_bac ._fge =append (_bac ._fge ,&_bd );return _bac ;};
// Push pushes `gs` on the `gsStack`.
func (_cee *GraphicStateStack )Push (gs GraphicsState ){*_cee =append (*_cee ,gs )};
// NewContentCreator returns a new initialized ContentCreator.
func NewContentCreator ()*ContentCreator {_ecb :=&ContentCreator {};_ecb ._fge =ContentStreamOperations {};return _ecb ;};func _ebf (_gge *ContentStreamInlineImage ,_gbbc *_fc .PdfObjectDictionary )(*_fc .LZWEncoder ,error ){_ccg :=_fc .NewLZWEncoder ();if _gbbc ==nil {if _gge .DecodeParms !=nil {_efd ,_cbfe :=_fc .GetDict (_gge .DecodeParms );if !_cbfe {_cc .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",_gge .DecodeParms );return nil ,_dg .Errorf ("\u0069\u006e\u0076\u0061li\u0064\u0020\u0044\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0072\u006d\u0073");};_gbbc =_efd ;};};if _gbbc ==nil {return _ccg ,nil ;};_ced :=_gbbc .Get ("E\u0061\u0072\u006c\u0079\u0043\u0068\u0061\u006e\u0067\u0065");if _ced !=nil {_cfe ,_ggc :=_ced .(*_fc .PdfObjectInteger );if !_ggc {_cc .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",_ced );return nil ,_dg .Errorf ("\u0069\u006e\u0076\u0061li\u0064\u0020\u0045\u0061\u0072\u006c\u0079\u0043\u0068\u0061\u006e\u0067\u0065");};if *_cfe !=0&&*_cfe !=1{return nil ,_dg .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");};_ccg .EarlyChange =int (*_cfe );}else {_ccg .EarlyChange =1;};_ced =_gbbc .Get ("\u0050r\u0065\u0064\u0069\u0063\u0074\u006fr");if _ced !=nil {_befe ,_aefe :=_ced .(*_fc .PdfObjectInteger );if !_aefe {_cc .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",_ced );return nil ,_dg .Errorf ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0050\u0072\u0065\u0064i\u0063\u0074\u006f\u0072");};_ccg .Predictor =int (*_befe );};_ced =_gbbc .Get ("\u0042\u0069t\u0073\u0050\u0065r\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074");if _ced !=nil {_ccag ,_geb :=_ced .(*_fc .PdfObjectInteger );if !_geb {_cc .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");return nil ,_dg .Errorf ("\u0069n\u0076\u0061\u006c\u0069\u0064\u0020\u0042\u0069\u0074\u0073\u0050e\u0072\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074");};_ccg .BitsPerComponent =int (*_ccag );};if _ccg .Predictor > 1{_ccg .Columns =1;_ced =_gbbc .Get ("\u0043o\u006c\u0075\u006d\u006e\u0073");if _ced !=nil {_cba ,_fdab :=_ced .(*_fc .PdfObjectInteger );if !_fdab {return nil ,_dg .Errorf ("\u0070r\u0065\u0064\u0069\u0063\u0074\u006f\u0072\u0020\u0063\u006f\u006cu\u006d\u006e\u0020\u0069\u006e\u0076\u0061\u006c\u0069\u0064");};_ccg .Columns =int (*_cba );};_ccg .Colors =1;_ced =_gbbc .Get ("\u0043\u006f\u006c\u006f\u0072\u0073");if _ced !=nil {_fafe ,_ffa :=_ced .(*_fc .PdfObjectInteger );if !_ffa {return nil ,_dg .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");};_ccg .Colors =int (*_fafe );};};_cc .Log .Trace ("\u0064\u0065\u0063\u006f\u0064\u0065\u0020\u0070\u0061\u0072\u0061\u006ds\u003a\u0020\u0025\u0073",_gbbc .String ());return _ccg ,nil ;};
// Add_RG appends 'RG' operand to the content stream:
// Set the stroking colorspace to DeviceRGB and sets the r,g,b colors (0-1 each).
//
// See section 8.6.8 "Colour Operators" and Table 74 (p. 179-180 PDF32000_2008).
func (_faf *ContentCreator )Add_RG (r ,g ,b float64 )*ContentCreator {_bef :=ContentStreamOperation {};_bef .Operand ="\u0052\u0047";_bef .Params =_deec ([]float64 {r ,g ,b });_faf ._fge =append (_faf ._fge ,&_bef );return _faf ;};
// Add_f appends 'f' operand to the content stream:
// Fill the path using the nonzero winding number rule to determine fill region.
//
// See section 8.5.3 "Path Painting Operators" and Table 60 (p. 143 PDF32000_2008).
func (_gab *ContentCreator )Add_f ()*ContentCreator {_ega :=ContentStreamOperation {};_ega .Operand ="\u0066";_gab ._fge =append (_gab ._fge ,&_ega );return _gab ;};var (ErrInvalidOperand =_b .New ("\u0069n\u0076a\u006c\u0069\u0064\u0020\u006f\u0070\u0065\u0072\u0061\u006e\u0064"););
// Add_CS appends 'CS' operand to the content stream:
// Set the current colorspace for stroking operations.
//
// See section 8.6.8 "Colour Operators" and Table 74 (p. 179-180 PDF32000_2008).
func (_gbe *ContentCreator )Add_CS (name _fc .PdfObjectName )*ContentCreator {_gfc :=ContentStreamOperation {};_gfc .Operand ="\u0043\u0053";_gfc .Params =_cfcb ([]_fc .PdfObjectName {name });_gbe ._fge =append (_gbe ._fge ,&_gfc );return _gbe ;};
// String is same as Bytes() except returns as a string for convenience.
func (_gga *ContentCreator )String ()string {return string (_gga ._fge .Bytes ())};func (_gdd *ContentStreamProcessor )handleCommand_cs (_gfba *ContentStreamOperation ,_dgae *_ca .PdfPageResources )error {if len (_gfba .Params )< 1{_cc .Log .Debug ("\u0049\u006e\u0076\u0061\u006c\u0069d\u0020\u0043\u0053\u0020\u0063\u006f\u006d\u006d\u0061\u006e\u0064\u002c\u0020s\u006b\u0069\u0070\u0070\u0069\u006e\u0067 \u006f\u0076\u0065\u0072");return _b .New ("\u0074o\u006f \u0066\u0065\u0077\u0020\u0070a\u0072\u0061m\u0065\u0074\u0065\u0072\u0073");};if len (_gfba .Params )> 1{_cc .Log .Debug ("\u0043\u0053\u0020\u0063\u006f\u006d\u006d\u0061n\u0064\u0020\u0077it\u0068\u0020\u0074\u006f\u006f\u0020m\u0061\u006e\u0079\u0020\u0070\u0061\u0072\u0061\u006d\u0065\u0074\u0065\u0072\u0073\u0020-\u0020\u0063\u006f\u006e\u0074\u0069\u006e\u0075i\u006e\u0067");return _b .New ("\u0074\u006f\u006f\u0020ma\u006e\u0079\u0020\u0070\u0061\u0072\u0061\u006d\u0065\u0074\u0065\u0072\u0073");};_bad ,_afgb :=_gfba .Params [0].(*_fc .PdfObjectName );if !_afgb {_cc .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020C\u0053\u0020\u0063o\u006d\u006d\u0061n\u0064\u0020w\u0069\u0074\u0068\u0020\u0069\u006ev\u0061li\u0064\u0020\u0070\u0061\u0072\u0061\u006d\u0065\u0074\u0065\u0072\u002c\u0020\u0073\u006b\u0069\u0070\u0070\u0069\u006e\u0067\u0020\u006f\u0076\u0065\u0072");return _b .New ("\u0074\u0079p\u0065\u0020\u0063h\u0065\u0063\u006b\u0020\u0065\u0072\u0072\u006f\u0072");};_befc ,_cdd :=_gdd .getColorspace (string (*_bad ),_dgae );if _cdd !=nil {return _cdd ;};_gdd ._dcgd .ColorspaceNonStroking =_befc ;_dee ,_cdd :=_gdd .getInitialColor (_befc );if _cdd !=nil {return _cdd ;};_gdd ._dcgd .ColorNonStroking =_dee ;return nil ;};
// Add_j adds 'j' operand to the content stream: Set the line join style (graphics state).
//
// See section 8.4.4 "Graphic State Operators" and Table 57 (pp. 135-136 PDF32000_2008).
func (_ace *ContentCreator )Add_j (lineJoinStyle string )*ContentCreator {_da :=ContentStreamOperation {};_da .Operand ="\u006a";_da .Params =_cfcb ([]_fc .PdfObjectName {_fc .PdfObjectName (lineJoinStyle )});_ace ._fge =append (_ace ._fge ,&_da );return _ace ;};
// Add_TL appends 'TL' operand to the content stream:
// Set leading.
//
// See section 9.3 "Text State Parameters and Operators" and
// Table 105 (pp. 251-252 PDF32000_2008).
func (_dga *ContentCreator )Add_TL (leading float64 )*ContentCreator {_bgf :=ContentStreamOperation {};_bgf .Operand ="\u0054\u004c";_bgf .Params =_deec ([]float64 {leading });_dga ._fge =append (_dga ._fge ,&_bgf );return _dga ;};
// SetStrokingColor sets the stroking `color` where color can be one of
// PdfColorDeviceGray, PdfColorDeviceRGB, or PdfColorDeviceCMYK.
func (_fgc *ContentCreator )SetStrokingColor (color _ca .PdfColor )*ContentCreator {switch _cdc :=color .(type ){case *_ca .PdfColorDeviceGray :_fgc .Add_G (_cdc .Val ());case *_ca .PdfColorDeviceRGB :_fgc .Add_RG (_cdc .R (),_cdc .G (),_cdc .B ());case *_ca .PdfColorDeviceCMYK :_fgc .Add_K (_cdc .C (),_cdc .M (),_cdc .Y (),_cdc .K ());default:_cc .Log .Debug ("\u0053\u0065\u0074\u0053\u0074\u0072\u006f\u006b\u0069\u006e\u0067\u0043\u006fl\u006f\u0072\u003a\u0020\u0075\u006es\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u0020\u0063\u006f\u006c\u006fr\u003a\u0020\u0025\u0054",_cdc );};return _fgc ;};func (_ded *ContentStreamProcessor )handleCommand_SC (_efb *ContentStreamOperation ,_cbff *_ca .PdfPageResources )error {_ggf :=_ded ._dcgd .ColorspaceStroking ;if len (_efb .Params )!=_ggf .GetNumComponents (){_cc .Log .Debug ("I\u006e\u0076\u0061\u006c\u0069\u0064 \u006e\u0075\u006d\u0062\u0065\u0072 \u006f\u0066\u0020\u0070\u0061\u0072\u0061m\u0065\u0074\u0065\u0072\u0073\u0020\u0066\u006f\u0072\u0020S\u0043");_cc .Log .Debug ("\u004e\u0075mb\u0065\u0072\u0020%\u0064\u0020\u006e\u006ft m\u0061tc\u0068\u0069\u006e\u0067\u0020\u0063\u006flo\u0072\u0073\u0070\u0061\u0063\u0065\u0020%\u0054",len (_efb .Params ),_ggf );return _b .New ("\u0069\u006e\u0076\u0061l\u0069\u0064\u0020\u006e\u0075\u006d\u0062\u0065\u0072\u0020o\u0066 \u0070\u0061\u0072\u0061\u006d\u0065\u0074e\u0072\u0073");};_eab ,_ggg :=_ggf .ColorFromPdfObjects (_efb .Params );if _ggg !=nil {return _ggg ;};_ded ._dcgd .ColorStroking =_eab ;return nil ;};
// Pop pops and returns the topmost GraphicsState off the `gsStack`.
func (_bdd *GraphicStateStack )Pop ()GraphicsState {_aaad :=(*_bdd )[len (*_bdd )-1];*_bdd =(*_bdd )[:len (*_bdd )-1];return _aaad ;};func (_adgc *ContentStreamParser )parseString ()(*_fc .PdfObjectString ,error ){_adgc ._face .ReadByte ();var _gded []byte ;_agec :=1;for {_egc ,_decc :=_adgc ._face .Peek (1);if _decc !=nil {return _fc .MakeString (string (_gded )),_decc ;};if _egc [0]=='\\'{_adgc ._face .ReadByte ();_bbeg ,_fefg :=_adgc ._face .ReadByte ();if _fefg !=nil {return _fc .MakeString (string (_gded )),_fefg ;};if _fc .IsOctalDigit (_bbeg ){_gbg ,_bbfb :=_adgc ._face .Peek (2);if _bbfb !=nil {return _fc .MakeString (string (_gded )),_bbfb ;};var _bfa []byte ;_bfa =append (_bfa ,_bbeg );for _ ,_fcg :=range _gbg {if _fc .IsOctalDigit (_fcg ){_bfa =append (_bfa ,_fcg );}else {break ;};};_adgc ._face .Discard (len (_bfa )-1);_cc .Log .Trace ("\u004e\u0075\u006d\u0065ri\u0063\u0020\u0073\u0074\u0072\u0069\u006e\u0067\u0020\u0022\u0025\u0073\u0022",_bfa );_bbfg ,_bbfb :=_bc .ParseUint (string (_bfa ),8,32);if _bbfb !=nil {return _fc .MakeString (string (_gded )),_bbfb ;};_gded =append (_gded ,byte (_bbfg ));continue ;};switch _bbeg {case 'n':_gded =append (_gded ,'\n');case 'r':_gded =append (_gded ,'\r');case 't':_gded =append (_gded ,'\t');case 'b':_gded =append (_gded ,'\b');case 'f':_gded =append (_gded ,'\f');case '(':_gded =append (_gded ,'(');case ')':_gded =append (_gded ,')');case '\\':_gded =append (_gded ,'\\');};continue ;}else if _egc [0]=='('{_agec ++;}else if _egc [0]==')'{_agec --;if _agec ==0{_adgc ._face .ReadByte ();break ;};};_dfa ,_ :=_adgc ._face .ReadByte ();_gded =append (_gded ,_dfa );};return _fc .MakeString (string (_gded )),nil ;};func (_gebg *ContentStreamProcessor )handleCommand_SCN (_efac *ContentStreamOperation ,_ffb *_ca .PdfPageResources )error {_fceag :=_gebg ._dcgd .ColorspaceStroking ;if !_gad (_fceag ){if len (_efac .Params )!=_fceag .GetNumComponents (){_cc .Log .Debug ("I\u006e\u0076\u0061\u006c\u0069\u0064 \u006e\u0075\u006d\u0062\u0065\u0072 \u006f\u0066\u0020\u0070\u0061\u0072\u0061m\u0065\u0074\u0065\u0072\u0073\u0020\u0066\u006f\u0072\u0020S\u0043");_cc .Log .Debug ("\u004e\u0075mb\u0065\u0072\u0020%\u0064\u0020\u006e\u006ft m\u0061tc\u0068\u0069\u006e\u0067\u0020\u0063\u006flo\u0072\u0073\u0070\u0061\u0063\u0065\u0020%\u0054",len (_efac .Params ),_fceag );return _b .New ("\u0069\u006e\u0076\u0061l\u0069\u0064\u0020\u006e\u0075\u006d\u0062\u0065\u0072\u0020o\u0066 \u0070\u0061\u0072\u0061\u006d\u0065\u0074e\u0072\u0073");};};_ddae ,_deb :=_fceag .ColorFromPdfObjects (_efac .Params );if _deb !=nil {return _deb ;};_gebg ._dcgd .ColorStroking =_ddae ;return nil ;};
// SetNonStrokingColor sets the non-stroking `color` where color can be one of
// PdfColorDeviceGray, PdfColorDeviceRGB, or PdfColorDeviceCMYK.
func (_gfcg *ContentCreator )SetNonStrokingColor (color _ca .PdfColor )*ContentCreator {switch _gde :=color .(type ){case *_ca .PdfColorDeviceGray :_gfcg .Add_g (_gde .Val ());case *_ca .PdfColorDeviceRGB :_gfcg .Add_rg (_gde .R (),_gde .G (),_gde .B ());case *_ca .PdfColorDeviceCMYK :_gfcg .Add_k (_gde .C (),_gde .M (),_gde .Y (),_gde .K ());default:_cc .Log .Debug ("\u0053\u0065\u0074N\u006f\u006e\u0053\u0074\u0072\u006f\u006b\u0069\u006e\u0067\u0043\u006f\u006c\u006f\u0072\u003a\u0020\u0075\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u0020c\u006f\u006c\u006f\u0072\u003a\u0020\u0025\u0054",_gde );};return _gfcg ;};func (_dbae *ContentStreamProcessor )handleCommand_k (_fdeb *ContentStreamOperation ,_aabb *_ca .PdfPageResources )error {_cecg :=_ca .NewPdfColorspaceDeviceCMYK ();if len (_fdeb .Params )!=_cecg .GetNumComponents (){_cc .Log .Debug ("I\u006e\u0076\u0061\u006c\u0069\u0064 \u006e\u0075\u006d\u0062\u0065\u0072 \u006f\u0066\u0020\u0070\u0061\u0072\u0061m\u0065\u0074\u0065\u0072\u0073\u0020\u0066\u006f\u0072\u0020S\u0043");_cc .Log .Debug ("\u004e\u0075mb\u0065\u0072\u0020%\u0064\u0020\u006e\u006ft m\u0061tc\u0068\u0069\u006e\u0067\u0020\u0063\u006flo\u0072\u0073\u0070\u0061\u0063\u0065\u0020%\u0054",len (_fdeb .Params ),_cecg );return _b .New ("\u0069\u006e\u0076\u0061l\u0069\u0064\u0020\u006e\u0075\u006d\u0062\u0065\u0072\u0020o\u0066 \u0070\u0061\u0072\u0061\u006d\u0065\u0074e\u0072\u0073");};_bead ,_eddf :=_cecg .ColorFromPdfObjects (_fdeb .Params );if _eddf !=nil {return _eddf ;};_dbae ._dcgd .ColorspaceNonStroking =_cecg ;_dbae ._dcgd .ColorNonStroking =_bead ;return nil ;};func (_ae *ContentStreamOperations )isWrapped ()bool {if len (*_ae )< 2{return false ;};_gdb :=0;for _ ,_aa :=range *_ae {if _aa .Operand =="\u0071"{_gdb ++;}else if _aa .Operand =="\u0051"{_gdb --;}else {if _gdb < 1{return false ;};};};return _gdb ==0;};
// Add_rg appends 'rg' operand to the content stream:
// Same as RG but used for nonstroking operations.
//
// See section 8.6.8 "Colour Operators" and Table 74 (p. 179-180 PDF32000_2008).
func (_gae *ContentCreator )Add_rg (r ,g ,b float64 )*ContentCreator {_gec :=ContentStreamOperation {};_gec .Operand ="\u0072\u0067";_gec .Params =_deec ([]float64 {r ,g ,b });_gae ._fge =append (_gae ._fge ,&_gec );return _gae ;};
// Add_B appends 'B' operand to the content stream:
// Fill and then stroke the path (nonzero winding number rule).
//
// See section 8.5.3 "Path Painting Operators" and Table 60 (p. 143 PDF32000_2008).
func (_afg *ContentCreator )Add_B ()*ContentCreator {_fcb :=ContentStreamOperation {};_fcb .Operand ="\u0042";_afg ._fge =append (_afg ._fge ,&_fcb );return _afg ;};
// Add_Q adds 'Q' operand to the content stream: Pops the most recently stored state from the stack.
//
// See section 8.4.4 "Graphic State Operators" and Table 57 (pp. 135-136 PDF32000_2008).
func (_aab *ContentCreator )Add_Q ()*ContentCreator {_fda :=ContentStreamOperation {};_fda .Operand ="\u0051";_aab ._fge =append (_aab ._fge ,&_fda );return _aab ;};
// Add_ri adds 'ri' operand to the content stream, which sets the color rendering intent.
//
// See section 8.4.4 "Graphic State Operators" and Table 57 (pp. 135-136 PDF32000_2008).
func (_geg *ContentCreator )Add_ri (intent _fc .PdfObjectName )*ContentCreator {_bee :=ContentStreamOperation {};_bee .Operand ="\u0072\u0069";_bee .Params =_cfcb ([]_fc .PdfObjectName {intent });_geg ._fge =append (_geg ._fge ,&_bee );return _geg ;};func _cca (_bebg *ContentStreamInlineImage ,_aef *_fc .PdfObjectDictionary )(*_fc .FlateEncoder ,error ){_ged :=_fc .NewFlateEncoder ();if _bebg ._aefd !=nil {_ged .SetImage (_bebg ._aefd );};if _aef ==nil {_abe :=_bebg .DecodeParms ;if _abe !=nil {_dbd ,_gag :=_fc .GetDict (_abe );if !_gag {_cc .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",_abe );return nil ,_dg .Errorf ("\u0069\u006e\u0076\u0061li\u0064\u0020\u0044\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0072\u006d\u0073");};_aef =_dbd ;};};if _aef ==nil {return _ged ,nil ;};_cc .Log .Trace ("\u0064\u0065\u0063\u006f\u0064\u0065\u0020\u0070\u0061\u0072\u0061\u006ds\u003a\u0020\u0025\u0073",_aef .String ());_dadaa :=_aef .Get ("\u0050r\u0065\u0064\u0069\u0063\u0074\u006fr");if _dadaa ==nil {_cc .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");}else {_cgaa ,_fccc :=_dadaa .(*_fc .PdfObjectInteger );if !_fccc {_cc .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",_dadaa );return nil ,_dg .Errorf ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0050\u0072\u0065\u0064i\u0063\u0074\u006f\u0072");};_ged .Predictor =int (*_cgaa );};_dadaa =_aef .Get ("\u0042\u0069t\u0073\u0050\u0065r\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074");if _dadaa !=nil {_gdff ,_cbg :=_dadaa .(*_fc .PdfObjectInteger );if !_cbg {_cc .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");return nil ,_dg .Errorf ("\u0069n\u0076\u0061\u006c\u0069\u0064\u0020\u0042\u0069\u0074\u0073\u0050e\u0072\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074");};_ged .BitsPerComponent =int (*_gdff );};if _ged .Predictor > 1{_ged .Columns =1;_dadaa =_aef .Get ("\u0043o\u006c\u0075\u006d\u006e\u0073");if _dadaa !=nil {_cgae ,_affg :=_dadaa .(*_fc .PdfObjectInteger );if !_affg {return nil ,_dg .Errorf ("\u0070r\u0065\u0064\u0069\u0063\u0074\u006f\u0072\u0020\u0063\u006f\u006cu\u006d\u006e\u0020\u0069\u006e\u0076\u0061\u006c\u0069\u0064");};_ged .Columns =int (*_cgae );};_ged .Colors =1;_fba :=_aef .Get ("\u0043\u006f\u006c\u006f\u0072\u0073");if _fba !=nil {_fcf ,_aeac :=_fba .(*_fc .PdfObjectInteger );if !_aeac {return nil ,_dg .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");};_ged .Colors =int (*_fcf );};};return _ged ,nil ;};type handlerEntry struct{Condition HandlerConditionEnum ;Operand string ;Handler HandlerFunc ;};
// Add_h appends 'h' operand to the content stream:
// Close the current subpath by adding a line between the current position and the starting position.
//
// See section 8.5.2 "Path Construction Operators" and Table 59 (pp. 140-141 PDF32000_2008).
func (_eea *ContentCreator )Add_h ()*ContentCreator {_baf :=ContentStreamOperation {};_baf .Operand ="\u0068";_eea ._fge =append (_eea ._fge ,&_baf );return _eea ;};func _cecge (_dcfg _fc .PdfObject )(_ca .PdfColorspace ,error ){_gabc ,_adfe :=_dcfg .(*_fc .PdfObjectArray );if !_adfe {_cc .Log .Debug ("\u0045r\u0072\u006fr\u003a\u0020\u0049\u006ev\u0061\u006c\u0069d\u0020\u0069\u006e\u0064\u0065\u0078\u0065\u0064\u0020cs\u0020\u006e\u006ft\u0020\u0069n\u0020\u0061\u0072\u0072\u0061\u0079 \u0028\u0025#\u0076\u0029",_dcfg );return nil ,_b .New ("\u0074\u0079p\u0065\u0020\u0063h\u0065\u0063\u006b\u0020\u0065\u0072\u0072\u006f\u0072");};if _gabc .Len ()!=4{_cc .Log .Debug ("\u0045\u0072\u0072\u006f\u0072:\u0020\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0063\u0073\u0020\u0061r\u0072\u0061\u0079\u002c\u0020\u006c\u0065\u006e\u0067\u0074\u0068\u0020\u0021\u003d\u0020\u0034\u0020\u0028\u0025\u0064\u0029",_gabc .Len ());return nil ,_b .New ("\u0072\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b\u0020e\u0072\u0072\u006f\u0072");};_dfdg ,_adfe :=_gabc .Get (0).(*_fc .PdfObjectName );if !_adfe {_cc .Log .Debug ("E\u0072\u0072\u006f\u0072\u003a\u0020\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0063\u0073\u0020\u0061\u0072\u0072\u0061\u0079\u0020\u0066\u0069\u0072s\u0074 \u0065\u006c\u0065\u006de\u006e\u0074 \u006e\u006f\u0074\u0020\u0061\u0020\u006e\u0061\u006d\u0065\u0020\u0028\u0061\u0072\u0072\u0061\u0079\u003a\u0020\u0025\u0023\u0076\u0029",*_gabc );return nil ,_b .New ("\u0074\u0079p\u0065\u0020\u0063h\u0065\u0063\u006b\u0020\u0065\u0072\u0072\u006f\u0072");};if *_dfdg !="\u0049"&&*_dfdg !="\u0049n\u0064\u0065\u0078\u0065\u0064"{_cc .Log .Debug ("\u0045\u0072r\u006f\u0072\u003a\u0020\u0049n\u0076\u0061\u006c\u0069\u0064 \u0063\u0073\u0020\u0061\u0072\u0072\u0061\u0079\u0020\u0066\u0069\u0072\u0073\u0074\u0020\u0065\u006c\u0065\u006d\u0065\u006e\u0074\u0020\u0021\u003d\u0020\u0049\u0020\u0028\u0067\u006f\u0074\u003a\u0020\u0025\u0076\u0029",*_dfdg );return nil ,_b .New ("\u0072\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b\u0020e\u0072\u0072\u006f\u0072");};_dfdg ,_adfe =_gabc .Get (1).(*_fc .PdfObjectName );if !_adfe {_cc .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u003a\u0020\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0063\u0073\u0020\u0061\u0072r\u0061\u0079\u0020\u0032\u006e\u0064\u0020\u0065\u006c\u0065\u006d\u0065\u006e\u0074\u0020\u006e\u006f\u0074\u0020\u0061\u0020\u006e\u0061\u006d\u0065\u0020\u0028\u0061\u0072\u0072a\u0079\u003a\u0020\u0025\u0023v\u0029",*_gabc );return nil ,_b .New ("\u0074\u0079p\u0065\u0020\u0063h\u0065\u0063\u006b\u0020\u0065\u0072\u0072\u006f\u0072");};if *_dfdg !="\u0047"&&*_dfdg !="\u0052\u0047\u0042"&&*_dfdg !="\u0043\u004d\u0059\u004b"&&*_dfdg !="\u0044\u0065\u0076\u0069\u0063\u0065\u0047\u0072\u0061\u0079"&&*_dfdg !="\u0044e\u0076\u0069\u0063\u0065\u0052\u0047B"&&*_dfdg !="\u0044\u0065\u0076\u0069\u0063\u0065\u0043\u004d\u0059\u004b"{_cc .Log .Debug ("\u0045\u0072\u0072\u006f\u0072\u003a\u0020\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0063\u0073\u0020\u0061\u0072r\u0061\u0079\u0020\u0032\u006e\u0064\u0020\u0065\u006c\u0065\u006d\u0065\u006e\u0074\u0020\u0021\u003d\u0020\u0047\u002f\u0052\u0047\u0042\u002f\u0043\u004d\u0059\u004b\u0020\u0028g\u006f\u0074\u003a\u0020\u0025v\u0029",*_dfdg );return nil ,_b .New ("\u0072\u0061\u006e\u0067\u0065\u0020\u0063\u0068\u0065\u0063\u006b\u0020e\u0072\u0072\u006f\u0072");};_fffc :="";switch *_dfdg {case "\u0047","\u0044\u0065\u0076\u0069\u0063\u0065\u0047\u0072\u0061\u0079":_fffc ="\u0044\u0065\u0076\u0069\u0063\u0065\u0047\u0072\u0061\u0079";case "\u0052\u0047\u0042","\u0044e\u0076\u0069\u0063\u0065\u0052\u0047B":_fffc ="\u0044e\u0076\u0069\u0063\u0065\u0052\u0047B";case "\u0043\u004d\u0059\u004b","\u0044\u0065\u0076\u0069\u0063\u0065\u0043\u004d\u0059\u004b":_fffc ="\u0044\u0065\u0076\u0069\u0063\u0065\u0043\u004d\u0059\u004b";};_bfee :=_fc .MakeArray (_fc .MakeName ("\u0049n\u0064\u0065\u0078\u0065\u0064"),_fc .MakeName (_fffc ),_gabc .Get (2),_gabc .Get (3));return _ca .NewPdfColorspaceFromPdfObject (_bfee );};
// Add_TD appends 'TD' operand to the content stream:
// Move to start of next line with offset (`tx`, `ty`).
//
// See section 9.4.2 "Text Positioning Operators" and
// Table 108 (pp. 257-258 PDF32000_2008).
func (_ead *ContentCreator )Add_TD (tx ,ty float64 )*ContentCreator {_bed :=ContentStreamOperation {};_bed .Operand ="\u0054\u0044";_bed .Params =_deec ([]float64 {tx ,ty });_ead ._fge =append (_ead ._fge ,&_bed );return _ead ;};
// ContentStreamProcessor defines a data structure and methods for processing a content stream, keeping track of the
// current graphics state, and allowing external handlers to define their own functions as a part of the processing,
// for example rendering or extracting certain information.
type ContentStreamProcessor struct{_ecaa GraphicStateStack ;_aeaf []*ContentStreamOperation ;_dcgd GraphicsState ;_gdaa []handlerEntry ;_acbgb int ;};
// Add_G appends 'G' operand to the content stream:
// Set the stroking colorspace to DeviceGray and sets the gray level (0-1).
//
// See section 8.6.8 "Colour Operators" and Table 74 (p. 179-180 PDF32000_2008).
func (_cab *ContentCreator )Add_G (gray float64 )*ContentCreator {_bde :=ContentStreamOperation {};_bde .Operand ="\u0047";_bde .Params =_deec ([]float64 {gray });_cab ._fge =append (_cab ._fge ,&_bde );return _cab ;};
// Add_J adds 'J' operand to the content stream: Set the line cap style (graphics state).
//
// See section 8.4.4 "Graphic State Operators" and Table 57 (pp. 135-136 PDF32000_2008).
func (_eg *ContentCreator )Add_J (lineCapStyle string )*ContentCreator {_cd :=ContentStreamOperation {};_cd .Operand ="\u004a";_cd .Params =_cfcb ([]_fc .PdfObjectName {_fc .PdfObjectName (lineCapStyle )});_eg ._fge =append (_eg ._fge ,&_cd );return _eg ;};func (_dbcb *ContentStreamProcessor )handleCommand_sc (_dca *ContentStreamOperation ,_bae *_ca .PdfPageResources )error {_aga :=_dbcb ._dcgd .ColorspaceNonStroking ;if !_gad (_aga ){if len (_dca .Params )!=_aga .GetNumComponents (){_cc .Log .Debug ("I\u006e\u0076\u0061\u006c\u0069\u0064 \u006e\u0075\u006d\u0062\u0065\u0072 \u006f\u0066\u0020\u0070\u0061\u0072\u0061m\u0065\u0074\u0065\u0072\u0073\u0020\u0066\u006f\u0072\u0020S\u0043");_cc .Log .Debug ("\u004e\u0075mb\u0065\u0072\u0020%\u0064\u0020\u006e\u006ft m\u0061tc\u0068\u0069\u006e\u0067\u0020\u0063\u006flo\u0072\u0073\u0070\u0061\u0063\u0065\u0020%\u0054",len (_dca .Params ),_aga );return _b .New ("\u0069\u006e\u0076\u0061l\u0069\u0064\u0020\u006e\u0075\u006d\u0062\u0065\u0072\u0020o\u0066 \u0070\u0061\u0072\u0061\u006d\u0065\u0074e\u0072\u0073");};};_ccaee ,_ebge :=_aga .ColorFromPdfObjects (_dca .Params );if _ebge !=nil {return _ebge ;};_dbcb ._dcgd .ColorNonStroking =_ccaee ;return nil ;};
// Add_i adds 'i' operand to the content stream: Set the flatness tolerance in the graphics state.
//
// See section 8.4.4 "Graphic State Operators" and Table 57 (pp. 135-136 PDF32000_2008).
func (_dgf *ContentCreator )Add_i (flatness float64 )*ContentCreator {_gfg :=ContentStreamOperation {};_gfg .Operand ="\u0069";_gfg .Params =_deec ([]float64 {flatness });_dgf ._fge =append (_dgf ._fge ,&_gfg );return _dgf ;};
// HandlerConditionEnum represents the type of operand content stream processor (handler).
// The handler may process a single specific named operand or all operands.
type HandlerConditionEnum int ;func (_bgcg *ContentStreamParser )parseBool ()(_fc .PdfObjectBool ,error ){_aaf ,_fcbc :=_bgcg ._face .Peek (4);if _fcbc !=nil {return _fc .PdfObjectBool (false ),_fcbc ;};if (len (_aaf )>=4)&&(string (_aaf [:4])=="\u0074\u0072\u0075\u0065"){_bgcg ._face .Discard (4);return _fc .PdfObjectBool (true ),nil ;};_aaf ,_fcbc =_bgcg ._face .Peek (5);if _fcbc !=nil {return _fc .PdfObjectBool (false ),_fcbc ;};if (len (_aaf )>=5)&&(string (_aaf [:5])=="\u0066\u0061\u006cs\u0065"){_bgcg ._face .Discard (5);return _fc .PdfObjectBool (false ),nil ;};return _fc .PdfObjectBool (false ),_b .New ("\u0075n\u0065\u0078\u0070\u0065c\u0074\u0065\u0064\u0020\u0062o\u006fl\u0065a\u006e\u0020\u0073\u0074\u0072\u0069\u006eg");};
// Add_K appends 'K' operand to the content stream:
// Set the stroking colorspace to DeviceCMYK and sets the c,m,y,k color (0-1 each component).
//
// See section 8.6.8 "Colour Operators" and Table 74 (p. 179-180 PDF32000_2008).
func (_dab *ContentCreator )Add_K (c ,m ,y ,k float64 )*ContentCreator {_cec :=ContentStreamOperation {};_cec .Operand ="\u004b";_cec .Params =_deec ([]float64 {c ,m ,y ,k });_dab ._fge =append (_dab ._fge ,&_cec );return _dab ;};
// ContentStreamOperations is a slice of ContentStreamOperations.
type ContentStreamOperations []*ContentStreamOperation ;func (_gbd *ContentStreamProcessor )handleCommand_g (_eefg *ContentStreamOperation ,_dbgd *_ca .PdfPageResources )error {_acc :=_ca .NewPdfColorspaceDeviceGray ();if len (_eefg .Params )!=_acc .GetNumComponents (){_cc .Log .Debug ("\u0049\u006e\u0076al\u0069\u0064\u0020\u006e\u0075\u006d\u0062\u0065\u0072 \u006ff\u0020p\u0061r\u0061\u006d\u0065\u0074\u0065\u0072\u0073\u0020\u0066\u006f\u0072\u0020\u0067");_cc .Log .Debug ("\u004e\u0075mb\u0065\u0072\u0020%\u0064\u0020\u006e\u006ft m\u0061tc\u0068\u0069\u006e\u0067\u0020\u0063\u006flo\u0072\u0073\u0070\u0061\u0063\u0065\u0020%\u0054",len (_eefg .Params ),_acc );return _b .New ("\u0069\u006e\u0076\u0061l\u0069\u0064\u0020\u006e\u0075\u006d\u0062\u0065\u0072\u0020o\u0066 \u0070\u0061\u0072\u0061\u006d\u0065\u0074e\u0072\u0073");};_add ,_edc :=_acc .ColorFromPdfObjects (_eefg .Params );if _edc !=nil {_cc .Log .Debug ("\u0045\u0052\u0052\u004fR\u003a\u0020\u0068\u0061\u006e\u0064\u006c\u0065\u0043o\u006d\u006d\u0061\u006e\u0064\u005f\u0067\u0020\u0049\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0070\u0061r\u0061\u006d\u0073\u002e\u0020c\u0073\u003d\u0025\u0054\u0020\u006f\u0070\u003d\u0025\u0073\u0020\u0065\u0072\u0072\u003d\u0025\u0076",_acc ,_eefg ,_edc );return _edc ;};_gbd ._dcgd .ColorspaceNonStroking =_acc ;_gbd ._dcgd .ColorNonStroking =_add ;return nil ;};func (_ebfc *ContentStreamProcessor )handleCommand_K (_ecaab *ContentStreamOperation ,_ceg *_ca .PdfPageResources )error {_fgf :=_ca .NewPdfColorspaceDeviceCMYK ();if len (_ecaab .Params )!=_fgf .GetNumComponents (){_cc .Log .Debug ("I\u006e\u0076\u0061\u006c\u0069\u0064 \u006e\u0075\u006d\u0062\u0065\u0072 \u006f\u0066\u0020\u0070\u0061\u0072\u0061m\u0065\u0074\u0065\u0072\u0073\u0020\u0066\u006f\u0072\u0020S\u0043");_cc .Log .Debug ("\u004e\u0075mb\u0065\u0072\u0020%\u0064\u0020\u006e\u006ft m\u0061tc\u0068\u0069\u006e\u0067\u0020\u0063\u006flo\u0072\u0073\u0070\u0061\u0063\u0065\u0020%\u0054",len (_ecaab .Params ),_fgf );return _b .New ("\u0069\u006e\u0076\u0061l\u0069\u0064\u0020\u006e\u0075\u006d\u0062\u0065\u0072\u0020o\u0066 \u0070\u0061\u0072\u0061\u006d\u0065\u0074e\u0072\u0073");};_eece ,_fgfe :=_fgf .ColorFromPdfObjects (_ecaab .Params );if _fgfe !=nil {return _fgfe ;};_ebfc ._dcgd .ColorspaceStroking =_fgf ;_ebfc ._dcgd .ColorStroking =_eece ;return nil ;};
// Wrap ensures that the contentstream is wrapped within a balanced q ... Q expression.
func (_ce *ContentCreator )Wrap (){_ce ._fge .WrapIfNeeded ()};
// Add_TJ appends 'TJ' operand to the content stream:
// Show one or more text string. Array of numbers (displacement) and strings.
//
// See section 9.4.3 "Text Showing Operators" and
// Table 209 (pp. 258-259 PDF32000_2008).
func (_gaa *ContentCreator )Add_TJ (vals ..._fc .PdfObject )*ContentCreator {_bfe :=ContentStreamOperation {};_bfe .Operand ="\u0054\u004a";_bfe .Params =[]_fc .PdfObject {_fc .MakeArray (vals ...)};_gaa ._fge =append (_gaa ._fge ,&_bfe );return _gaa ;};
// ParseInlineImage parses an inline image from a content stream, both reading its properties and binary data.
// When called, "BI" has already been read from the stream. This function
// finishes reading through "EI" and then returns the ContentStreamInlineImage.
func (_fcdf *ContentStreamParser )ParseInlineImage ()(*ContentStreamInlineImage ,error ){_bbb :=ContentStreamInlineImage {};for {_fcdf .skipSpaces ();_affc ,_gfb ,_fdgb :=_fcdf .parseObject ();if _fdgb !=nil {return nil ,_fdgb ;};if !_gfb {_beef ,_ccbd :=_fc .GetName (_affc );if !_ccbd {_cc .Log .Debug ("\u0049\u006e\u0076\u0061\u006ci\u0064\u0020\u0069\u006e\u006c\u0069\u006e\u0065\u0020\u0069\u006d\u0061\u0067e\u0020\u0070\u0072\u006f\u0070\u0065\u0072\u0074\u0079\u0020\u0028\u0065\u0078\u0070\u0065\u0063\u0074\u0069\u006e\u0067\u0020\u006e\u0061\u006d\u0065\u0029\u0020\u002d\u0020\u0025T",_affc );return nil ,_dg .Errorf ("\u0069\u006e\u0076\u0061\u006ci\u0064\u0020\u0069\u006e\u006c\u0069\u006e\u0065\u0020\u0069\u006d\u0061\u0067e\u0020\u0070\u0072\u006f\u0070\u0065\u0072\u0074\u0079\u0020\u0028\u0065\u0078\u0070\u0065\u0063\u0074\u0069\u006e\u0067\u0020\u006e\u0061\u006d\u0065\u0029\u0020\u002d\u0020\u0025T",_affc );};_abed ,_ggdc ,_egd :=_fcdf .parseObject ();if _egd !=nil {return nil ,_egd ;};if _ggdc {return nil ,_dg .Errorf ("\u006eo\u0074\u0020\u0065\u0078\u0070\u0065\u0063\u0074\u0069\u006e\u0067 \u0061\u006e\u0020\u006f\u0070\u0065\u0072\u0061\u006e\u0064");};switch *_beef {case "\u0042\u0050\u0043","\u0042\u0069t\u0073\u0050\u0065r\u0043\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074":_bbb .BitsPerComponent =_abed ;case "\u0043\u0053","\u0043\u006f\u006c\u006f\u0072\u0053\u0070\u0061\u0063\u0065":_bbb .ColorSpace =_abed ;case "\u0044","\u0044\u0065\u0063\u006f\u0064\u0065":_bbb .Decode =_abed ;case "\u0044\u0050","D\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0072\u006d\u0073":_bbb .DecodeParms =_abed ;case "\u0046","\u0046\u0069\u006c\u0074\u0065\u0072":_bbb .Filter =_abed ;case "\u0048","\u0048\u0065\u0069\u0067\u0068\u0074":_bbb .Height =_abed ;case "\u0049\u004d","\u0049m\u0061\u0067\u0065\u004d\u0061\u0073k":_bbb .ImageMask =_abed ;case "\u0049\u006e\u0074\u0065\u006e\u0074":_bbb .Intent =_abed ;case "\u0049","I\u006e\u0074\u0065\u0072\u0070\u006f\u006c\u0061\u0074\u0065":_bbb .Interpolate =_abed ;case "\u0057","\u0057\u0069\u0064t\u0068":_bbb .Width =_abed ;case "\u004c\u0065\u006e\u0067\u0074\u0068","\u0053u\u0062\u0074\u0079\u0070\u0065","\u0054\u0079\u0070\u0065":_cc .Log .Debug ("\u0049\u0067\u006e\u006fr\u0069\u006e\u0067\u0020\u0069\u006e\u006c\u0069\u006e\u0065 \u0070a\u0072\u0061\u006d\u0065\u0074\u0065\u0072 \u0025\u0073",*_beef );default:return nil ,_dg .Errorf ("\u0075\u006e\u006b\u006e\u006f\u0077n\u0020\u0069\u006e\u006c\u0069\u006e\u0065\u0020\u0069\u006d\u0061\u0067\u0065 \u0070\u0061\u0072\u0061\u006d\u0065\u0074e\u0072\u0020\u0025\u0073",*_beef );};};if _gfb {_bcfb ,_fbe :=_affc .(*_fc .PdfObjectString );if !_fbe {return nil ,_dg .Errorf ("\u0066a\u0069\u006ce\u0064\u0020\u0074o\u0020\u0072\u0065\u0061\u0064\u0020\u0069n\u006c\u0069\u006e\u0065\u0020\u0069m\u0061\u0067\u0065\u0020\u002d\u0020\u0069\u006e\u0076\u0061\u006ci\u0064\u0020\u006f\u0070\u0065\u0072\u0061\u006e\u0064");};if _bcfb .Str ()=="\u0045\u0049"{_cc .Log .Trace ("\u0049n\u006c\u0069\u006e\u0065\u0020\u0069\u006d\u0061\u0067\u0065\u0020f\u0069\u006e\u0069\u0073\u0068\u0065\u0064\u002e\u002e\u002e");return &_bbb ,nil ;}else if _bcfb .Str ()=="\u0049\u0044"{_cc .Log .Trace ("\u0049\u0044\u0020\u0073\u0074\u0061\u0072\u0074");_agf ,_bfeg :=_fcdf ._face .Peek (1);if _bfeg !=nil {return nil ,_bfeg ;};if _fc .IsWhiteSpace (_agf [0]){_fcdf ._face .Discard (1);};_bbb ._cgbf =[]byte {};_gdg :=0;var _eec []byte ;for {_eed ,_bcbg :=_fcdf ._face .ReadByte ();if _bcbg !=nil {_cc .Log .Debug ("\u0055\u006e\u0061\u0062\u006ce\u0020\u0074\u006f\u0020\u0066\u0069\u006e\u0064\u0020\u0065\u006e\u0064\u0020o\u0066\u0020\u0069\u006d\u0061\u0067\u0065\u0020\u0045\u0049\u0020\u0069\u006e\u0020\u0069\u006e\u006c\u0069\u006e\u0065\u0020\u0069\u006d\u0061\u0067\u0065\u0020\u0064\u0061\u0074a");return nil ,_bcbg ;};if _gdg ==0{if _fc .IsWhiteSpace (_eed ){_eec =[]byte {};_eec =append (_eec ,_eed );_gdg =1;}else if _eed =='E'{_eec =append (_eec ,_eed );_gdg =2;}else {_bbb ._cgbf =append (_bbb ._cgbf ,_eed );};}else if _gdg ==1{_eec =append (_eec ,_eed );if _eed =='E'{_gdg =2;}else {_bbb ._cgbf =append (_bbb ._cgbf ,_eec ...);_eec =[]byte {};if _fc .IsWhiteSpace (_eed ){_gdg =1;}else {_gdg =0;};};}else if _gdg ==2{_eec =append (_eec ,_eed );if _eed =='I'{_gdg =3;}else {_bbb ._cgbf =append (_bbb ._cgbf ,_eec ...);_eec =[]byte {};_gdg =0;};}else if _gdg ==3{_eec =append (_eec ,_eed );if _fc .IsWhiteSpace (_eed ){_efa ,_afge :=_fcdf ._face .Peek (20);if _afge !=nil &&_afge !=_ea .EOF {return nil ,_afge ;};_agc :=NewContentStreamParser (string (_efa ));_gce :=true ;for _deab :=0;_deab < 3;_deab ++{_aefa ,_cgaf ,_cdg :=_agc .parseObject ();if _cdg !=nil {if _cdg ==_ea .EOF {break ;};continue ;};if _cgaf &&!_ddef (_aefa .String ()){_gce =false ;break ;};};if _gce {if len (_bbb ._cgbf )> 100{_cc .Log .Trace ("\u0049\u006d\u0061\u0067\u0065\u0020\u0073\u0074\u0072\u0065\u0061m\u0020\u0028\u0025\u0064\u0029\u003a\u0020\u0025\u0020\u0078 \u002e\u002e\u002e",len (_bbb ._cgbf ),_bbb ._cgbf [:100]);}else {_cc .Log .Trace ("\u0049\u006d\u0061\u0067e \u0073\u0074\u0072\u0065\u0061\u006d\u0020\u0028\u0025\u0064\u0029\u003a\u0020\u0025 \u0078",len (_bbb ._cgbf ),_bbb ._cgbf );};return &_bbb ,nil ;};};_bbb ._cgbf =append (_bbb ._cgbf ,_eec ...);_eec =[]byte {};_gdg =0;};};};};};};
// HandlerFunc is the function syntax that the ContentStreamProcessor handler must implement.
type HandlerFunc func (_ebca *ContentStreamOperation ,_ecaf GraphicsState ,_bgae *_ca .PdfPageResources )error ;
// Add_b_starred appends 'b*' operand to the content stream:
// Close, fill and then stroke the path (even-odd winding number rule).
//
// See section 8.5.3 "Path Painting Operators" and Table 60 (p. 143 PDF32000_2008).
func (_dde *ContentCreator )Add_b_starred ()*ContentCreator {_bga :=ContentStreamOperation {};_bga .Operand ="\u0062\u002a";_dde ._fge =append (_dde ._fge ,&_bga );return _dde ;};
// ContentStreamInlineImage is a representation of an inline image in a Content stream. Everything between the BI and EI operands.
// ContentStreamInlineImage implements the core.PdfObject interface although strictly it is not a PDF object.
type ContentStreamInlineImage struct{BitsPerComponent _fc .PdfObject ;ColorSpace _fc .PdfObject ;Decode _fc .PdfObject ;DecodeParms _fc .PdfObject ;Filter _fc .PdfObject ;Height _fc .PdfObject ;ImageMask _fc .PdfObject ;Intent _fc .PdfObject ;Interpolate _fc .PdfObject ;Width _fc .PdfObject ;_cgbf []byte ;_aefd *_c .ImageBase ;};
// Add_quotes appends `"` operand to the content stream:
// Move to next line and show a string, using `aw` and `ac` as word
// and character spacing respectively.
//
// See section 9.4.3 "Text Showing Operators" and
// Table 209 (pp. 258-259 PDF32000_2008).
func (_fbc *ContentCreator )Add_quotes (textstr _fc .PdfObjectString ,aw ,ac float64 )*ContentCreator {_gdf :=ContentStreamOperation {};_gdf .Operand ="\u0022";_gdf .Params =_deec ([]float64 {aw ,ac });_gdf .Params =append (_gdf .Params ,_gdfa ([]_fc .PdfObjectString {textstr })...);_fbc ._fge =append (_fbc ._fge ,&_gdf );return _fbc ;};
// Process processes the entire list of operations. Maintains the graphics state that is passed to any
// handlers that are triggered during processing (either on specific operators or all).
func (_adga *ContentStreamProcessor )Process (resources *_ca .PdfPageResources )error {_adga ._dcgd .ColorspaceStroking =_ca .NewPdfColorspaceDeviceGray ();_adga ._dcgd .ColorspaceNonStroking =_ca .NewPdfColorspaceDeviceGray ();_adga ._dcgd .ColorStroking =_ca .NewPdfColorDeviceGray (0);_adga ._dcgd .ColorNonStroking =_ca .NewPdfColorDeviceGray (0);_adga ._dcgd .CTM =_bgc .IdentityMatrix ();for _ ,_bbbd :=range _adga ._aeaf {var _bgaed error ;switch _bbbd .Operand {case "\u0071":_adga ._ecaa .Push (_adga ._dcgd );case "\u0051":if len (_adga ._ecaa )==0{_cc .Log .Debug ("\u0057\u0041\u0052\u004e\u003a\u0020\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0060\u0051\u0060\u0020\u006f\u0070e\u0072\u0061\u0074\u006f\u0072\u002e\u0020\u0047\u0072\u0061\u0070\u0068\u0069\u0063\u0073\u0020\u0073\u0074\u0061\u0074\u0065 \u0073\u0074\u0061\u0063\u006b\u0020\u0069\u0073\u0020\u0065\u006d\u0070\u0074\u0079.\u0020\u0053\u006bi\u0070\u0070\u0069\u006e\u0067\u002e");continue ;};_adga ._dcgd =_adga ._ecaa .Pop ();case "\u0043\u0053":_bgaed =_adga .handleCommand_CS (_bbbd ,resources );case "\u0063\u0073":_bgaed =_adga .handleCommand_cs (_bbbd ,resources );case "\u0053\u0043":_bgaed =_adga .handleCommand_SC (_bbbd ,resources );case "\u0053\u0043\u004e":_bgaed =_adga .handleCommand_SCN (_bbbd ,resources );case "\u0073\u0063":_bgaed =_adga .handleCommand_sc (_bbbd ,resources );case "\u0073\u0063\u006e":_bgaed =_adga .handleCommand_scn (_bbbd ,resources );case "\u0047":_bgaed =_adga .handleCommand_G (_bbbd ,resources );case "\u0067":_bgaed =_adga .handleCommand_g (_bbbd ,resources );case "\u0052\u0047":_bgaed =_adga .handleCommand_RG (_bbbd ,resources );case "\u0072\u0067":_bgaed =_adga .handleCommand_rg (_bbbd ,resources );case "\u004b":_bgaed =_adga .handleCommand_K (_bbbd ,resources );case "\u006b":_bgaed =_adga .handleCommand_k (_bbbd ,resources );case "\u0063\u006d":_bgaed =_adga .handleCommand_cm (_bbbd ,resources );};if _bgaed !=nil {_cc .Log .Debug ("\u0050\u0072\u006f\u0063\u0065\u0073s\u006f\u0072\u0020\u0068\u0061\u006e\u0064\u006c\u0069\u006e\u0067\u0020\u0065r\u0072\u006f\u0072\u0020\u0028\u0025\u0073)\u003a\u0020\u0025\u0076",_bbbd .Operand ,_bgaed );_cc .Log .Debug ("\u004f\u0070\u0065r\u0061\u006e\u0064\u003a\u0020\u0025\u0023\u0076",_bbbd .Operand );return _bgaed ;};for _ ,_ebgb :=range _adga ._gdaa {var _gbc error ;if _ebgb .Condition .All (){_gbc =_ebgb .Handler (_bbbd ,_adga ._dcgd ,resources );}else if _ebgb .Condition .Operand ()&&_bbbd .Operand ==_ebgb .Operand {_gbc =_ebgb .Handler (_bbbd ,_adga ._dcgd ,resources );};if _gbc !=nil {_cc .Log .Debug ("P\u0072\u006f\u0063\u0065\u0073\u0073o\u0072\u0020\u0068\u0061\u006e\u0064\u006c\u0065\u0072 \u0065\u0072\u0072o\u0072:\u0020\u0025\u0076",_gbc );return _gbc ;};};};return nil ;};func (_ccba *ContentStreamParser )skipSpaces ()(int ,error ){_cgaec :=0;for {_affb ,_gdef :=_ccba ._face .Peek (1);if _gdef !=nil {return 0,_gdef ;};if _fc .IsWhiteSpace (_affb [0]){_ccba ._face .ReadByte ();_cgaec ++;}else {break ;};};return _cgaec ,nil ;};func _gad (_fcge _ca .PdfColorspace )bool {_ ,_faa :=_fcge .(*_ca .PdfColorspaceSpecialPattern );return _faa ;};func (_dgce *ContentStreamParser )parseArray ()(*_fc .PdfObjectArray ,error ){_ffd :=_fc .MakeArray ();_dgce ._face .ReadByte ();for {_dgce .skipSpaces ();_fga ,_egde :=_dgce ._face .Peek (1);if _egde !=nil {return _ffd ,_egde ;};if _fga [0]==']'{_dgce ._face .ReadByte ();break ;};_cdga ,_ ,_egde :=_dgce .parseObject ();if _egde !=nil {return _ffd ,_egde ;};_ffd .Append (_cdga );};return _ffd ,nil ;};func (_edgd *ContentStreamProcessor )handleCommand_scn (_dgdg *ContentStreamOperation ,_dcge *_ca .PdfPageResources )error {_fbda :=_edgd ._dcgd .ColorspaceNonStroking ;if !_gad (_fbda ){if len (_dgdg .Params )!=_fbda .GetNumComponents (){_cc .Log .Debug ("I\u006e\u0076\u0061\u006c\u0069\u0064 \u006e\u0075\u006d\u0062\u0065\u0072 \u006f\u0066\u0020\u0070\u0061\u0072\u0061m\u0065\u0074\u0065\u0072\u0073\u0020\u0066\u006f\u0072\u0020S\u0043");_cc .Log .Debug ("\u004e\u0075mb\u0065\u0072\u0020%\u0064\u0020\u006e\u006ft m\u0061tc\u0068\u0069\u006e\u0067\u0020\u0063\u006flo\u0072\u0073\u0070\u0061\u0063\u0065\u0020%\u0054",len (_dgdg .Params ),_fbda );return _b .New ("\u0069\u006e\u0076\u0061l\u0069\u0064\u0020\u006e\u0075\u006d\u0062\u0065\u0072\u0020o\u0066 \u0070\u0061\u0072\u0061\u006d\u0065\u0074e\u0072\u0073");};};_aebd ,_abb :=_fbda .ColorFromPdfObjects (_dgdg .Params );if _abb !=nil {_cc .Log .Debug ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0046\u0061\u0069\u006c \u0074\u006f\u0020\u0067\u0065\u0074\u0020\u0063o\u006co\u0072\u0020\u0066\u0072\u006f\u006d\u0020\u0070\u0061\u0072\u0061\u006d\u0073\u003a\u0020\u0025\u002b\u0076 \u0028\u0043\u0053\u0020\u0069\u0073\u0020\u0025\u002b\u0076\u0029",_dgdg .Params ,_fbda );return _abb ;};_edgd ._dcgd .ColorNonStroking =_aebd ;return nil ;};const (HandlerConditionEnumOperand HandlerConditionEnum =iota ;HandlerConditionEnumAllOperands ;);
// Add_quote appends "'" operand to the content stream:
// Move to next line and show a string.
//
// See section 9.4.3 "Text Showing Operators" and
// Table 209 (pp. 258-259 PDF32000_2008).
func (_ed *ContentCreator )Add_quote (textstr _fc .PdfObjectString )*ContentCreator {_bgcd :=ContentStreamOperation {};_bgcd .Operand ="\u0027";_bgcd .Params =_gdfa ([]_fc .PdfObjectString {textstr });_ed ._fge =append (_ed ._fge ,&_bgcd );return _ed ;};
// Add_M adds 'M' operand to the content stream: Set the miter limit (graphics state).
//
// See section 8.4.4 "Graphic State Operators" and Table 57 (pp. 135-136 PDF32000_2008).
func (_gc *ContentCreator )Add_M (miterlimit float64 )*ContentCreator {_ba :=ContentStreamOperation {};_ba .Operand ="\u004d";_ba .Params =_deec ([]float64 {miterlimit });_gc ._fge =append (_gc ._fge ,&_ba );return _gc ;};func (_acb *ContentStreamInlineImage )toImageBase (_ebce *_ca .PdfPageResources )(*_c .ImageBase ,error ){if _acb ._aefd !=nil {return _acb ._aefd ,nil ;};_abf :=_c .ImageBase {};if _acb .Height ==nil {return nil ,_b .New ("\u0068e\u0069\u0067\u0068\u0074\u0020\u0061\u0074\u0074\u0072\u0069\u0062u\u0074\u0065\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067");};_gcaf ,_ebfg :=_acb .Height .(*_fc .PdfObjectInteger );if !_ebfg {return nil ,_b .New ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0068e\u0069\u0067\u0068\u0074");};_abf .Height =int (*_gcaf );if _acb .Width ==nil {return nil ,_b .New ("\u0077\u0069\u0064th\u0020\u0061\u0074\u0074\u0072\u0069\u0062\u0075\u0074\u0065\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067");};_gba ,_ebfg :=_acb .Width .(*_fc .PdfObjectInteger );if !_ebfg {return nil ,_b .New ("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0077\u0069\u0064\u0074\u0068");};_abf .Width =int (*_gba );_abd ,_cbfb :=_acb .IsMask ();if _cbfb !=nil {return nil ,_cbfb ;};if _abd {_abf .BitsPerComponent =1;_abf .ColorComponents =1;}else {if _acb .BitsPerComponent ==nil {_cc .Log .Debug ("\u0049\u006el\u0069\u006e\u0065\u0020\u0042\u0069\u0074\u0073\u0020\u0070\u0065\u0072\u0020\u0063\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u002d\u0020\u0061\u0073\u0073\u0075\u006d\u0069\u006e\u0067\u0020\u0038");_abf .BitsPerComponent =8;}else {_cabg ,_afd :=_acb .BitsPerComponent .(*_fc .PdfObjectInteger );if !_afd {_cc .Log .Debug ("E\u0072\u0072\u006f\u0072\u0020\u0069\u006e\u0076\u0061l\u0069\u0064\u0020\u0062\u0069\u0074\u0073 p\u0065\u0072\u0020\u0063o\u006d\u0070\u006f\u006e\u0065\u006e\u0074\u0020\u0076al\u0075\u0065,\u0020\u0074\u0079\u0070\u0065\u0020\u0025\u0054",_acb .BitsPerComponent );return nil ,_b .New ("\u0042\u0050\u0043\u0020\u0054\u0079\u0070\u0065\u0020e\u0072\u0072\u006f\u0072");};_abf .BitsPerComponent =int (*_cabg );};if _acb .ColorSpace !=nil {_ebdb ,_fede :=_acb .GetColorSpace (_ebce );if _fede !=nil {return nil ,_fede ;};_abf .ColorComponents =_ebdb .GetNumComponents ();}else {_cc .Log .Debug ("\u0049\u006el\u0069\u006e\u0065\u0020\u0049\u006d\u0061\u0067\u0065\u0020\u0063\u006f\u006c\u006f\u0072\u0073\u0070\u0061\u0063e\u0020\u006e\u006f\u0074\u0020\u0073p\u0065\u0063\u0069\u0066\u0069\u0065\u0064\u0020\u002d\u0020\u0061\u0073\u0073\u0075m\u0069\u006eg\u0020\u0031\u0020\u0063o\u006c\u006f\u0072\u0020\u0063o\u006d\u0070\u006f\u006e\u0065\u006e\u0074");_abf .ColorComponents =1;};};if _eda ,_gacb :=_fc .GetArray (_acb .Decode );_gacb {_abf .Decode ,_cbfb =_eda .ToFloat64Array ();if _cbfb !=nil {return nil ,_cbfb ;};};_acb ._aefd =&_abf ;return _acb ._aefd ,nil ;};
// AddHandler adds a new ContentStreamProcessor `handler` of type `condition` for `operand`.
func (_fcea *ContentStreamProcessor )AddHandler (condition HandlerConditionEnum ,operand string ,handler HandlerFunc ){_cfcg :=handlerEntry {};_cfcg .Condition =condition ;_cfcg .Operand =operand ;_cfcg .Handler =handler ;_fcea ._gdaa =append (_fcea ._gdaa ,_cfcg );};
// Add_g appends 'g' operand to the content stream:
// Same as G but used for nonstroking operations.
//
// See section 8.6.8 "Colour Operators" and Table 74 (p. 179-180 PDF32000_2008).
func (_cgc *ContentCreator )Add_g (gray float64 )*ContentCreator {_cgac :=ContentStreamOperation {};_cgac .Operand ="\u0067";_cgac .Params =_deec ([]float64 {gray });_cgc ._fge =append (_cgc ._fge ,&_cgac );return _cgc ;};func _ddef (_adcg string )bool {_ ,_afa :=_febg [_adcg ];return _afa };
// Add_Td appends 'Td' operand to the content stream:
// Move to start of next line with offset (`tx`, `ty`).
//
// See section 9.4.2 "Text Positioning Operators" and
// Table 108 (pp. 257-258 PDF32000_2008).
func (_dge *ContentCreator )Add_Td (tx ,ty float64 )*ContentCreator {_ecdc :=ContentStreamOperation {};_ecdc .Operand ="\u0054\u0064";_ecdc .Params =_deec ([]float64 {tx ,ty });_dge ._fge =append (_dge ._fge ,&_ecdc );return _dge ;};func _egfc (_efc *ContentStreamInlineImage )(_fc .StreamEncoder ,error ){if _efc .Filter ==nil {return _fc .NewRawEncoder (),nil ;};_fbb ,_ab :=_efc .Filter .(*_fc .PdfObjectName );if !_ab {_ebe ,_bcgc :=_efc .Filter .(*_fc .PdfObjectArray );if !_bcgc {return nil ,_dg .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");};if _ebe .Len ()==0{return _fc .NewRawEncoder (),nil ;};if _ebe .Len ()!=1{_cgbe ,_gace :=_bbf (_efc );if _gace !=nil {_cc .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",_gace );return nil ,_gace ;};_cc .Log .Trace ("\u004d\u0075\u006c\u0074\u0069\u0020\u0065\u006e\u0063:\u0020\u0025\u0073\u000a",_cgbe );return _cgbe ,nil ;};_dada :=_ebe .Get (0);_fbb ,_bcgc =_dada .(*_fc .PdfObjectName );if !_bcgc {return nil ,_dg .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");};};switch *_fbb {case "\u0041\u0048\u0078","\u0041\u0053\u0043\u0049\u0049\u0048\u0065\u0078\u0044e\u0063\u006f\u0064\u0065":return _fc .NewASCIIHexEncoder (),nil ;case "\u0041\u0038\u0035","\u0041\u0053\u0043\u0049\u0049\u0038\u0035\u0044\u0065\u0063\u006f\u0064\u0065":return _fc .NewASCII85Encoder (),nil ;case "\u0044\u0043\u0054","\u0044C\u0054\u0044\u0065\u0063\u006f\u0064e":return _gfcb (_efc );case "\u0046\u006c","F\u006c\u0061\u0074\u0065\u0044\u0065\u0063\u006f\u0064\u0065":return _cca (_efc ,nil );case "\u004c\u005a\u0057","\u004cZ\u0057\u0044\u0065\u0063\u006f\u0064e":return _ebf (_efc ,nil );case "\u0043\u0043\u0046","\u0043\u0043\u0049\u0054\u0054\u0046\u0061\u0078\u0044e\u0063\u006f\u0064\u0065":return _fc .NewCCITTFaxEncoder (),nil ;case "\u0052\u004c","\u0052u\u006eL\u0065\u006e\u0067\u0074\u0068\u0044\u0065\u0063\u006f\u0064\u0065":return _fc .NewRunLengthEncoder (),nil ;default:_cc .Log .Debug ("\u0055\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u0020\u0069\u006e\u006c\u0069\u006e\u0065 \u0069\u006d\u0061\u0067\u0065\u0020\u0065n\u0063\u006f\u0064\u0069\u006e\u0067\u0020\u0066\u0069\u006c\u0074e\u0072\u0020\u006e\u0061\u006d\u0065\u0020\u003a\u0020\u0025\u0073",*_fbb );return nil ,_b .New ("\u0075\u006e\u0073up\u0070\u006f\u0072\u0074\u0065\u0064\u0020\u0069\u006el\u0069n\u0065 \u0065n\u0063\u006f\u0064\u0069\u006e\u0067\u0020\u006d\u0065\u0074\u0068\u006f\u0064");};};
// Add_Tj appends 'Tj' operand to the content stream:
// Show a text string.
//
// See section 9.4.3 "Text Showing Operators" and
// Table 209 (pp. 258-259 PDF32000_2008).
func (_fb *ContentCreator )Add_Tj (textstr _fc .PdfObjectString )*ContentCreator {_gca :=ContentStreamOperation {};_gca .Operand ="\u0054\u006a";_gca .Params =_gdfa ([]_fc .PdfObjectString {textstr });_fb ._fge =append (_fb ._fge ,&_gca );return _fb ;};
// Add_B_starred appends 'B*' operand to the content stream:
// Fill and then stroke the path (even-odd rule).
//
// See section 8.5.3 "Path Painting Operators" and Table 60 (p. 143 PDF32000_2008).
func (_bfc *ContentCreator )Add_B_starred ()*ContentCreator {_ceb :=ContentStreamOperation {};_ceb .Operand ="\u0042\u002a";_bfc ._fge =append (_bfc ._fge ,&_ceb );return _bfc ;};
// GetEncoder returns the encoder of the inline image.
func (_dac *ContentStreamInlineImage )GetEncoder ()(_fc .StreamEncoder ,error ){return _egfc (_dac )};
// Add_SC appends 'SC' operand to the content stream:
// Set color for stroking operations. Input: c1, ..., cn.
//
// See section 8.6.8 "Colour Operators" and Table 74 (p. 179-180 PDF32000_2008).
func (_fac *ContentCreator )Add_SC (c ...float64 )*ContentCreator {_cfa :=ContentStreamOperation {};_cfa .Operand ="\u0053\u0043";_cfa .Params =_deec (c );_fac ._fge =append (_fac ._fge ,&_cfa );return _fac ;};
// AddOperand adds a specified operand.
func (_dc *ContentCreator )AddOperand (op ContentStreamOperation )*ContentCreator {_dc ._fge =append (_dc ._fge ,&op );return _dc ;};
// Add_f_starred appends 'f*' operand to the content stream.
// f*: Fill the path using the even-odd rule to determine fill region.
//
// See section 8.5.3 "Path Painting Operators" and Table 60 (p. 143 PDF32000_2008).
func (_ggb *ContentCreator )Add_f_starred ()*ContentCreator {_ff :=ContentStreamOperation {};_ff .Operand ="\u0066\u002a";_ggb ._fge =append (_ggb ._fge ,&_ff );return _ggb ;};
// NewContentStreamParser creates a new instance of the content stream parser from an input content
// stream string.
func NewContentStreamParser (contentStr string )*ContentStreamParser {_edab :=ContentStreamParser {};_bag :=_gd .NewBufferString (contentStr +"\u000a");_edab ._face =_bg .NewReader (_bag );return &_edab ;};