pdfAnnotate icon indicating copy to clipboard operation
pdfAnnotate copied to clipboard

Uncaught (in promise) Error: Could not identify number bounds: [195128,195126]

Open alibakhshiilani opened this issue 4 years ago • 0 comments

Uncaught (in promise) Error: Could not identify number bounds: [195128,195126] at Function.extractNumber (util.ts:328) at CrossReferenceTable.extractReferences (document-history.ts:256) at CrossReferenceTable.extract (document-history.ts:329) at DocumentHistory.extractCrossReferenceTable (document-history.ts:373) at DocumentHistory.extractDocumentHistory (document-history.ts:421) at new PDFDocumentParser (parser.ts:278) at new AnnotationFactory (annotation.ts:19) at PdfViewer.js:49

` const loadPdf = () => { const loadingTask = pdfjsLib.getDocument(url); loadingTask.promise.then(loadedPdf => {

    setPdfRef(loadedPdf);
    setCurrentPage(1)

      loadedPdf.getData().then((data) => {
        const pdffac = new AnnotationFactory(data)
        pdffac.getAnnotations().then((res) => {
          console.log("getAnnotations",res)
          setAnnotations(res)
      });

    }, function (reason) {
      console.error(reason);
    });
})

} `

i got this error with some pdf but pdfAnnotate

pdf sample : https://filebin.net/m5tp05mcp8y3amag

`

static extractNumber(data, start, end = -1) { start = Util.skipDelimiter(data, start); if (-1 == end) { end = Util.locateDelimiter(data, start); } if (end < start) { throw Error(Could not identify number bounds: [${start},${end}]); } let str_id = ""; for (let i = start; i <= end; ++i) { str_id += String.fromCharCode(data[i]); } if ("" === str_id) { throw Error(Could not parse number at position ${start}); } return { result: +str_id, end_index: end }; }

`

alibakhshiilani avatar Jan 23 '21 10:01 alibakhshiilani