Document doc = new Document(“c:/pdftest/input.pdf”);
// add text fragment as heading<o:p></o:p>
Aspose.Pdf.Text.TextFragment top_heading = new TextFragment(“TOP SECRET DOCUMENT HEADER”);<o:p></o:p>
top_heading.TextState.BackgroundColor = Aspose.Pdf.Color.Yellow;<o:p></o:p>
top_heading.Margin.Bottom = 30;<o:p></o:p>
// add text fragment to document<o:p></o:p>
doc.Pages[1].Paragraphs.Add(top_heading);<o:p></o:p>
// add text fragment as heading<o:p></o:p>
Aspose.Pdf.Text.TextFragment test_heading = new TextFragment(“This document contains top secret information about something.”);<o:p></o:p>
test_heading.Margin.Bottom = 30;<o:p></o:p>
// add text fragment to document<o:p></o:p>
doc.Pages[1].Paragraphs.Add(test_heading);<o:p></o:p>
// add text fragment as heading<o:p></o:p>
Aspose.Pdf.Text.TextFragment table_heading = new TextFragment(“Table”);<o:p></o:p>
table_heading.TextState.ForegroundColor = Aspose.Pdf.Color.Yellow;<o:p></o:p>
table_heading.TextState.BackgroundColor = Aspose.Pdf.Color.Green;<o:p></o:p>
table_heading.Margin.Bottom = 30;<o:p></o:p>
// add text fragment to document<o:p></o:p>
doc.Pages[1].Paragraphs.Add(table_heading);<o:p></o:p>
Aspose.Pdf.Table table = new Aspose.Pdf.Table();<o:p></o:p>
table.Border = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 0.5f, Aspose.Pdf.Color.Black);<o:p></o:p>
table.DefaultCellBorder = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 0.5f, Aspose.Pdf.Color.Black);<o:p></o:p>
Aspose.Pdf.Row HeaderRow = new Aspose.Pdf.Row();<o:p></o:p>
HeaderRow.FixedRowHeight = 15;<o:p></o:p>
// default padding information for header row contents<o:p></o:p>
HeaderRow.DefaultCellPadding = new Aspose.Pdf.MarginInfo(5, 0, 0, 0);<o:p></o:p>
// add row to table object<o:p></o:p>
table.Rows.Add(HeaderRow);<o:p></o:p>
// add a blank cell in header row<o:p></o:p>
HeaderRow.Cells.Add(new Aspose.Pdf.Cell());<o:p></o:p>
// add a new cell to HeaderRow and set background color to red<o:p></o:p>
HeaderRow.Cells.Add(new Aspose.Pdf.Cell() { BackgroundColor = Aspose.Pdf.Color.Red });<o:p></o:p>
// contents of second cell in header row<o:p></o:p>
HeaderRow.Cells[1].Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“Header1”));<o:p></o:p>
// add a new cell to HeaderRow and set background color to Blue<o:p></o:p>
HeaderRow.Cells.Add(new Aspose.Pdf.Cell() { BackgroundColor = Aspose.Pdf.Color.DodgerBlue });<o:p></o:p>
// contents of second cell in header row<o:p></o:p>
HeaderRow.Cells[2].Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“Header2”));<o:p></o:p>
// add a new cell to HeaderRow and set background color to red<o:p></o:p>
HeaderRow.Cells.Add(new Aspose.Pdf.Cell() { BackgroundColor = Aspose.Pdf.Color.Yellow });<o:p></o:p>
// contents of second cell in header row<o:p></o:p>
HeaderRow.Cells[3].Paragraphs.Add(new Aspose.Pdf.Text.TextFragment(“Header3”));<o:p></o:p>
// add few row to table object<o:p></o:p>
for(int row_counter =1; row_counter<=6;row_counter++)<o:p></o:p>
{<o:p></o:p>
Aspose.Pdf.Row sample_row = new Aspose.Pdf.Row();<o:p></o:p>
sample_row.FixedRowHeight = 15;<o:p></o:p>
sample_row.DefaultCellPadding = new Aspose.Pdf.MarginInfo(5, 0,0,0);<o:p></o:p>
sample_row.Cells.Add(“Row” + row_counter);<o:p></o:p>
sample_row.Cells.Add(“” + row_counter + “,” + row_counter * 2);<o:p></o:p>
sample_row.Cells.Add(“” + row_counter + “,” + row_counter * 3);<o:p></o:p>
sample_row.Cells.Add(“” + row_counter + “,” + row_counter * 4);<o:p></o:p>
table.Rows.Add(sample_row);<o:p></o:p>
}<o:p></o:p>
// add table to PDF file<o:p></o:p>
doc.Pages[1].Paragraphs.Add(table);<o:p></o:p>
//save the PDF file<o:p></o:p>
doc.Save(“c:/pdftest/TextBackGround.pdf”);