A fast, helpful, and open-source document parser
formatting
Logan Markewichd049c361f5c1
diff --git a/src/engines/pdf/pdfjs.ts b/src/engines/pdf/pdfjs.tsindex abd160e..5be1121 100644--- a/src/engines/pdf/pdfjs.ts+++ b/src/engines/pdf/pdfjs.ts@@ -102,8 +102,10 @@ function stripControlChars(str: string): string {for (const char of str) {const code = char.charCodeAt(0);// Skip C0 controls (except tab, newline, carriage return) and C1 controls- if ((code >= 0x00 && code <= 0x1f && code !== 0x09 && code !== 0x0a && code !== 0x0d) ||- (code >= 0x80 && code <= 0x9f)) {+ if (+ (code >= 0x00 && code <= 0x1f && code !== 0x09 && code !== 0x0a && code !== 0x0d) ||+ (code >= 0x80 && code <= 0x9f)+ ) {continue;}result += char;@@ -140,8 +142,10 @@ function isGarbledFontOutput(str: string): boolean {// C0 control characters (0x00-0x1F) except common whitespace (tab, newline, carriage return)// C1 control characters (0x80-0x9F)- if ((code >= 0x00 && code <= 0x1f && code !== 0x09 && code !== 0x0a && code !== 0x0d) ||- (code >= 0x80 && code <= 0x9f)) {+ if (+ (code >= 0x00 && code <= 0x1f && code !== 0x09 && code !== 0x0a && code !== 0x0d) ||+ (code >= 0x80 && code <= 0x9f)+ ) {controlCharCount++;}// Private Use Area (U+E000-U+F8FF) - almost always garbleddiff --git a/src/processing/gridProjection.ts b/src/processing/gridProjection.tsindex 828b33a..4fcc125 100644--- a/src/processing/gridProjection.ts+++ b/src/processing/gridProjection.ts@@ -524,7 +524,7 @@ function handleRotationReadingOrder(textBbox: ProjectionTextBox[], pageHeight: n}// Build bboxGroup array from rotation groups, sorted by X position of group- let bboxGroup: ProjectionTextBox[][] = [];+ const bboxGroup: ProjectionTextBox[][] = [];for (const rotation in groupsByRotation) {const group = groupsByRotation[rotation];// Sort each group by Y for proper reading order