I am using TCPDF, which has issues with normal HTML/CSS. It accepts a basic set of HTML/CSS and unfortunately nothing really fancy.
I need a way to create custom dashed lines, as below:
Seeing how CSS only has border property of solid, dashed, or dotted, I am lacking the "other way" of dashed lines. I need to be able to control the length of the stroke, and the length of the in-between space. So for example stroke length of 17, and in-between space of 5.
How can I do this? Can I do this?
So far looking at other questions did not help me. I've read a few questions and none of the solutions so far helped. Either it's too fancy (tcpdf ignores it), or it resorts back to dashes and dotted properties and those are not sufficient for my purpose.
As you're using a library which doesn't implement CSS's more useful features (such as custom dashed borders, image borders or CSS gradients) and because you're writing HTML+CSS solely to generate a a PDF document then I see no problem writing non-semantic HTML using old-school techniques such as
<table>-abuse to produce an image border.
I suggest using a 9-grid:
<table border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="topLeftCorner.gif" alt="" /></td> <td background="horizontalDottedBorder.gif"> </td> <td><img src="topRightCorner.gif" alt="" /></td> </tr> <tr> <td background="verticalDottedBorder.gif"> </td> <td>content!</td> <td background="verticalDottedBorder.gif"> </td> </tr> <tr> <td><img src="botLeftCorner.gif" alt="" /></td> <td background="horizontalDottedBorder.gif"> </td> <td><img src="botRightCorner.gif" alt="" /></td> </tr> </table>
BIG SCARY WARNING: Never use this markup in a HTML document viewed in an actual web-browser.
...with the possible exception of HTML email targeting Office Outlook 2007-2013, which is still awful: http://fixoutlook.org/ and https://www.campaignmonitor.com/blog/post/3769/a-designers-guide-to-outlook-2013
(disclaimer: I work for Microsoft but not on the Office team and these opinion is my own and not that of the company's and stuff)