scribe.js-ocr 0.9.2 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,14 +11,16 @@ import { getDistinctCharsFont, subsetFont } from '../../utils/fontUtils.js';
11
11
 
12
12
  /**
13
13
  * Generate PDF font objects, not including the actual font data.
14
+ * @param {number} objectIStart - Starting object index
14
15
  * @param {?Array<OcrPage>} [ocrArr] - Array of OcrPage objects
15
16
  * Used to subset supplementary fonts to only the characters that are actually used.
16
17
  */
17
- const createPdfFontRefs = async (ocrArr) => {
18
+ const createPdfFontRefs = async (objectIStart, ocrArr) => {
18
19
  if (!FontCont.raw) throw new Error('No fonts loaded.');
19
20
 
21
+ let objectI = objectIStart;
22
+
20
23
  let fontI = 0;
21
- let objectI = 0;
22
24
  /** @type {Object<string, PdfFontFamily>} */
23
25
  const pdfFonts = {};
24
26
  /** @type {{familyKey: string, key: string}[]} */
@@ -159,7 +161,7 @@ export async function writePdf({
159
161
  let pdfFontObjStrArr = [];
160
162
 
161
163
  if (ocrArr && ocrArr.length > 0) {
162
- const fontRefs = await createPdfFontRefs(ocrArr);
164
+ const fontRefs = await createPdfFontRefs(objectI, ocrArr);
163
165
  pdfFonts = fontRefs.pdfFonts;
164
166
  pdfFontRefs = fontRefs.pdfFontRefs;
165
167
  pdfFontObjStrArr = fontRefs.pdfFontObjStrArr;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scribe.js-ocr",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "description": "High-quality OCR and text extraction for images and PDFs.",
5
5
  "main": "scribe.js",
6
6
  "directories": {