Ejemplo n.º 1
0
		// Fallback to the original GNOME Print API.
		public static void Print (string html) 
		{
			string caption = "Monodoc Printing";

			Gnome.PrintJob pj = new Gnome.PrintJob (PrintConfig.Default ());
			PrintDialog dialog = new PrintDialog (pj, caption, 0);

			Gtk.HTML gtk_html = new Gtk.HTML (html);
			gtk_html.PrintSetMaster (pj);
			
			Gnome.PrintContext ctx = pj.Context;
			gtk_html.Print (ctx);

			pj.Close ();

			// hello user
			int response = dialog.Run ();
		
			if (response == (int) PrintButtons.Cancel) {
				dialog.Hide ();
				dialog.Destroy ();
				return;
			} else if (response == (int) PrintButtons.Print) {
				pj.Print ();
			} else if (response == (int) PrintButtons.Preview) {
				new PrintJobPreview (pj, caption).Show ();
			}
		
			ctx.Close ();
			dialog.Hide ();
			dialog.Destroy ();
		}
Ejemplo n.º 2
0
        // Fallback to the original GNOME Print API.
        public static void Print(string html)
        {
            string caption = "Monodoc Printing";

            Gnome.PrintJob pj     = new Gnome.PrintJob(PrintConfig.Default());
            PrintDialog    dialog = new PrintDialog(pj, caption, 0);

            Gtk.HTML gtk_html = new Gtk.HTML(html);
            gtk_html.PrintSetMaster(pj);

            Gnome.PrintContext ctx = pj.Context;
            gtk_html.Print(ctx);

            pj.Close();

            // hello user
            int response = dialog.Run();

            if (response == (int)PrintButtons.Cancel)
            {
                dialog.Hide();
                dialog.Destroy();
                return;
            }
            else if (response == (int)PrintButtons.Print)
            {
                pj.Print();
            }
            else if (response == (int)PrintButtons.Preview)
            {
                new PrintJobPreview(pj, caption).Show();
            }

            ctx.Close();
            dialog.Hide();
            dialog.Destroy();
        }
Ejemplo n.º 3
0
    void Print(object sender, EventArgs args)
    {
        PrintJob pj = new PrintJob();
        PrintDialog dialog = new PrintDialog (pj, "Print diagram");
        int response = dialog.Run();

        if (response == (int) ResponseType.Cancel ||
            response == (int) ResponseType.DeleteEvent) {
            dialog.Destroy();
            return;
        }

        PrintContext ctx = pj.Context;
        Gnome.Print.Beginpage (ctx, "demo");
        Dia.Global.ExportPrint (pj, canvas);
        Gnome.Print.Showpage (ctx);
        pj.Close();

        switch (response) {
        case (int)PrintButtons.Print:
            if (pj.Config.Get ("Settings.Transport.Backend") == "file")
                pj.PrintToFile (pj.Config.Get ("Settings.Transport.Backend.FileName"));
            pj.Print();
            break;
        case (int) PrintButtons.Preview:
            new PrintJobPreview (pj, "Diagram").Show();
            break;
        }
        dialog.Destroy();
    }