We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Horizontal lines between section

I'm currently working on some xml-templates for the pdf's, and I'm struggling a bit with adding horizontal lines between sections. I have several templates that dispal multiple sections containing information of various kinds. I need to insert the horizontal lines between each section, full page length, but it isn't really working out for me. I assume that this is quite simple, yet I need a bit of guidance on this.

Many thanks


Thanks for using our products.

In order to accomplish your requirement, you may consider adding a Graph object (Line) at the end of every section. Please take a look over the following XML which adds a line between two sections of the PDF document. The resultant PDF document is also in attachment, please take a look.


<?xml version="1.0" encoding="utf-8" ?>
<Pdf xmlns="Aspose.Pdf">

<Segment>Paragraph in Section 1</Segment>

<Graph Height="100" Width="400">
<Line Position="0 0 400 0" />
<Section IsNewPage="false">

<Segment>Paragraph in Section 2</Segment>



//Instantiate a Pdf document object
Pdf pdf1 = new Pdf();
// Bind XML document to be transformed into PDF
// save the PDF document

For more information, please visit Working with Graphs

In case I have not properly understood your requirement or you have any further query, please feel free to contact.

We apologize for your inconvenience.

Thank you codewarrior! It is a bit fiddly having to define the position of the points manually, but it works. Many thanks!


It worked. I got the line to display, but I have a very large margin between the last line of the section and the line and the section following immediately behind the line is tucked up very tight to the first line of text in the following section. Any idea on how to make this look a bit better?


Can you please share the resultant PDF document which is generating at your end and if possible, please share some picture which can help us in understanding your requirement.

Thank you Nayyer, but I managed to solve it. It was the Graph Height property that was set to too big a number.