jjwilly16 / node-pdftk

A wrapper for PDF Toolkit with streams and promises.
MIT License
141 stars 34 forks source link

Output Format? #37

Open TheBearF8 opened 4 years ago

TheBearF8 commented 4 years ago
    return pdftk.input('MASTER_test.pdf').fillForm(data).flatten().output(fileName);

Saves the file locally on the server with fileName and sends back the buffer but in numerics/numbers 378068704549465410372262.....

was expecting to see something like %PDF-1.4 %���� 1 0 obj

Is the buffer formatted? how do we get from numbers to ASCII text

I tried

private bin2string(array) {
        var result = "";
        for (let idx = 0; idx < array.length; idx++) {
            result += String.fromCodePoint(array[idx]);
        }
        return result;
    }

Which is close I get %PDF-1.4 %âãÏÓ <<-- this is wrong 1 0 obj

Thanks