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

Free Support Forum - aspose.com

PDF Table of Contents generation


I use Aspose.PDF to combine multiple PDF’s and generate TOC to point to each page. This works in most of the cases, but in some specific case when TOC is not fitting in to page, it fails to generate the TOC in combined file.

In my observation, if I adjust the margin in TextFragment it works fine, but some other cases it fails.

See the attached code

    var tocInfo = new TocInfo
        Title = new TextFragment(TableOfContentsTitle)
            TextState =
                FontSize = TableOfContentsFontSize,
                FontStyle = TableOfContentsFontStyle
            Margin = new MarginInfo(0, 10, 0, 0),

I feel something wrong with generation of PDF that it is failing to generate PDF content when the TOC can’t be fit in to single page.


HI @bvadala,

In order to provide a quick answer please can you share with me:
1- The version of Aspose.PDF that you have installed.
2 - An example of input files that you merged in this specific case.


Please check the link https://bit.ly/3RKmPWr to download zip file of my sample code with PDF files, I think you missed it in my post.

@mlyra Any update on this one? Thanks

Hi @bvadala

I have created an issue for our internal team PDFNET-52736. As soon as we fix it, I will let you know.

@mlyra Thanks, please let me know when this is fixed.