Subject: How to Add   Page number for each page and table footer row using componentpro.PDF
Date: 2018-09-28 12:06:48
From: amolj
Source: add-page-number-page-table-footer-row-using-componentpro-pdf
----------------------------------------------------------------------

I am using componentpro.PDF for creating a pdf file with some details, but I am not able to add the Footer to my table and number for each of the page 
Following is my code

    // Create a new PDF document. This object represents the PDF document.             
        PdfDocument doc = new PdfDocument();

        // Add a page to the document  
        PdfPage page = doc.Pages.Add();

        //Create Data Source
        string[][] datastring = new string[10][];
        for (int j = 0; j < 10; j  )
        {                               
            datastring[j] = new string[] {
                "Date"  j,
                "Description" j,
                "Quantity" j,
                "Price" j,
                "Cost" j
               };
        }

        PdfSimpleTable table = new PdfSimpleTable();                
        table.DataSource = datastring;
        table.Style.RepeatHeader = true;
        table.Style.CellSpacing = 0;
        table.Style.CellPadding = 4;
        table.Style.ShowHeader = true;


    //Format Columns
        PdfColumnCollection columns = table.Columns;
        columns[0].Width = 10;
        columns[0].ColumnName = "Header 1";
        columns[0].StringFormat = new PdfStringFormat(PdfTextAlignment.Center, PdfVerticalAlignment.Middle);

        columns[1].Width = 50;
        columns[1].ColumnName = " Header 2";
        columns[1].StringFormat = new PdfStringFormat(PdfTextAlignment.Left, PdfVerticalAlignment.Middle);

        columns[2].Width = 12;
        columns[2].ColumnName = " Header 3";
        columns[2].StringFormat = new PdfStringFormat(PdfTextAlignment.Right, PdfVerticalAlignment.Middle);

        columns[3].Width = 14;
        columns[3].ColumnName = " Header 4  ";
        columns[3].StringFormat = new PdfStringFormat(PdfTextAlignment.Right, PdfVerticalAlignment.Middle);

        columns[4].Width = 14;
        columns[4].ColumnName = "Header 5";
        columns[4].StringFormat = new PdfStringFormat(PdfTextAlignment.Right, PdfVerticalAlignment.Middle);

        ///HOW TO ADD FOOTER TO table OBJECT ABOVE AND PAGE NUMBER for EACH PAGE (PDF HAS MANY NUMBER OF PAGES)

        // Draw the table  
        table.Draw(page, new PointF(0, 0));

        // Save the PDF document to disk. 
        doc.Save(@"c:\customize table.pdf");

        // Close the document. 
        doc.Close();  


Please help 
Thanks
Amol

----------------------------------------------------------------------

Note: This question has been asked on the Q&A forum of Thang Dang's fraudulent ComponentPro brand
If you purchased anything from ComponentPro, you have been scammed. Contact the payment processor
who sold you the license and ask for your money back.

Back to ComponentPro Q&A Forum Index