Code Monkey home page Code Monkey logo

Comments (12)

suparpat avatar suparpat commented on June 21, 2024 33

using
let PDFParser = require('electron').remote.require('pdf2json')
instead of
let PDFParser = require('pdf2json')

worked for me.
Thank you!

from pdf2json.

lanwin avatar lanwin commented on June 21, 2024 5

It works when you run it in the main process and not in any of the rendering process, and use the remote api to exchange data between them.

from pdf2json.

parzel avatar parzel commented on June 21, 2024 1

It should be possible to require it in a rendering process by: require('electron').remote.require(...)

from pdf2json.

whitef0x0 avatar whitef0x0 commented on June 21, 2024

@modesty

from pdf2json.

modesty avatar modesty commented on June 21, 2024

how did you run pdf2json?
if you run it via cmd line, or as a web service, this error should not occur.

from pdf2json.

whitef0x0 avatar whitef0x0 commented on June 21, 2024

@modesty I ran in an electron app.

from pdf2json.

modesty avatar modesty commented on June 21, 2024

pdj2json is designed to run outside browser, and never tested with embedded browser (as in electron framework). 3 options here:

  • invoke cmd line to run pdf2json from your app
  • set globalScope.PDFJS.disableWorker to be true
  • set PDFJS.workerSrc = Worker

from pdf2json.

wilsonchandra avatar wilsonchandra commented on June 21, 2024

@whitef0x0 @modesty It turns out that I have the same problem too. Any luck on running pdf2json in electron? Thanks...

from pdf2json.

wilsonchandra avatar wilsonchandra commented on June 21, 2024

@lanwin Thanks for your heads up. That works for me too...

from pdf2json.

wilsonchandra avatar wilsonchandra commented on June 21, 2024

@parzel Thanks for the explanation. I used it that way too...

from pdf2json.

sunilrebel avatar sunilrebel commented on June 21, 2024

@suparpat - can you please tell, what should I do to get the same PDFParser object in nwjs app?
I'm getting the same issue, most probably it'll be the same solution.
However, I'm unable to load pdf2json module correctly in nwjs app.

from pdf2json.

samuel-mrodrigues avatar samuel-mrodrigues commented on June 21, 2024

It worked for me during development with electron:serve, after bundling the program with electron:build, opening the executable would cause the module not being found.

I did the correct way and moved my code to the main proccess.

from pdf2json.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.