Skip to content

Commit a61744b

Browse files
committed
Minor updates
1 parent 155ec31 commit a61744b

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

js/canvasAdapter.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ export class ca {
2828
if (typeof process === 'undefined') {
2929
return new OffscreenCanvas(width, height);
3030
}
31+
if (!width || !height || width <= 0 || height <= 0) {
32+
throw new Error(`Invalid canvas size: ${width}x${height}`);
33+
}
3134
const canvasKit = await ca.getCanvasKit();
3235
return canvasKit.MakeCanvas(width, height);
3336
};

js/import/convertPageBlocks.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,7 @@ export async function convertPageBlocks({
7171
baseline[1] = 0;
7272
}
7373

74-
// Tesseract.js lists `row_height` instead of `rowHeight` in the types file, which is wrong.
75-
// This has been fixed in the upstream, so the `ts-ignore` comments
76-
// can be removed once Tesseract.js is updated in our dependencies.
77-
// @ts-ignore
7874
const ascHeight = line.rowAttributes.rowHeight - line.rowAttributes.descenders;
79-
// @ts-ignore
8075
const xHeight = line.rowAttributes.rowHeight - line.rowAttributes.descenders - line.rowAttributes.ascenders;
8176

8277
const lineObj = new ocr.OcrLine(pageObj, linebox, baseline, ascHeight, xHeight);

0 commit comments

Comments
 (0)