Comments (15)
Can you try running that ghost script command in isolation?
gs -dNOCACHE -sDEVICE=pdfwrite -sOutputFile=/tmp/116419-18385-13yaogd.pdf -dbatch -dNOPAUSE -dQUIET /tmp/116419-18385-1c8wdss.pdf -c quit
My guess is maybe the file path doesn't exist that it is trying to use. Which distro are you using?
from fill-pdf.
@ScottONeal ubuntu 14.4 .... amazon EC2... the weird part is it works perfectly on one of our servers and not at all on the other two. since we're clustered they all are running the same system but the other two were added later so I think perhaps I missed one of the libraries or something. I did apt-get install the two libraries on the site along with this
sudo apt-get dist-upgrade -y && sudo apt-get update -y && sudo apt-get upgrade -y
sudo apt-get install git zsh emacs htop mysql-server g++ build-essential libcairo2-dev libjpeg-dev libgif-dev pdftk ghostscript phantomjs
wget -qO- https://deb.nodesource.com/setup_5.x | sudo bash - && sudo apt-get install --yes nodejs && sudo npm install pm2 -g && sudo npm install [email protected] -g && sudo npm install [email protected] -g && sudo npm install gulp -g && sudo npm install socketcluster -g
from fill-pdf.
Looks like you are running on Node 5.0 (which is great!) I know there are issues with this library running on Node 4.0 and greater (has to do with a dependency for iconv
). Are your other servers running on 5 as well?
FYI, I wouldn't install node modules or run applications as root.
from fill-pdf.
@ScottONeal socketcluster runs in SSL which requires root to bind to port 443. It's standard for that framework. I fixed the iconv dependency which was a pain and it works perfectly on one of our other servers so I'm thinking that I'm missing a library or something. All of our servers are running Node 5.11.1 and one is running beautifully and the other two work great until I try to generate a PDF and it just hangs. That's the weird part is it doesnt crash or anything it just hangs and the function never returns. (generatePdf)
from fill-pdf.
First, looks like there is a bug in the spawn to pdftk
, we should add at return to https://github.com/dommmel/fill-pdf/blob/master/index.js#L82
return callback(new Error('Non 0 exit code from pdftk spawn: ' + code));
So, that ghostscript doesn't execute when pdftk returns with a non 0 code. That might cause some weird behaviours, since the ghost script call relies on the pdftk spawn working.
Can you try to add that return
and see if you get any other information? This makes me think that there is something wrong with the pdftk installation
from fill-pdf.
@ScottONeal while I'm doing that can you send me a link for a better pdftk installation and any dependencies it has? I just did apt-get install pdftk.
from fill-pdf.
Installing via apt-get
should be sufficient. Can you verify your pdftk versions are the same on your working instances?
I would also try to manually run the pdftk command in bash, get the command by adding console.log(processArgs)
on https://github.com/dommmel/fill-pdf/blob/master/index.js#L75 and see if you get any extended information.
On the other non related :443 note. I would run a reverse proxy like nginx on 443 which talks to your node app from webapp
user.
from fill-pdf.
@ScottONeal
they are both running pdftk v2.01.
ghostscript 9.10
Hey man I just wanted to say first off thanks for taking the time to work this out with me. I'm completely lost lol
I inserted that line at 82 and commented the other line and now I get
[Error: Non 0 exit code from pdftk spawn: 1]
I edited line 75 and added console.log(processArgs) and got this
gulp-0 [Error: Non 0 exit code from pdftk spawn: 1]
gulp-0 1463951396228 - Origin: Worker (PID 12154)
gulp-0 [Error] ReferenceError: processArgs is not defined
gulp-0 at /var/www/fusion/node_modules/fill-pdf/index.js:74:15
gulp-0 at ChildProcess.exithandler (child_process.js:209:5)
gulp-0 at emitTwo (events.js:100:13)
gulp-0 at ChildProcess.emit (events.js:185:7)
gulp-0 at maybeClose (internal/child_process.js:850:16)
gulp-0 at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
gulp-0 1463951396232 - Worker 3 exited - Exit code: 1
gulp-0 >> Worker PID: 12280
gulp-0 1463951397075 - Worker 3 was respawned
gulp-0 Client Fwj2SLbdnHu28nJvAAAA connected to worker
Everything runs through my loadbalancer before it hits the application servers and they are only accessible from the internal IP. The application servers are not accessible from the internet.
from fill-pdf.
I'm thinking this going back and forth is going to take more effort than it is worth! Send me an email and maybe we can work this out over skype or something?
from fill-pdf.
Also, if you can isolate this issue into a script, instead of having an event trigger it (ie: click a button in an application), that would be helpful.
Essentially, pdftk is failing to add the field data to your pdf, however we are not getting any valuable information as to why. The goal is to run pdftk outside of node, with the same command, to see what happens.
processArgs should def be defined, I'm guessing you put it above the variable declaration.
try:
// line 74
var processArgs = [pdfPath, "fill_form", "-", "output", tempName].concat(extendArgs);
console.log(processArgs);
console.log(exports.generateFdf(data));
from fill-pdf.
I'm thinking that I'm looking in the wrong place??? Here is what my file looks like
from fill-pdf.
I must be tired because now it's working on all my servers except one... so weird... lol I spun up an (exact copy) and it failed the first time I tried it which is weird but now it keeps working.. well I say failed but what I mean is it hung for a really long time and then timed out... never getting out of the generatePdf function. It has to be a library thing or something because the exact copy works great.
from fill-pdf.
Ahh, looks liking your fill-pdf version is older. That is my fault for not publishing the latest version to npm. Should be updated properly on npm. However, I don't think that is going to fix your issue.
You can try my additions now, and see if that prints anything out. Thanks
from fill-pdf.
marking as resolved.
from fill-pdf.
thanks
from fill-pdf.
Related Issues (20)
- Update iconv.
- Image support? HOT 2
- Vague error: Error: spawn pdftk ENOENT HOT 5
- process hangs HOT 3
- Escape parenthesis HOT 2
- Not working with special characters like Γ₯Àâ HOT 3
- how to add stamps? HOT 1
- getting error on method `generatePdf` whilst using azure app service HOT 3
- Can i use it on windows platform? HOT 1
- it does not support chinese? HOT 1
- Could you document then options that can be passed to pdftk? HOT 2
- I use pdftk to merge pdf form and fdf or xfdf,but when i add flatten argument,the Chinese can not be displayed. HOT 1
- No way to fill check boxes HOT 1
- Add Release Notes/Changelog HOT 7
- generateFdf confusingly named
- ENOENT on generatePdf HOT 4
- Not working with checkboxes? HOT 1
- Filling Asian charicters HOT 4
- Can't check checkboxes
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 fill-pdf.