Skip to content

Commit 4763c6d

Browse files
authored
fix: added src for pdfjs worker (#46)
1 parent 832f6f0 commit 4763c6d

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

.changeset/young-ghosts-travel.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@callstack/document-loaders': patch
3+
---
4+
5+
Added src for pdf worker

packages/document-loaders/src/utils/pdf/loader.ts

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import { orderBy } from 'lodash';
44
import { getLinkBoundingBoxes, PdfLinkBoundingBox } from './links.js';
55
import { boundingBoxesOverlap, expandBoundingBox } from './bounding-box.js';
66

7+
// Makes parser available in bundle when document-loaders are used as dependency
8+
pdfjs.GlobalWorkerOptions.workerSrc = require.resolve('pdfjs-dist/build/pdf.worker.min.js');
9+
710
export async function loadPdfContentFromBuffer(buffer: ArrayBuffer): Promise<string> {
811
const document = await pdfjs.getDocument(buffer).promise;
912
let text = '';

0 commit comments

Comments
 (0)