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

Free Support Forum - aspose.com

Graph Objects in Footer

I am using the latest C# packages (22.9.0 at time of writing) and observing that if I have a Graph object in the Footer of my page, the entire footer is not rendered. If I remove the Graph object from the Paragraphs array the footer then shows. The sample code attached reproduces the issue.

I have seen other solutions on the forum that involve placing the line at exact coordinates, but I need my line separator to be part of a dynamic array of paragraphs that a user may include or omit in their printing options.

It would seem if the header is able to show this sort of data (and it is) then the footer should be able to as well. Am I doing something incorrectly or is this a bug? Is their a workaround in the form of some other object I can add to the Paragraphs array and get a similar effect?

public static Document HardcodedTestDocument()
    {
        var document = new Document();

        var page = document.Pages.Add();

        var linePlot = new float[] { 0, 0, (float)(page.PageInfo.Width - (page.PageInfo.Margin.Left + page.PageInfo.Margin.Right)), 0 };

        //Add body
        var graph1 = new Graph((float)page.PageInfo.Width, 3);
        page.Paragraphs.Add(graph1);
        page.Paragraphs.Add(new TextFragment("Body Text"));
        graph1.Shapes.Add(new Line(linePlot));

        //Make header
        HeaderFooter header = new HeaderFooter();
        var graph2 = new Graph((float)page.PageInfo.Width, 3);
        header.Paragraphs.Add(graph2);
        header.Paragraphs.Add(new TextFragment("Header Text"));
        graph2.Shapes.Add(new Line(linePlot));

        //Make footer
        HeaderFooter footer = new HeaderFooter();
        var graph3 = new Graph((float)page.PageInfo.Width, 3);
        **footer.Paragraphs.Add(graph3);//IF YOU COMMENT OUT THIS LINE THE TEXT BELOW WILL SHOW IN THE FOOTER, BUT WITH IT IN NOTHING SHOWS**
        footer.Paragraphs.Add(new TextFragment("Footer Text"));
        graph3.Shapes.Add(new Line(linePlot));

        //Assign header/footer
        page.Header = header;
        page.Footer = footer;

        document.Save(@"C:\NoFooter.pdf");

        return document;
    }

@jbone

We have logged this problem in our issue tracking system as PDFNET-52599. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.