Forum Bugs

Latest build outputs css code

jonasj
I just tried the latest build and it outputs css code that is not i a separate css file. See attached example.
  1. css-code.zip20.6 kB
mikeday
How are you running Prince, from the command-line or the GUI or a server wrapper?
jonasj
It's a node.js application, which calls prince as a spawned process. It inputs html as a text string and outputs as a stream. My mentioned css problem did not occur in version 10.

The code looks something like this:

res.writeHead(200, {
'Content-Type': 'application/pdf',
'Content-Disposition': 'inline; filename=report.pdf'
});
var spawn = require('child_process').spawn;
var pdf = spawn('prince', [
'-', // stdin instead of input file
//'-o -', // stdout instead of output file. From v10 this is omitted
'--fileroot=' + fileroot,
'--style=' + fileroot + '/styles/pdf.css',
'--javascript',
'--log=prince.txt',
'--pdf-title=' + accountId,
]);

pdf.stderr.on('data', function (data) {
console.log('Error: ' + data);
});
pdf.stdout.on('data', function (data) {
res.write(data);
});
pdf.on('close', function (code) {
res.end();
});
pdf.stdin.write('<html ...');
pdf.stdin.end();
mikeday
Can you reproduce this problem from the command-line? It works fine for me if I run:
prince - < input.html > output.pdf

with the input.html in your example.
jonasj
Thank mike! I realised I installed the latest build in the wrong way. I removed the old version and did a clean install, and now it works. Thanks again and sorry for the inconvenience!