SebastiaanKlippert / go-wkhtmltopdf

Golang commandline wrapper for wkhtmltopdf
MIT License
1.06k stars 146 forks source link

multiple copies of the pdf are downloading after so many clicks #38

Closed rvwhitney closed 4 years ago

rvwhitney commented 4 years ago

Greetings, I have 2 situations.(see also #39 ) ( using node.js ) Here is the first 1: After a few pdfs generated, one at a time, I get multiple copies of the same pdf on subsequent clicks. I am using sockets for transmission. Here is some code:

      var wkpdf                 = require('wkhtmltopdf');
      var pdf = wkpdf(data.html, params, function (err, stream){
        console.log(stream);
       // you can use message here and only in here

        if(err){
            console.log('ERROR IN WKPDF: ',err);
        } else {
            console.log('STREAM ERROR:',err, stream);
            toArray(stream, function (err, arr) {
                console.log('OUTPUT OF TO ARRAY',err,arr);
                var datas = {};
                datas.buffer = Buffer.concat(arr);
                datas.user = data.user;
                datas.filename = data.filename;
                socket.emit(data.returnEntry, datas);
            });
        }
    });

Thanks for any help I can get and let me know if I need to submit more code.

SebastiaanKlippert commented 4 years ago

Hi,

Are you sure this is an issue with the Golang wrapper and are you using that? If so I cannot see it in your code, I am not familiar with function wkpdf. Can you show some of the go code?

rvwhitney commented 4 years ago

I must apologize - I am not using go. I neglected to see the right github and I could not delete this post.

SebastiaanKlippert commented 4 years ago

No problem 😃