Hi ,
I have PDF in base 64 encoded form. I want to edit and add an QR image to it using PDF kit.
Somehow when i try to merge the streams the content fails . Below is the code.
var base64 = require('base64-stream');
var PDFDocument = require('pdfkit');
var doc = new PDFDocument ();
doc.image('test.jpeg', {
fit: [250, 300],
align: 'center',
valign: 'center'
});
var finalString = ''; // contains the base64 string
var stream = doc.pipe(base64.encode());
doc.end();
var finalString = '';
stream.on('data', function(chunk) {
finalString += chunk;});
stream.on('end', function() {
// the stream is at its end, so push the resulting base64 string to the response
read.writeFileSync('./report.pdf', finalString);
});
Hi ,
I have PDF in base 64 encoded form. I want to edit and add an QR image to it using PDF kit.
Somehow when i try to merge the streams the content fails . Below is the code.
var base64 = require('base64-stream');
var PDFDocument = require('pdfkit');