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

Rafael Ferreira lists at ophion.org
Sun Aug 14 13:47:29 EDT 2005


Hey everyone, 

I have a simple app that I'm trying to add print support to and it is
not working - even though everything seems to be working ok (I'm basing
this on the scarce documentation I've found on the print support of
gtkhtml). Any ideas? or at least can someone point me to a good example
of using GtkHtml.Print()? 


	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;
		}
	}

-- 
Rafael Ferreira <lists at ophion.org>



More information about the Mono-list mailing list