MCPcopy
hub / github.com/Lulzx/tinypdf / pdfString

Function pdfString

src/index.ts:78–85  ·  view source on GitHub ↗

* Escape string for PDF

(str: string)

Source from the content-addressed store, hash-verified

76 * Escape string for PDF
77 */
78function pdfString(str: string): string {
79 return '(' + str
80 .replace(/\\/g, '\\\\')
81 .replace(/\(/g, '\\(')
82 .replace(/\)/g, '\\)')
83 .replace(/\r/g, '\\r')
84 .replace(/\n/g, '\\n') + ')'
85}
86
87/**
88 * Serialize value to PDF format

Callers 2

serializeFunction · 0.85
textFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected