react-pdf icon indicating copy to clipboard operation
react-pdf copied to clipboard

Is there a way to async load PDF.js similar to pdf.worker.js? PDF.js is about 200kb, which is too large for me.

Open margintopt opened this issue 5 months ago • 7 comments

Before you start - checklist

  • [X] I understand that React-PDF does not aim to be a fully-fledged PDF viewer and is only a tool to make one
  • [X] I have checked if this feature request is not already reported

Description

// pdj.ts in react-pdj

import * as pdfjsModule from 'pdfjs-dist';

const pdfjs = ( 'default' in pdfjsModule ? pdfjsModule['default'] : pdfjsModule ) as typeof pdfjsModule;

export default pdfjs;

Proposed solution

external script load pdf.js

Alternatives

No response

Additional information

No response

margintopt avatar Feb 04 '24 08:02 margintopt