Setting density while converted a read stream doesn't affect the quality of pdf
Posted: 2016-05-07T09:07:54-07:00
Hi,
I am converting a read stream data of pdf to another pdf with watermark. But adding density during this doesn't affect output.
How do I fix it?
I am using nodejs.
my try:
readStream.pipe(conversion code).pipe(writeStream);
I am converting a read stream data of pdf to another pdf with watermark. But adding density during this doesn't affect output.
How do I fix it?
I am using nodejs.
my try:
readStream.pipe(conversion code).pipe(writeStream);
Code: Select all
var args = [ // using imagemagick convert command to add watermark
'-density', '150',
'-',
'null:',
'(',
path.join(root, 'public/assets/images/text_background.png'),
'-alpha', 'set', '-channel', 'A', '-evaluate', 'Multiply', '0.6', '+channel',
')',
'-gravity', 'southwest',
'-quality', 100,
'-fill', 'rgba(0,0,0,0.80)',
'-pointsize', '10',
'-weight', 'bold',
'-annotate',
'+0+2',
text,
'-layers', 'composite',
'-'
];
var proc = spawn(command, args);
var stream = new Stream();
proc.stderr.on('data', stream.emit.bind(stream, 'error'));
proc.stdout.on('data', stream.emit.bind(stream, 'data'));
proc.stdout.on('end', stream.emit.bind(stream, 'end'));
proc.on('error', stream.emit.bind(stream, 'error'));
streamIn.pipe(proc.stdin);
stream.pipe(writeStream);