Question Background:
I am working on a site that, along with other data, draws vertical and horizontal lines on an HTML canvas. That page can be converted to a PDF file when the user wants to download the report. Originally we were using one default style line to draw the graph values. Recently we added a second type of data on the graph and used context.setLineDash([x,x])
to draw dashed lines for the second data type. This works great in browsers. However, when the PDF converter software tries to convert a report with dashed lines, the dashed lines do not show up in the resulting PDF.
After some troubleshooting, I narrowed the problem down to the setLineDash()
property. It appears our converter sofware can understand normal style lines but does not understand the setLineDash()
property. The converter software is several years old and I have been informed that an updated version of the converter will not be bought. I also discovered that there is no support for our version from the creator.
Question: Since I am unable to update our HTML to PDF converter software or get support for it directly, can anyone provide an example of an alternative way to draw a dashed line on a canvas without using setLineDash()
?
EDIT
@K3N,
As per the instructions on the notification I received when you marked this question a duplicate of this other question, I am editing to explain how it is different.
I believe that though the answers to both questions will likely be similar, my question is not a duplicate of the question you indicated. I concede that both questions are asking for a way to draw dashed lines on a canvas. However, the other question is asking how to implement a dashed line by any method. My question specifically states that I cannot use the setLineDash()
property to draw a dashed line. This difference limits the possible answers and I believe it is enough to make both questions sufficiently distinct.