Hi,
I want to create a pdf document programmatically in C# 3.5 with custom headers and footers along with margins, is this possible to generate pdf with headers and footers with customized fonts and styles and the same pdf file will be created in multiples at-once in one single document, Please suggest the possible way to achieve it.
Any kind of code can be more helpful.

Rahul PrasadPosted Jul 31, 2014, 11:31 PM
Use iTextSharp .. or any other tools capable of this.Here is what Google recommend you to do
https://www.google.com/search?newwindow=1&site=&source=hp&q=add+PDF+header+C%23&oq=add+PDF+header+C%23
Good luck
Farhan ShariffPosted Jul 24, 2014, 7:40 AM
Creating PDF file in runtime can be done with this tool http://www.componentpro.com/pdf.net/. I paste code snippet to create a PDF document (the code is copied from: http://www.componentpro.com/doc/pdf/Creating-tables.htm)
using System;
using System.Drawing;
using ComponentPro.Pdf;
using ComponentPro.Pdf.Graphics;
using ComponentPro.Pdf.Tables;
...
static string[][] datastring = new string[2][];
[STAThread]
static void Main()
{
// Create a new PDF document. This object represents the PDF document.
// This document has one page, by default. Additional pages have to be added.
PdfDocument doc = new PdfDocument();
// Add a page to the document
PdfPage page = doc.Pages.Add();
// Specify values for the table
datastring[0] = new string[] {"111", "Maxim", "100"};
datastring[1] = new string[] {"222", "Calvin", "95"};
// Creates a new document
PdfSimpleTable table = new PdfSimpleTable();
table.DataSource = datastring;
table.BeforeRowLayout += new BeforeRowLayoutEventHandler(table_BeforeRowLayout);
table.BeforeCellLayout += new BeforeCellLayoutEventHandler(table_BeforeCellLayout);
// Draw the table
table.Draw(page, new PointF(0, 0));
// Save the PDF document to disk.
doc.Save(@"c:\temp\customize table.pdf");
// Use the following code to stream the document to the browser.
// pdfDoc.Save("customize table.pdf", Response, HttpResponseType.OpenInsideBrowser); // Response is an HttpResponse object.
// Close the document.
doc.Close();
}
static void table_BeforeCellLayout(object sender, BeforeCellLayoutEventArgs args)
{
if (args.CellIndex == 0 && (args.RowIndex % 2) == 1)
{
// Draw ellipses inside cells
args.Graphics.DrawEllipse(PdfBrushes.Green, args.Bounds);
}
}
static void table_BeforeRowLayout(object sender, BeforeRowLayoutEventArgs args)
{
if ((args.RowIndex % 2) == 0)
{
args.IgnoreColumnFormat = true;
}
}