Currently I have charts that are printing nicely, but I need to include a header and footer with some information like:
Project Name:
File Name:
<<CHART GRAPHIC>>
Run Date:
Location:
The current code I have for printing:
private void button1_Click(object sender, EventArgs e) { printDialog1.Document = ultraChart1.PrintDocument; DialogResult res = printDialog1.ShowDialog(this); if (res == DialogResult.OK) { PrinterSettings printer1 = printDialog1.PrinterSettings; PageSettings page1 = new PageSettings(); // Set the page orientation to landscape. page1.Landscape = true; this.ultraChart1.PrintChart(printer1, page1); } }
Hello Amanda,
In order to add a header and a footer to a PrindDocument object that is going to be printed you could use the PrintPage event. The object fires the event for each page that’s going to be printed. In the event you could draw text, lines, images etc. into the print queue using the PrintPageEventArgs parameter property Graphics. More information about the PrintPage event you could find on the following link:
http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.printpage.aspx
I also recommend you to use the UltraPrintPreviewDialog instead of the PrindDialog in order to see if the position of the drawn elements suits you before you print the document.
I’ve implemented this suggestion in a simple sample, and you could run and evaluate it, please see attached zip.
Please let me know if you have any further questions.