Comments (26)
@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.
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.
i'm getting the same error in version v0.6.2 any help?
from pdfkit.
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.
Thanks, it worked :)
from pdfkit.
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.
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.
@devongovett: Yes, please move to 0.6 and fix this issue with zlib bindings
from pdfkit.
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.
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.
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.
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.
That's great news. Many thanks for your effort!
from pdfkit.
any way to get the workaround working on cloud9. (I can't see the zlib_bindings file there)
from pdfkit.
@jacksctsai thank you!
from pdfkit.
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.
Why'd you close these issues they clearly aren't resolved?
from pdfkit.
Happens both on ubuntu and mac with node v0.6.11. Anoying when deploying! :/
from pdfkit.
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.
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.
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.
Hi i have installed zlib and pdfkit as well but not able to see ./zlib_bindings file in pdfkit
from pdfkit.
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.
Hi
Hi i have installed zlib and pdfkit as well but not able to see ./zlib_bindings file in pdfkiti'm with you on this one. still figuring out how to solve it.
I am having the same problem. Any ideas?
from pdfkit.
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.
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)
- Improve how docs are generated
- JP2 image support HOT 3
- Link will open in new Tab In Browser, Not Same HOT 1
- Transparent images will have gray edges
- Get detailed font metrics
- Encryption breaks GoTo Destinations
- how to set the orientation to landscape
- How do I use the fonts that come with my system? HOT 1
- Use Path.join() instead - Error: ENOENT: no such file or directory, open '/...//data/Helvetica.afm'
- Bullet number on version 0.15.0 not work HOT 2
- PDFKit does not create a new page on iOS Safari HOT 8
- Links on SVGs
- Is it normal for strings to be rendered slightly differently three times than once?
- Generate PDF using HTML? HOT 1
- rollup: output.interop no longer allows value `false`
- Y position of document not updated after adding image HOT 4
- Incorrect ordering of text when RTL (arabic) text mixed with LTR (english) HOT 1
- Prevent Text Overflow
- Support for other javascript runtimes (deno, cloudflare worker, bun)
- Please use lru to cache font layout to fix memory leak HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pdfkit.