Giter VIP home page Giter VIP logo

Comments (26)

Jamal8548 avatar Jamal8548 commented on July 20, 2024 7

@jacksctsai Please help me i did not get your this solution please explain it
Goto node_modules/pdfkit/node_modules/flate/ directory.
Copy the file zlib_bindings from build/Release directory to lib directory.

I could not find any folders in node_modules. I installed pdfkit from npm and please tell me now what i have to do? where is the flate? and all the other zlib+bindings? I am using react. Please elaborate your solution here

from pdfkit.

elspoono avatar elspoono commented on July 20, 2024

Okay, I have this too. It's only happening since re-installing everything with node v0.6.1

I have found basically nothing else in my Googling so far, except that this zlib_bindings is perhaps not getting installed automatically by npm for some reason.

[EDIT:] I'm a dirty liar, it looks like this is incredibly relevant: #42

from pdfkit.

NeCkEr avatar NeCkEr commented on July 20, 2024

i'm getting the same error in version v0.6.2 any help?

from pdfkit.

jacksctsai avatar jacksctsai commented on July 20, 2024

I had the same problem and fixed.
Goto node_modules/pdfkit/node_modules/flate/ directory.
Copy the file zlib_bindings from build/Release directory to lib directory.

from pdfkit.

NeCkEr avatar NeCkEr commented on July 20, 2024

@jacksctsai

Thanks, it worked :)

from pdfkit.

devongovett avatar devongovett commented on July 20, 2024

Does anyone object if the next release only supports Node 0.6.x? I would like to switch to using the built in zlib bindings...

from pdfkit.

elspoono avatar elspoono commented on July 20, 2024

I don't object, but felt obligated to mention this.

My personal stumbling block is that I'm using this on heroku right now, which is still at node 0.4.7, but honestly that's starting to create a lot of problems a lot of places now, and I'd rather just figure out some way to move up to 0.6.x for everything.

Utilizing the built in bindings sounds like a good direction from my naive view ... ...

from pdfkit.

matylla avatar matylla commented on July 20, 2024

@devongovett: Yes, please move to 0.6 and fix this issue with zlib bindings

from pdfkit.

devongovett avatar devongovett commented on July 20, 2024

Alright... took a look at this today, but found out that the zlib bindings in Node 0.6 are all asynchronous and the module I was using before was synchronous. So I'm going to have to do a larger refactoring of the code to make it work if I'm to use the built in bindings. I'd like to do that, but I'm busy with lots of other things so I don't really know when I'll get to it. If you feel motivated please send me a pull request. Sorry about the wait.

from pdfkit.

cybernavid avatar cybernavid commented on July 20, 2024

A bit more accurate how-to version of jacksctsai's:

  • Goto node_modules/pdfkit/node_modules/flate/build/Release directory.
  • Copy the file zlib_bindings.node to ../../lib directory (lib directory of flate!).

from pdfkit.

mcfazeli avatar mcfazeli commented on July 20, 2024

Hi there. Thanks for the hard work on this great module. Are there any updates on this issue? The manual file copy works, but wondering if anyone is looking to tackle the proper fix.

from pdfkit.

devongovett avatar devongovett commented on July 20, 2024

So the proper fix for this will be a refactor of most of the codebase to be asynchronous rather than synchronous as Node 0.6's built in bindings are async. I have been meaning to do this for a while anyway for performance reasons, and this issue compounds the problem. I'll be working on PDFKit more over the next few weeks so expect a fix for this and other issues shortly!

Sorry about the wait, and if you think you can tackle any of the open issues here it would be greatly appreciated as I am only one person! :)
Devon

from pdfkit.

matylla avatar matylla commented on July 20, 2024

That's great news. Many thanks for your effort!

from pdfkit.

AyKarsi avatar AyKarsi commented on July 20, 2024

any way to get the workaround working on cloud9. (I can't see the zlib_bindings file there)

from pdfkit.

sri-rang avatar sri-rang commented on July 20, 2024

@jacksctsai thank you!

from pdfkit.

AbeEstrada avatar AbeEstrada commented on July 20, 2024

I had this issue and my app is running on heroku, I don't have access to the filesystem directly from command line and what I did is copy the file programmatically. I don't know if this is the best solution but at least it works and let me generate PDFs using pdfkit while I wait for a new pdfkit release.

var fs = require('fs');
var util = require('util');
var is = fs.createReadStream('./node_modules/pdfkit/node_modules/flate/build/Release/zlib_bindings.node')
var os = fs.createWriteStream('./node_modules/pdfkit/node_modules/flate/lib/zlib_bindings.node');
util.pump(is, os);

from pdfkit.

niftylettuce avatar niftylettuce commented on July 20, 2024

Why'd you close these issues they clearly aren't resolved?

from pdfkit.

sveisvei avatar sveisvei commented on July 20, 2024

Happens both on ubuntu and mac with node v0.6.11. Anoying when deploying! :/

from pdfkit.

devongovett avatar devongovett commented on July 20, 2024

Hello everyone! Finally getting a chance to work on this. I'd like opinions on whether you'd prefer to stick with the nice sync API that we have now or go completely async. This would mean that embedding images and fonts would become async operations and thus not chainable like everything else is. The reason for doing this would be so that we can switch to the built in zlib bindings that come with node 0.6, which unfortunately, are only available as async APIs.

The other option would be to stick with the sync API by using a zlib implementation entirely in JavaScript. Several of these already exist and would be fairly easy to implement. Performance would probably be slightly slower than using the native zlib bindings however. This would retain backwards compatibility with the current API and retain the nice sync style of the API as well as the internals.

In both cases we'd be getting rid of the silly flate module that has caused so much trouble especially on platforms not supported by node-waf like Windows. I'm super sorry it's taken me this long to get to it. But here we are! What do you think?

from pdfkit.

cam-intel avatar cam-intel commented on July 20, 2024

Great that you can look at this - thanks! I've a slight bias towards the async route, under the (perhaps misguided) impression that this will make the library more suitable (efficient) for deployment as some sort of web service.. If that makes sense then the trade-off for a more complex API (in parts) would be worth it. Is there a way of isolating the async calls in some sort of initialization step? Thereby leaving the rest of the API as is?

from pdfkit.

devongovett avatar devongovett commented on July 20, 2024

So this should finally be fixed now as of the above commit. Please let me know if you have any more issues.

The solution I came to was to use Node's built in zlib bindings, making some of the internals async. However, this should not affect the API for users much if at all. The only difference now is that the doc.output method is now asynchronous, meaning that you get a callback with the PDF data rather than having it returned to you. Otherwise the API is exactly the same as before. I did this by deferring all of the zlib stuff until the end when you ask for the generated document, keeping the API synchronous as before except for that one method.

Again, let me know if you have any more issues! Sorry it took so long for me to get to.

from pdfkit.

Kajal-08 avatar Kajal-08 commented on July 20, 2024

Hi
Capture

Hi i have installed zlib and pdfkit as well but not able to see ./zlib_bindings file in pdfkit

from pdfkit.

 avatar commented on July 20, 2024

Hi
Capture

Hi i have installed zlib and pdfkit as well but not able to see ./zlib_bindings file in pdfkit

i'm with you on this one. still figuring out how to solve it.

from pdfkit.

neginmehrasa avatar neginmehrasa commented on July 20, 2024

Hi
Capture
Hi i have installed zlib and pdfkit as well but not able to see ./zlib_bindings file in pdfkit

i'm with you on this one. still figuring out how to solve it.

I am having the same problem. Any ideas?

from pdfkit.

blikblum avatar blikblum commented on July 20, 2024

To improve the likehood of getting support, more info should de provided:

What environment ? Node? browser?
What bundler? Webpack? Rollup?
Provide a minimal reproduction snippet

from pdfkit.

vikasacharya16 avatar vikasacharya16 commented on July 20, 2024

To improve the likehood of getting support, more info should de provided:

What environment ? Node? browser? What bundler? Webpack? Rollup? Provide a minimal reproduction snippet

I got the error and mentioned how to reproduce here, Kindly have a look.
https://stackoverflow.com/questions/69805191/what-is-the-proper-way-to-use-pdfkit-in-react-native

from pdfkit.

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.