We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

PDF and Excel Export (DataGrid)

Is it possible on the PDF to add some new information which is not in the data onto say the bottom of the last page, not a footer, but some extra information j, I would also like to be able to do this on the Excel as well, but not sure if it is possible, if so any examples of this would be helpful.

8 Replies

NP Naveen Palanivel Syncfusion Team December 12, 2022 04:50 PM UTC

Hi Simon

Greetings from Syncfusion support. 

We have already documented this topic under Pdf Export section in our UG documentation. Please refer the below documentation for more details regarding this requirement. 

Documentation : https://blazor.syncfusion.com/documentation/datagrid/pdf-export/#to-add-header-and-footer 

Please let us know if you have any concerns.


Naveen Palanivel

SA Simon Arnold replied to Naveen Palanivel December 12, 2022 04:58 PM UTC

I don’t think I made my original question easy to understand, I already have the header and fitters used, what I need is to add a custom section on the last page above the footer that could show some extra information like totals and address details, so what I’m after is a way to access the output and add to it before it is physically created 

NP Naveen Palanivel Syncfusion Team December 15, 2022 04:48 AM UTC

Hi simon,

We have analyzed your query, Currently we don't have support to add a custom section on the last page above the footer. We can achieve this requirement in a custom way by exporting the Grid without using ExportToPdfAsync method. If it is ok, we can log as custom sample and update you the sample. Kindly confirm whether it is fine for you to achieve this requirement in own way (custom way).  

Please let us know if you have any concerns.


Naveen Palanivel

SA Simon Arnold December 15, 2022 08:21 AM UTC

If you could provide a sample way of doing it, that would be fantastic.

Thank you

PG Peter Groft December 16, 2022 08:03 AM UTC

Follow these easy steps to turn a PDF document into a Microsoft Excel spreadsheet: Click the Select a file button above or drag and drop a PDF into the drop zone. Select the PDF you want to convert to the XLSX file format. Watch Acrobat automatically converts your PDF to Excel.

Hope This Helps,

SA Simon Arnold December 16, 2022 08:48 AM UTC

Hi Peter,

This answer has nothing to do with the actual question, so no this does not help in anyway.


NP Naveen Palanivel Syncfusion Team December 20, 2022 02:06 AM UTC

Hi Simon,

We have considered your query as a custom sample, we prepare the sample and update you the sample shortly.

Until then we appreciate your patience.


Naveen Palanivel

NP Naveen Palanivel Syncfusion Team January 13, 2023 03:04 AM UTC

Hi Simon,

Thanks for the Patient,

As explained in our previous update, we do not have direct support to add PDF page section footer for selective pages. So based on your requirement we suggest you to do a custom way of exporting using PdfLibrary instead of using Grid’s inbuilt PdfExport method.

With this approach, we can access page graphics and draw section content as PdfTemplate. We suggest you to refer to the below kb for more details regarding this approach of adding page footer section into only the last page of the PDF.

KB : https://www.syncfusion.com/kb/9637/how-to-add-header-and-footer-from-the-second-page-of-the-pdf-document-using-c-and-vb-net

We have also prepared a  custom sample by using the above approach with Grid’s data exporting. Please download and refer the sample from the link below,


   if (args.Item.Id == "Grid_pdfexport"//Id is combination of Grid's ID and itemname


            PdfDocument document = new PdfDocument();




            PdfSection section = document.Sections.Add();


          PdfPage page = section.Pages.Add();



            PdfBrush brush = new PdfSolidBrush(Color.Black);


            PdfGrid grid = new PdfGrid();



            PdfGridRow[] headerRow = grid.Headers.Add(1);


            var GridColHeader = Grid.Columns.Select(x => x.HeaderText).ToList();

            for (var i = 0; i < Grid.Columns.Count; i++)


                headerRow[0].Cells[i].Value = GridColHeader[i];


            // Add Rows to the grid based/using on Grid's DataSource

            for (int i = 0; i < Orders.Count; i++)


                PdfGridRow row = grid.Rows.Add();

                //assign cells based on grid's columns

                row.Cells[0].Value = Orders[i].OrderID.ToString();

                row.Cells[1].Value = Orders[i].CustomerID;

                row.Cells[2].Value = Orders[i].OrderDate.ToString();

                row.Cells[3].Value = Orders[i].Freight.ToString();



            //enable repeating grid column header in each page

            grid.RepeatHeader = true;


            //draw the grid below the pdf Footer

            PdfGridLayoutResult result = grid.Draw(page , new Point(0, 0));


            PdfTemplate Footer = AddFooter(document);

            //Draw the Footer in the Last page of PDF document

            page.Graphics.DrawPdfTemplate(Footer, new PointF(0, 0));


            MemoryStream stream = new MemoryStream();


            //Close the document



            await Runtime.InvokeVoidAsync("exportSave", new object[] { "output.pdf", Convert.ToBase64String(stream.ToArray()) });





    public static PdfTemplate AddFooter(PdfDocument doc)


        SizeF bounds = new SizeF(doc.Pages[0].GetClientSize().Width, 50);

        //Create a page template that can be used as footer

        PdfTemplate footer = new PdfTemplate(bounds);

        PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 7);

        PdfBrush brush = new PdfSolidBrush(Color.Black);

        //Create page number field

        PdfPageNumberField pageNumber = new PdfPageNumberField(font, brush);

        //Create page count field

        PdfPageCountField count = new PdfPageCountField(font, brush);

        //Add the fields in composite fields

        PdfCompositeField compositeField = new PdfCompositeField(font, brush, "Page {0} of {1}", pageNumber, count);

        compositeField.Bounds = footer.GetBounds();

        //Draw the composite field in footer

        compositeField.Draw(footer.Graphics, new PointF(-5, -5));



        //here we can add custom section (For example here we given Total)

        doc.Pages[1].Graphics.DrawString("Total: custom section", new PdfStandardFont(PdfFontFamily.TimesRoman, 20), brush, new PointF(footer.GetBounds().X, footer.GetBounds().Y + 650));


        return footer;



References : https://help.syncfusion.com/file-formats/pdf/overview

Please get back to us if you need further assistance.

Please let us know if you have any concerns.


Naveen Palanivel

Attachment: BlazorApp1201_f7f95617.zip

Live Chat Icon For mobile
Up arrow icon