A fast, helpful, and open-source document parser
changeset + lint
Logan Markewich48d86f1f2a0f
diff --git a/.changeset/goofy-deserts-hug.md b/.changeset/goofy-deserts-hug.mdnew file mode 100644index 0000000..0579cb6--- /dev/null+++ b/.changeset/goofy-deserts-hug.md@@ -0,0 +1,5 @@+---+"@llamaindex/liteparse": patch+---++Ensure screenshot converts formats when possiblediff --git a/src/core/parser.ts b/src/core/parser.tsindex ff2ff0f..9a1855e 100644--- a/src/core/parser.ts+++ b/src/core/parser.ts@@ -255,9 +255,7 @@ export class LiteParse {}if ("content" in conversionResult) {- throw new Error(- `Cannot screenshot text-based format. Convert to PDF first.`- );+ throw new Error(`Cannot screenshot text-based format. Convert to PDF first.`);}const pdfPath = conversionResult.pdfPath;@@ -284,9 +282,7 @@ export class LiteParse {}if ("content" in conversionResult) {- throw new Error(- `Cannot screenshot text-based format. Convert to PDF first.`- );+ throw new Error(`Cannot screenshot text-based format. Convert to PDF first.`);}needsCleanup = true;@@ -311,11 +307,7 @@ export class LiteParse {}log(`Rendering page ${pageNum}...`);- const imageBuffer = await renderer.renderPageToBuffer(- pdfInput,- pageNum,- this.config.dpi- );+ const imageBuffer = await renderer.renderPageToBuffer(pdfInput, pageNum, this.config.dpi);const pageData = await this.pdfEngine.extractPage(doc, pageNum);