[Mono-list] Gtk.HTML.Print() - has anyone used this before?

Rafael Ferreira lists at ophion.org
Sun Aug 14 06:55:17 EDT 2005


hey everyone, 

I'm trying to print a HTML page using Gtk.HTML.Print(). Everything seems
to work but I don't get a printed page :-). This is my first attempt at
this and the documentation has been kinda scarce, so if anyone can help
me figure out what I'm doing wrong I'll be very thankful. 


snippet of my code:

	using System;
	using Gtk;
	using Gnome;

	public class GnomePrintManager : IPrintManager {
		public void Print(string Html) {
			PrintJob pj = new PrintJob (PrintConfig.Default ());
			PrintDialog dialog = new PrintDialog (pj, "Dummy Title", 0);
			int response = dialog.Run ();
			
			if (response == (int) PrintButtons.Cancel) {
				Console.WriteLine ("Canceled");
				dialog.Hide ();
				dialog.Dispose ();
				return;
			}else if (response == (int) PrintButtons.Print) {
				Console.WriteLine("**** printing ****");
				PrintContext ctx = pj.Context;
				Gtk.HTML gtk_html = new Gtk.HTML(Html);
				gtk_html.Print(ctx);
				ctx.Close();
			}else if (response == (int) PrintButtons.Preview) {
				new PrintJobPreview(pj,"Dummy Title");
			}
			
			pj.Close();
			dialog.Hide();
			dialog.Dispose();
			return;
		}
	}
}

cheers, 

 -raf 




More information about the Mono-list mailing list