MCPcopy Create free account
hub / github.com/LibPDF-js/core / decodeTextString

Function decodeTextString

src/helpers/encoding.ts:174–179  ·  view source on GitHub ↗
(bytes: Uint8Array)

Source from the content-addressed store, hash-verified

172 * Decode PDF text string bytes (auto-detects encoding).
173 */
174export function decodeTextString(bytes: Uint8Array): string {
175 if (hasUtf16BOM(bytes)) {
176 return decodeUtf16BE(bytes);
177 }
178 return decodePdfDocEncoding(bytes);
179}
180
181/**
182 * Check if a string can be encoded in PDFDocEncoding.

Callers 2

asStringMethod · 0.90
encoding.test.tsFile · 0.90

Calls 3

hasUtf16BOMFunction · 0.85
decodeUtf16BEFunction · 0.85
decodePdfDocEncodingFunction · 0.85

Tested by

no test coverage detected