Zlib

Compression and decompression of the stored font artifacts.

Namespace: Com\Tecnick\Pdf\Font

final class Zlib

Source: src/Zlib.php:36

Compression and decompression of the stored font artifacts.

Methods

compress()

Compress data as a zlib stream.

Any warning gzcompress() may emit is silenced, as in uncompress().

public static compress(string $data, string $message, int $level = -1): string

Parameters:

  • $data (string): Data to compress.
  • $message (string): Message of the exception raised when the data cannot be compressed.
  • $level (int): Compression level (-1 for the zlib default, 0 to 9).

Returns: string: The compressed data.

Throws:

Source: src/Zlib.php:73

uncompress()

Uncompress a zlib stream.

The E_WARNING gzuncompress() emits for a corrupt stream is silenced.

public static uncompress(string $data, int $maxLength = 0): string|false

Parameters:

  • $data (string): Compressed data.
  • $maxLength (int): Maximum size of the uncompressed data, or 0 for no limit. A stream expanding past it is reported as invalid.

Returns: string|false: The uncompressed data, or false when the stream is not valid.

Source: src/Zlib.php:49