2 // System.Drawing.StandardPrintController.cs
5 // Dennis Hayes (dennish@Raytek.com)
6 // Herve Poussineau (hpoussineau@fr.st)
8 // (C) 2002 Ximian, Inc
12 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
14 // Permission is hereby granted, free of charge, to any person obtaining
15 // a copy of this software and associated documentation files (the
16 // "Software"), to deal in the Software without restriction, including
17 // without limitation the rights to use, copy, modify, merge, publish,
18 // distribute, sublicense, and/or sell copies of the Software, and to
19 // permit persons to whom the Software is furnished to do so, subject to
20 // the following conditions:
22 // The above copyright notice and this permission notice shall be
23 // included in all copies or substantial portions of the Software.
25 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
29 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
30 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
31 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
36 namespace System.Drawing.Printing
38 public class StandardPrintController : PrintController
43 public StandardPrintController()
47 [MonoTODO("StandardPrintController.OnEndPage")]
48 public override void OnEndPage(PrintDocument document, PrintPageEventArgs e)
50 //TODO: print current page
51 // - image to print is this.image
52 // - page settings are in e.PageSettings
53 // - printer settings are in document.PrinterSettings
54 // - don't forget to use document.OriginAtMargins (only if .NET 1.1)
56 // actually, "print" == "save to a file"
59 string fileName = document.DocumentName + " " + page.ToString("D4") + ".jpg";
60 Console.WriteLine("StandardPrintController: Print page \"{0}\"", fileName);
61 image.Save(fileName, System.Drawing.Imaging.ImageFormat.Jpeg);
65 if (e.Graphics != null)
69 [MonoTODO("StandardPrintController.OnStartPrint")]
70 public override void OnStartPrint(PrintDocument document, PrintEventArgs e){
74 [MonoTODO("StandardPrintController.OnEndPrint")]
75 public override void OnEndPrint(PrintDocument document, PrintEventArgs e){
79 [MonoTODO("StandardPrintController.OnStartPage")]
80 public override Graphics OnStartPage(PrintDocument document, PrintPageEventArgs e)
82 //FIXME: I'm not sure of what I'm doing
83 // I don't know what size to give to image
84 // and why I have to clear it
86 // returns a new (empty) graphics
87 image = new Bitmap(e.MarginBounds.Width, e.MarginBounds.Height);
88 Graphics g = Graphics.FromImage(image);