harsha.k Posted November 12, 2007 Report Share Posted November 12, 2007 Hi, I want to insert an extra page (covering page) to Print Document , How can i do it? i tried PrintPage event but the problem in using this is we have to erase the first page and we have to draw the covering page.. Quote Link to comment Share on other sites More sharing options...
maximop Posted November 12, 2007 Report Share Posted November 12, 2007 Since this is not related to ChartFX, you will have more luck in the Microsoft's forums; however, I am placing a link below that may help you in accomplishing what you need: http://www.c-sharpcorner.com/UploadFile/mgold/PrintinginCSharp11302005061400AM/PrintinginCSharp.aspx?ArticleID=950ee7ad-484e-47a3-9b41-0d7a6dfd9b91 Quote Link to comment Share on other sites More sharing options...
harsha.k Posted November 12, 2007 Author Report Share Posted November 12, 2007 Actually i need to insert an covering page to chart-fx print document,so how to modify the chart-fx printdocument for the same. Quote Link to comment Share on other sites More sharing options...
maximop Posted November 13, 2007 Report Share Posted November 13, 2007 The ChartFX Printer Class provides important and very helpful properties to print the chart. Using the supported members, you will have control over the margins, paper orientation, color or pattern printing, among others. The supported methods will also allow you to prompt the user with page setup, preview, and print dialogs to ensure the user prints exactly what they want; however, this is more of an extended functionality of the PrintDocument Class provided by the .NET Framework. When you print, you still have to create a PrintDocument Object which is handled by the BeginPrint, PrintPage, and EndPrint Events respectively. If you want to manipulate how a page is printed, you will need to do this in the PrintPage Event. Again, this is beyond the scope of ChartFX; however, I will post some code that can help you accomplish what you need. The code snippet is below: private void Form1_Load(object sender, EventArgs e) {printCover = true; // Global flag to control how to print the pages PrintDocument pd = new PrintDocument();pd.PrintPage += new PrintPageEventHandler(pd_PrintPage); pd.Print(); } void pd_PrintPage(object sender, PrintPageEventArgs e) { if (printCover) {e.Graphics.DrawString("This is my cover sheet", new Font("Arial", 14, FontStyle.Bold), Brushes.Black, 25, 25, StringFormat.GenericTypographic); printCover = false;e.HasMorePages = true; // Forces an additional page to be printedreturn ;} else{chart1.Paint(e.Graphics, new Rectangle(25, 25, e.MarginBounds.Width, e.MarginBounds.Height / 2), PaintStyles.Print); } } The main part of the code is the PrintPage Event which determines how my document is going to be printed. I am using a flag that helps print a first page before printing the chart image. The HasMorePages property, tells the Event Handler that there are more pages to be printed; in this case, we need to print the chart. Hope this helps with what you need. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.