Free Support Forum -

Issue with TOC(ListSection) in


PFA the PDF generated using and Aspose dll respectively. If you note the alignment of the TOC section; in, the content is overflowing out of the page width. Whereas, same is not the case with PF below the code used to generate the PDF.

Pdf pdf1 = new Pdf();

MarginInfo _defaultMargins = new MarginInfo();
_defaultMargins.Bottom = .5F;
_defaultMargins.Top = .5F;
_defaultMargins.Left = .5F;
_defaultMargins.Right = .5F;

PageSetup _pgSetup = new PageSetup();
_pgSetup.PageBorderMargin = _defaultMargins;
_pgSetup.PageWidth = PageSize.A4Width;
_pgSetup.PageHeight = PageSize.A4Height;
pdf1.PageSetup = _pgSetup;

ListSection _tocSection = new ListSection("");
_tocSection.ListType = ListType.TableOfContents;

float _marginSec = 20;
_tocSection.PageInfo.Margin.Left = _marginSec;
_tocSection.PageInfo.Margin.Right = _marginSec;

_tocSection.ListFormatArray.Length = 1;
_tocSection.ListFormatArray[0].TextInfo.FontSize = 10;
_tocSection.ListFormatArray[0].LeftMargin = 0;
//_tocSection.ListFormatArray[0].TextInfo = GetTextInfo(useBoldFont);
_tocSection.ListFormatArray[0].TextInfo.LineSpacing = 15;
_tocSection.ListFormatArray[0].TextInfo.Alignment = AlignmentType.FullJustify;


pdf1.IsBookmarked = true;
pdf1.BookMarkLevel = 1;

Section _pdfSection = new Section();

Segment _segt = new Segment();
_segt.Content = “Section 1”;

Heading _hd = new Heading(pdf1, _pdfSection, 1);
_hd.IsFirstParagraph = false;
_hd.IsKeptWithNext = true;
_hd.IsInList = true;
_hd.LabelWidth = 0;

//add heading directly to the section object so it can be targeted properly

Aspose.Pdf.Table _tbl = new Aspose.Pdf.Table();
_tbl.ColumnWidths = “100%”;
Row row = _tbl.Rows.Add();
Cell cell = row.Cells.Add();
Text _text = new Text();

Segment _seg = new Segment();
_seg.Content =
“Aspose.Words for .NET is a class library that enables your applications to perform a great range of document processing tasks. Aspose.Words supports DOC, DOCX, RTF, HTML, OpenDocument, PDF, XPS, EPUB and other formats. With Aspose.Words you can generate, modify, convert, render and print documents without utilizing Microsoft Word.”;

_text.TextInfo.FontName = “Arial Unicode MS”;
_text.TextInfo.IsUnicode = true;


MemoryStream _ms = new MemoryStream();
byte[] bytes = _ms.ToArray();

Response.Expires = 0;
Response.Charset = null;
Response.ContentType = “application/pdf”;
Response.AddHeader(“content-disposition”, “attachment; filename=display.pdf”);


Please help up regarding the same.


Hello Naresh,

I have tested the scenario and I am able to reproduce the same problem. For the sake of correction, I have logged it in our issue tracking system as PDFNET-19632. We will investigate this issue in details and will keep you updated on the status of a correction. <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

We apologize for your inconvenience.

Hi Nayyer,

A gentle reminder. We are waiting on this. Alternatively, is there any other option (or property) that can be set to fix this issue?


Hello Naresh,

Thanks for your patience.

Our development team is still working to get this issue resolved. However, I have asked them to share the ETA regarding its resolution. As soon as I have the updated information, I would be pleased to share that. Please spare us little more time and we will try our level best to get back to you ASAP.

We apologize for the delay and inconvenience.

Hi Nayyer,

A gentle reminder. We are still waiting for your response.


Hello Naresh,

I am pleased to inform you that the issue reported earlier has been resolved in latest release version of Aspose.Pdf for .NET 4.7.0. You can download the latest release version from this link.

Please try using it and in case you face any problem, please feel free to contact. We apologize for your inconvenience.