Skip to content

PDFJS-dist in Electron application (workerSrc not working). #16111

@verlotl2000

Description

@verlotl2000

Attach (recommended) or Link to PDF file here:

Configuration:

  • Web browser and its version: Using Electron 23.
  • Operating system and its version: Windows 10
  • PDF.js version: PDFJS-dist @3.4.120
  • Is a browser extension: No

Steps to reproduce the problem:
1.
const PDFJS = require('pdfjs-dist'); const url = "../node_modules/pdfjs-dist/build/pdf.worker.js"; PDFJS.GlobalWorkerOptions.workerSrc = url;
2.
let pdfDoc = window.api.PDFJS.getDocument('../test.pdf')

What is the expected behavior? (add screenshot)
Loading the worker succesfully and reading the template PDF.

What went wrong? (add screenshot)
Capture

Link to a viewer (if hosted on a site other than mozilla.github.io/pdf.js or as Firefox/Chrome extension):
There is no viewer as this is an Electron app.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions