Base

Base API reference

Namespace: Com\Tecnick\Pdf\Graph

abstract class Base

Source: src/Base.php:87

Types

TTMatrix

array{
   float,
   float,
   float,
   float,
   float,
   float,
}

StyleData

array{
    'lineWidth': float,
    'lineCap': string,
    'lineJoin': string,
    'miterLimit': float,
    'dashArray': array<int|float>,
    'dashPhase': float,
    'lineColor': string,
    'fillColor': string,
}

StyleDataOpt

array{
    'lineWidth'?: float,
    'lineCap'?: string,
    'lineJoin'?: string,
    'miterLimit'?: float,
    'dashArray'?: array<int|float>,
    'dashPhase'?: float,
    'lineColor'?: string,
    'fillColor'?: string,
}

GradientData

array{
    'antialias': bool,
    'background': ?Model,
    'colors': array<int, array{
        'color': string,
        'exponent'?: float,
        'opacity'?: float,
        'offset'?: float,
    }>,
    'colspace': string,
    'coords': array<float>,
    'id': int,
    'pattern': int,
    'stream': string,
    'transparency': bool,
    'type': int,
}

Constants

IDMATRIX

Identity matrix for transformations.

public const IDMATRIX = [1.0, 0.0, 0.0, 1.0, 0.0, 0.0]

Source: src/Base.php:101

MPI

Pi constant.

public const MPI = 3.141592653589793

Source: src/Base.php:94

Methods

__construct()

Initialize

public __construct(
    float $kunit,
    float $pagew,
    float $pageh,
    Pdf $pdfColor,
    Encrypt $encrypt,
    bool $notransparency = false,
    bool $compress = true
)

Parameters:

  • $kunit (float): Unit of measure conversion ratio.
  • $pagew (float): Page width.
  • $pageh (float): Page height.
  • $pdfColor (Pdf): Color object.
  • $encrypt (Encrypt): Encrypt object.
  • $notransparency (bool): True when the conformance mode forbids transparency (PDF/A-1, PDF/X-1a, PDF/X-3): alpha, blend modes and soft masks are suppressed. Shadings stay available.
  • $compress (bool): Set to false to disable stream compression.

Throws:

Source: src/Base.php:191

getDefaultStyle()

Returns the default style.

public getDefaultStyle(StyleDataOpt $style = []): StyleData

Parameters:

  • $style (StyleDataOpt): Style parameters to merge to the default ones.

Returns: StyleData

Source: src/Base.php:227

getLastExtGStateID()

Returns the last extgstate ID to be used with XObjects.

public getLastExtGStateID(): ?int

Returns: ?int

Source: src/Base.php:356

getObjectNumber()

Returns current PDF object number

public getObjectNumber(): int

Returns: int

Source: src/Base.php:269

getOutExtGState()

Get the PDF output string for ExtGState

public getOutExtGState(int $pon): string

Parameters:

  • $pon (int): Current PDF Object Number

Returns: string: PDF command

Source: src/Base.php:326

getOutExtGStateResources()

Get the PDF output string for ExtGState Resource Dictionary

public getOutExtGStateResources(): string

Returns: string: PDF command

Source: src/Base.php:438

getOutExtGStateResourcesByKeys()

Get the PDF output string for ExtGState Resource Dictionary for XObjects.

public getOutExtGStateResourcesByKeys(int[] $keys): string

Parameters:

  • $keys (int[]): Array of extgstates keys.

Returns: string: PDF command

Source: src/Base.php:450

getOutGradientResources()

Get the PDF output string for Gradients Resource Dictionary

public getOutGradientResources(): string

Returns: string: PDF command

Source: src/Base.php:503

getOutGradientResourcesByKeys()

Returns the PDF command to output gradient resources.

public getOutGradientResourcesByKeys(int[] $keys): string

Parameters:

  • $keys (int[]): Array of gradient keys.

Returns: string: PDF command

Source: src/Base.php:515

getOutGradientShaders()

Get the PDF output string for gradient shaders

public getOutGradientShaders(int $pon): string

Parameters:

  • $pon (int): Current PDF Object Number

Returns: string: PDF command

Throws:

Source: src/Base.php:783

getTransparencyExtGStateNames()

Returns the resource names of the registered ExtGState objects that carry transparency: a fill or stroke alpha below 1, a blend mode other than Normal, or a soft mask.

The names match the tokens used by the “gs” operator (for example “GS3”).

public getTransparencyExtGStateNames(): array<int,string>

Returns: array<int,string>: List of ExtGState resource names.

Source: src/Base.php:369

initStyle()

Initialize default style

public initStyle(): void

Source: src/Base.php:215

setKUnit()

Set unit of measure conversion ratio.

public setKUnit(float $kunit): static

Parameters:

  • $kunit (float): Unit of measure conversion ratio. Must be greater than zero.

Returns: static

Throws:

Source: src/Base.php:309

setPageHeight()

Set page height and returns previous value.

public setPageHeight(float $pageh): float

Parameters:

  • $pageh (float): Page height.

Returns: float: previous page height value.

Source: src/Base.php:281

setPageWidth()

Set page width and returns previous value.

public setPageWidth(float $pagew): float

Parameters:

  • $pagew (float): Page width.

Returns: float: previous page width value.

Source: src/Base.php:295