PdfString

data class PdfString(val bytes: ByteArray) : PdfObject

A byte-level PDF string. bytes is the raw payload AFTER PDF escape processing (so backslash escapes inside literal strings are already resolved, and hex strings are already decoded to bytes).

Whether these bytes are ASCII, UTF-16BE, PDFDocEncoding, or a font-specific encoding is determined by context. asAsciiOrNull() is a convenience for the common case of trailer strings, names of fonts, etc.

Constructors

Link copied to clipboard
constructor(bytes: ByteArray)

Properties

Link copied to clipboard

Functions

Link copied to clipboard
Link copied to clipboard
fun asText(): String

Decode as text. Auto-detects UTF-16BE (PDF text-string convention when the first two bytes are 0xFE 0xFF), otherwise falls back to PDFDocEncoding (close enough to latin-1 for the ASCII range; full table is in §D.2).

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

Resolve indirect refs against refs; non-refs return themselves.

Link copied to clipboard
open override fun toString(): String