Join GitHub today
Canvas Context setLineDash Doesn't Work #2353
I have a need to draw dashed lines in my chart.
I'm getting an undefined error in wkhtmltopdf.exe.
This function is probably not supported yet.
In the meantime, I have to look for workarounds to implement wkhtmltopdf in my application.
FYI: I ran into the same problem with an older version of PhantomJS, but there latest PhantomJS supports it. I'm not happy with the output and performance of PhantomJS comparing to wkthmltopdf.
So really needed this setLineDash feature so I proceeded to add the code to expose that function in the canvas context. The good news is that the actual code to draw the dashed line is already written in the QT library. I just have to expose it in a few cpp files.
The question is do we want to officially support setLineDash function in wkthmltopdf. If so, should I submit my changes for review and hopefully it will be included in the next official release.
Please submit your changes. I also need the setLineDash function, was surprised to see it not work in my outputted PDF.
added a commit
Dec 19, 2016
Since I updated wkhtmltopdf from 0.12.2.4 to 0.12.4.0 (both 32 bits, with MSVC 2013 or 2015 for the lastest) I encounter a crash when the page includes some graphics created by ChartNew.js.
This "regression" have been introduced in 0.12.4.0 (I wasn't able to reproduce this issue in any 0.12.3.x release and in 0.13.0 alpha) only. So I look into the release note and found this issue !
As it turns out, ChartNew call the function setLineDash with an empty array parameter to draw a solid line without dash. Such call leads probably to an null pointer exception on the call of context.setLineDash (line 184 of JSCanvasRenderingContext2DCustom.cpp). I'm not sure about the second paramaters of this function, is it just supposed to be the first offset for the line ? Is it necessary ?
Based on my interpretation of the documentation I would say that it's suppose to work (and it actually does in others browsers) !
Can you tell me if you think that your implementation is supposed to handle this use case ? If you don't think so, and if ChartNew doesn't use it in a proper way this function, I don't really know how should ChartNew draw non-dashed line and I would be happy to know about it to let them know about haha !
Thanks in advance for your time, I'll stay tuned if you need anything to reproduce the issue or anything !