Giter Site home page Giter Site logo

Angular universal support about nopodofo HOT 13 CLOSED

gentios avatar gentios commented on September 28, 2024
Angular universal support

from nopodofo.

Comments (13)

corymickelson avatar corymickelson commented on September 28, 2024

@gentios This looks like it should be a fairly easy update to allow for your use case. The places which require the 'fs' / 'path' module are thankfully not a part of the actually library, I will do some test cases to see if removing the "bindings" module can be made optional for installation. How are you installing nopodofo? Thank you for reporting this issue.

from nopodofo.

gentios avatar gentios commented on September 28, 2024

@corymickelson thank you for the support

I am in a MacOS environment and I have installed Podofo 0.9.6 using Brew

image

I am also installing nopodofo through npm like: npm install nopodofo

from nopodofo.

corymickelson avatar corymickelson commented on September 28, 2024

@gentios I'm still probably a couple weeks out from publishing a new version, in which I will add a direct require() statement to the compiled binding binary thus removing the "bindings" module which is referencing the 'fs' module. If you can't wait that long you may begin developing immediately by updating line 1 in index.js from

exports.nopodofo = require('bindings')('nopodofo')
// to
exports.nopodofo = require('./build/Release/nopodofo.node')

and removing 'bindings' and 'file-uri-to-path' from node_modules.
The use of the bindings library is only for easily swapping back and forth between release and debug builds of nopodofo.

from nopodofo.

gentios avatar gentios commented on September 28, 2024

@corymickelson thank you for the great support.

I have done the steps but I am having a problem same as #77

dlopen(/demo-nopodofo/universal-starter/node_modules/nopodofo/build/Release/nopodofo.node, 1): no suitable image found

Steps I tried:

  1. I installed Podofo using MacPorts
  2. Installed Nopodofo in my project as npm i nopodofo
  3. Updated the nopodofo index.js regarding the changes above

Am I missing any steps from the documentation

Ps: I will also update this thread later on with the steps that I took to set it up in Angular

Thank you

from nopodofo.

gentios avatar gentios commented on September 28, 2024

Aha, probably this is because I am using nopodofo:0.8.0 and the CmakeLists.txt is looking for Podofo to be installed in /usr/local/ and currently my podofo bin is in /opt/local/bin/

from nopodofo.

gentios avatar gentios commented on September 28, 2024

I have installed also Podofo from the source in /usr/local using the documentation provided from podofo and also gitbook, but I still have the same error.

from nopodofo.

corymickelson avatar corymickelson commented on September 28, 2024

@gentios Thanks, I've pushed some changes to master. Im not a regular mac user, but I have built and run some simple programs on mac with the latest master. You can build release or debug version with npm run build or npm run build:debug. If you could try to build as stated above and then just run the Document.js file with node --expose-gc ./node_modules/.bin/alsatian ./spec/unit/Document.js and let me know if that works for you that would be appreciated. Thanks.

from nopodofo.

gentios avatar gentios commented on September 28, 2024

@corymickelson thank you for the fast response, I really appreciate it.

I tried and the build is failing due to

make[2]: *** No rule to make target `/usr/local/lib/libpodofo.dylib', needed by `Debug/nopodofo.node'. Stop. make[1]: *** [src/CMakeFiles/nopodofo.dir/all] Error 2 make: *** [all] Error 2 ERR! OMG Process terminated: 2 npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] build:debug: `cmake-js build -D -s=c++17` npm ERR! Exit status 1

However I have that /usr/local/lib/libpodofo.dylib in my directory

Update: I think I didn't had a clean env so I cleaned it up and the build passed

However when I run the command above I get the following error:

node --expose-gc node_modules/.bin/alsatian spec/unit/Document.js
ERROR LOADING FILE: /Users/gentios/Documents/NoPoDoFo/spec/unit/Document.js
Error: Unable to find nopodofo binding binary
    at Object.<anonymous> (/Users/gentios/Documents/NoPoDoFo/index.js:8:15)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/gentios/Documents/NoPoDoFo/spec/unit/Document.js:10:13)
    at Module._compile (module.js:652:30)```

I can confirm that the binary file exists in ```/build/Release/nopodofo.node```

from nopodofo.

corymickelson avatar corymickelson commented on September 28, 2024

@gentios ok, so we probably have an error that is being hidden by the update i've pushed removing the 'bindings' module. To get the actual error, which im guessing is some type of module initialization error, from the terminal in the root of your project directory, run node and from the node prompt run require({path to nopodofo.node}) if there is an error you will get it here, if not you should get a somewhat large object printed to the terminal. Please reply with whatever is returned from the require statement, and thanks for working through these errors, they are extremely helpful in getting this module working on all platforms

from nopodofo.

gentios avatar gentios commented on September 28, 2024

Thank you too for the support @corymickelson

Here is the output

Error: dlopen(/Users/gentios/Documents/NoPoDoFo/build/Release/nopodofo.node, 1): Symbol not found: _jpeg_resync_to_restart
  Referenced from: /Users/gentios/Documents/NoPoDoFo/build/Release/nopodofo.node
  Expected in: flat namespace
 in /Users/gentios/Documents/NoPoDoFo/build/Release/nopodofo.node
    at Object.Module._extensions..node (module.js:681:18)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)```

from nopodofo.

corymickelson avatar corymickelson commented on September 28, 2024

@gentios Thanks, from what you've shared above, this looks like we are trying to import symbols from one compiler to another, example. maybe podofo was built with gcc and nopodofo with clang, or possibly podofo was built against a different c++ standard than nopodofo, it also maybe that when nopodofo is required it is linking to a different podofo build than the one it was compiled against. You can try removing additional libpodofo.dylib that exists on the lookup path (/usr/local , /usr, and /opt/local), rebuild and retry from the terminal. I will see if I can provide a better solution going forward, maybe include podofo and it's dependencies in the repo and build podofo as a submodule of nopodofo.

from nopodofo.

corymickelson avatar corymickelson commented on September 28, 2024

@gentios I just tried using the homebrew podofo. I first removed all other instances of podofo from my /usr/local and /opt/local directories. Installed the homebrew podofo package to it's default location /usr/local/Cellar/podofo/0.9.6 and updated the PODOFO_LIBRARY and PODOFO_INCLUDE_DIR paths to include this location, did a ./node_modules/.bin/cmake-js clean && ./node_modules/.bin/cmake-js build -s=c++17 -D (this can also be achieved with npm run clean and npm run build:debug), and so far this looks to be a valid build. It is missing libidn, and libtiff which limits some of the capabilities of podofo/nopodofo, but it is working. I added the homebrew paths to latest master if you want to try the above. If you are still finding yourself stuck, I can try and hop on a google chat /screen share with you to go over what i have and we can see where you have diverged.

from nopodofo.

gentios avatar gentios commented on September 28, 2024

@corymickelson thank you for the great support.

Update: I finally made it happen with the info that you provided.

I would be happy to open a PR and update the docs regarding the Mac Environment

@corymickelson thank you for your best support

from nopodofo.

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.