I’m trying to insert a line separator (you know, that horizontal line that runs across documents) into my document with iText. I’ve found some resources via Google that use com.lowagie.text.pdf.draw.LineSeparator but the version of iText that I’m using (1.4.2) doesn’t seem to have that package.
Can anyone suggest another way to add a nice line seperator for my pdf? And please don’t say update the .jar– I’m locked in to 1.4.2.
Thanks!
There is a bit of a messy way around this in the earlier versions of iText. If you store the element above the horizontal line in a PdfPCell, you can then set the border of that to show only the bottom. (That cell can also be blank if needed)
The result should look like (solid line, not checkered)
This should give you what you desire. Not the optimal solution but it is a way to work around the limitations of the old jar.
For your reference, if you want to perform this trick to put a line on top and below your text to give a result of
The argument to setBorder() is an int which you can use bitwise operation on to manipulate the values. So the above example can would be accomplished with
edit: Example
This should create you a table which looks something like the following (assuming you correct my typos)