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

Function encodeTextString

src/helpers/encoding.ts:293–301  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

291 * Uses PDFDocEncoding if possible, otherwise UTF-16BE with BOM.
292 */
293export function encodeTextString(text: string): Uint8Array {
294 const pdfDoc = encodePdfDocEncoding(text);
295
296 if (pdfDoc !== null) {
297 return pdfDoc;
298 }
299
300 return encodeUtf16BE(text);
301}

Callers 2

fromStringMethod · 0.90
encoding.test.tsFile · 0.90

Calls 2

encodePdfDocEncodingFunction · 0.85
encodeUtf16BEFunction · 0.85

Tested by

no test coverage detected