/// <summary>
/// PDF Creator Helper With No Page Base (Don't want to write a page or report (header or footer)
/// </summary>
/// <param name="PageSize">Page Size - A4 is a default page size. Use Enum iTextSharp.text.PageSize</param>
/// <param name="LandscapeMode">Do you want the pdf in landscape</param>
/// <param name="MarginTop">Top Margin On The Page</param>
/// <param name="MarginRight">Right Margin On The Page</param>
/// <param name="MarginBottom">Bottom Margin On The Page</param>
/// <param name="MarginLeft">Left Margin On The Page</param>
/// <param name="PageEventHandler">A Page Event Class That Will Raise Any Events You Need</param>
public PDFCreator(Rectangle PageSize,
bool LandscapeMode,
float MarginTop,
float MarginRight,
float MarginBottom,
float MarginLeft,
PageEventsBase PageEventHandler)
{
//create the instance of the ITextSharpDocument
Doc = new Document(PageSize, MarginLeft, MarginRight, MarginTop, MarginBottom);
//let's build the memory stream now
Ms = new MemoryStream();
//let's create the new writer and attach the document
Writer = PdfWriter.GetInstance(Doc, Ms);
//add the page events to my custom class
if (PageEventHandler != null)
{
Writer.PageEvent = PageEventHandler;
}
//if you want the pdf in landscape now, then rotate it
if (LandscapeMode)
{
Doc.SetPageSize(PageSize.Rotate());
}
//let's open the document so the developer can do whatever they wan't with it
Doc.Open();
}