Open mattgaspar opened 5 years ago
this:
var pdfWriter = require('hummus').createWriter('./halfPixelWidth.pdf');
var page = pdfWriter.createPage(0,0,595,842);
var cxt = pdfWriter.startPageContentContext(page);
var pathStrokeOptions = {color:'DarkMagenta', width:4};
// drawPath
// cxt.drawPath(75,540,110,440,149,540,188,440,223,540,pathStrokeOptions);
cxt.drawPath(75,540,110,440,149,540,188,440,223,540,
{...pathStrokeOptions,
width:0.5
});
pdfWriter.writePage(page);
pdfWriter.end();
creates this: halfPixelWidth.pdf
does it not do that for you?
hmmm. looking at the unfiltered version (.createWriter('./halfPixelWidth.pdf',{compress:false});
i see that 0 w
is emitted....that's obviously bad. i'll look into it.
cheers. 1.0.91 should take care of this.
The high level drawing commands don't seem to work correctly when the stroke width is less than 1, a stroke width of 0 is always output in the resulting PDF.
For example when width is set to 0.5 the PDF that is generated has a stroke width of 0.
pageContext.drawPath(x1, y1, x2, y2, { type: 'stroke', width: 0.5, color: 0x002B49 });
(drawSquare also has the same issue, I haven't tested any others)When using the low level operators, the stroke comes out correctly.
pageContext .q() .K(1.00, 0.80, 0.42, 0.45) .w(0.5) .m(x1, y1) .l(x2, y2) .S() .Q();
(Using hummusJS 1.0.90 on Windows 10, NodeJS 10.11)