Style

Style API reference

Namespace: Com\Tecnick\Pdf\Graph

abstract class Style extends Base

Extends: Base

Source: src/Style.php:38

Methods

add()

Add a new style

public add(StyleDataOpt $style = [], bool $inheritlast = false): string

Parameters:

  • $style (StyleDataOpt): Style to add.
  • $inheritlast (bool): If true inherit missing values from the last style.

Returns: string: PDF style string

Source: src/Style.php:233

getCurrentStyleArray()

Returns the last style array.

public getCurrentStyleArray(): StyleDataOpt

Returns: StyleDataOpt

Source: src/Style.php:290

getCurrentStyleItem()

Returns the value of the specified item from the last inserted style.

public getCurrentStyleItem(string $item): mixed

Parameters:

  • $item (string): Item to search.

Returns: mixed

Throws:

Source: src/Style.php:331

getExtGState()

Add transparency parameters to the current extgstate.

public getExtGState(array<string,int|float|bool|string> $parms): string

Parameters:

  • $parms (array<string,int|float|bool|string>): parameters.

Returns: string: PDF command.

Source: src/Style.php:608

getLastStyleProperty()

Returns the last set value of the specified property.

public getLastStyleProperty(string $property, int|float|bool|string|null $default = null): int|float|bool|string|null

Parameters:

  • $property (string): Property to search.
  • $default (int|float|bool|string|null): Default value to return in case the property is not found.

Returns: int|float|bool|string|null: Property value or $default in case the property is not found.

Source: src/Style.php:307

getModeWithClose()

Add the Close option to the specified Path paint operator.

Modes that do not stroke, or that already close, are returned unchanged.

public getModeWithClose(string|PathPaintOp $mode): string

Parameters:

Returns: string

Source: src/Style.php:526

getModeWithoutClose()

Remove the Close option from the specified Path paint operator.

public getModeWithoutClose(string|PathPaintOp $mode): string

Parameters:

Returns: string

Source: src/Style.php:546

getModeWithoutFill()

Remove the Fill option from the specified Path paint operator.

public getModeWithoutFill(string|PathPaintOp $mode): string

Parameters:

Returns: string

Source: src/Style.php:566

getModeWithoutStroke()

Remove the Stroke option from the specified Path paint operator.

public getModeWithoutStroke(string|PathPaintOp $mode): string

Parameters:

Returns: string

Source: src/Style.php:586

getPathPaintOp()

Get the Path-Painting Operators.

public getPathPaintOp(string|PathPaintOp $mode, string|PathPaintOp $default = 'S'): string

Parameters:

  • $mode (string|PathPaintOp): Mode of rendering. Possible values are:
    • S or D: stroke the path;
    • s or d: close and stroke the path;
    • f or F: fill the path, using the nonzero winding number rule;
    • f* or F*: fill the path, using the even-odd rule;
    • B or FD or DF: fill and then stroke the path, using the nonzero winding number rule;
    • B* or FD or DF: fill and then stroke the path, using the even-odd rule;
    • b or fd or df: close, fill and then stroke the path, using the nonzero winding number rule;
    • b* or fd or df: close, fill and then stroke the path, using the even-odd rule;
    • CNZ: clipping mode using the nonzero winding number rule;
    • CEO: clipping mode using the even-odd rule;
    • h: close the path;
    • n: end the path object without filling or stroking it.
  • $default (string|PathPaintOp): Mode to use when $mode is empty or unknown.

Returns: string

Source: src/Style.php:439

getStyle()

Returns the PDF string of the last style added.

public getStyle(): string

Returns: string

Source: src/Style.php:344

getStyleCmd()

Returns the PDF string of the specified style.

public getStyleCmd(StyleDataOpt $style = []): string

Parameters:

Returns: string

Source: src/Style.php:354

isClippingMode()

Returns true if the specified mode is of clipping type.

public isClippingMode(string|PathPaintOp $mode): bool

Parameters:

Returns: bool

Source: src/Style.php:509

isClosingMode()

Returns true if the specified mode includes “closing the path” option.

public isClosingMode(string|PathPaintOp $mode): bool

Parameters:

Returns: bool

Source: src/Style.php:495

isFillingMode()

Returns true if the specified path paint operator includes the filling option.

public isFillingMode(string|PathPaintOp $mode): bool

Parameters:

Returns: bool

Source: src/Style.php:465

isStrokingMode()

Returns true if the specified mode includes the stroking option.

public isStrokingMode(string|PathPaintOp $mode): bool

Parameters:

Returns: bool

Source: src/Style.php:479

pop()

Remove and return last style.

public pop(): string

Returns: string: PDF style string.

Throws:

Source: src/Style.php:250

restoreStyleStatus()

Restore the saved style status.

public restoreStyleStatus(): void

Source: src/Style.php:273

saveStyleStatus()

Save the current style ID to be restored later.

public saveStyleStatus(): void

Source: src/Style.php:265

Inherited members

From Base