I am creating a pdf and need to put a horizontal line in the page. Can anyone tell how to do that?
I have a xml file which has my html tag(<table>....</table>
). And the whole content of xml
file is parsed to a string
which is used to create the pdf
. Now some tags are not supported. One of them is <hr>
. So is there any other tag which I can use in the xml
file so that this will draw a
line
when the pdf is created using xml data.
Below is an example of xml xontent
<table>
<tr>
<td>
<span>
This is working properly.
</span>
</td>
<tr>
</table>
<table>
<tr>
<td>
<span>
<hr>
This is not working properly.
</span>
</td>
<tr>
</table>
Please let me know if any more information is needed.
Thanks in advance.
If you have a PdfContentByte object cb , you can draw a line like this: cb. MoveTo(x1, y1); cb. LineTo(x2, y2); cb.
The following creates a full width black line a few pixels thick, I'm using HTMLWorker.Parse
:
<table>
<tr>
<td>
<span>
This is working properly.
</span>
</td>
<tr>
</table>
<table>
<tr>
<td>
<span>
<table border="1" cellpadding="0" cellspacing="0"><tr><td> </td></tr></table>
This is working properly now too!
</span>
</td>
<tr>
</table>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With