Skip to content

Commit 134047f

Browse files
Update src/tools/pdf/markdown.ts
Co-authored-by: codeant-ai[bot] <151821869+codeant-ai[bot]@users.noreply.github.com>
1 parent 24e6ef1 commit 134047f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/tools/pdf/markdown.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ type PageRange = {
2727
export async function parsePdfToMarkdown(source: string, pageNumbers: number[] | PageRange = []): Promise<PdfParseResult> {
2828
try {
2929
const data = await loadPdfToBuffer(source);
30+
const byteData = data instanceof Uint8Array ? data : new Uint8Array(data);
3031

3132
// @ts-ignore: Type definition mismatch for ESM usage
33+
return await pdf2md(byteData, pageNumbers);
3234
return await pdf2md(new Uint8Array(data), pageNumbers);
3335

3436
} catch (error) {

0 commit comments

Comments
 (0)