PdfColor

PDF color adapter with conformance-aware output.

Namespace: Com\Tecnick\Pdf

class PdfColor extends Pdf

Extends: Pdf

Source: src/PdfColor.php:34

PDF color adapter with conformance-aware output.

Methods

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:87

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:236

hasEmittedDeviceCmyk()

Return true when a DeviceCMYK color operator was emitted.

public hasEmittedDeviceCmyk(): bool

Returns: bool

Source: src/PdfColor.php:68

hasEmittedDeviceRgb()

Return true when a DeviceRGB color operator was emitted.

public hasEmittedDeviceRgb(): bool

Returns: bool

Source: src/PdfColor.php:76

isForceDeviceCmyk()

Return true when DeviceCMYK forcing is enabled.

public isForceDeviceCmyk(): bool

Returns: bool

Source: src/PdfColor.php:218

setForceDeviceCmyk()

Enable or disable DeviceCMYK forcing for process colors.

public setForceDeviceCmyk(bool $enabled): void

Parameters:

  • $enabled (bool)

Source: src/PdfColor.php:210