PdfColor

PDF color adapter with conformance-aware output.

Namespace: Com\Tecnick\Pdf

class PdfColor extends Pdf

Extends: Pdf

Source: src/PdfColor.php:32

PDF color adapter with conformance-aware output.

Methods

getColorObj()

Get the color object from a web color definition.

The objects of the strings accepted by isCacheableColorString() are cached and returned as copies.

public getColorObj(string $color): ?Model

Parameters:

  • $color (string): String containing web color definition

Returns: ?Model

Throws:

Source: src/PdfColor.php:79

getEmittedCmykSpotColors()

Return the names of the emitted spot colors whose Separation alternate space is DeviceCMYK.

public getEmittedCmykSpotColors(): array<int,string>

Returns: array<int,string>

Source: src/PdfColor.php:142

getPdfColor()

Return a PDF color operator string.

When DeviceCMYK forcing is enabled, process colors are emitted as CMYK operators to avoid DeviceRGB output in restrictive PDF/X modes.

public getPdfColor(
    string $color,
    bool $stroke = false,
    float $tint = 1,
    bool $allowSpot = true
): string

Parameters:

  • $color (string): Color name, hex value, or spot() CSS function.
  • $stroke (bool): If true return the stroking color operator, otherwise the non-stroking one.
  • $tint (float): Tint value in the range 0-1 applied to spot colors.
  • $allowSpot (bool): True to resolve (and register) spot colors, false to force a device color.

Returns: string: PDF color operator string.

Source: src/PdfColor.php:291

hasEmittedDeviceCmyk()

Return true when a DeviceCMYK color operator was emitted.

public hasEmittedDeviceCmyk(): bool

Returns: bool

Source: src/PdfColor.php:123

hasEmittedDeviceRgb()

Return true when a DeviceRGB color operator was emitted.

public hasEmittedDeviceRgb(): bool

Returns: bool

Source: src/PdfColor.php:131

isForceDeviceCmyk()

Return true when DeviceCMYK forcing is enabled.

public isForceDeviceCmyk(): bool

Returns: bool

Source: src/PdfColor.php:273

setForceDeviceCmyk()

Enable or disable DeviceCMYK forcing for process colors.

public setForceDeviceCmyk(bool $enabled): void

Parameters:

  • $enabled (bool)

Source: src/PdfColor.php:265