Re: printing



On Tue, 20 Sep 2005 20:20:46 +0200, Juan Francisco Gonz�z <juanfran ugenawireless net> wrote:

Ok, i�m going to read about pango.

My aplication is being develop on c++ with gtkmm which include pango.

I would like to use a special widget which show information on screen an
after print out.

I would like to connect a button with this widget and so print the require
information after show it..

Can be this done aproximatly with pango?

thank you.


Yes it can, this is how i did this:

i made a virtual base class PrinterBase with member functions like

virtual void print(const Glib::ustring& t);
virtual void new_doc()
virtual void new_page()
virtual void end_doc()
virtual void set_font(const Glib::ustring& name, int size, bool bold, bool underline); virtual void set_margins( double left , double right, double top, double bottom);

Then i inherited a PrinterWindows and a PrinterTextView(this would be your special widget) from this.

   PrinterBase     Gtk::TextView
        |                |
        |                |
   --------------------  |
   |                   | |
PrinterWindows      PrinterTextView

I can now do something like this:

print_report(PrinterBase& prntr)
{
   prntr.new_doc();
   prntr.print("some text");
   prntr.end_doc();
}

PrinterTextView s_out;
PrinterWindows p_out;

//to show it on screen
PrintReport(s_out);
//and then when the print button is pressed
PrintReport(p_out);

There are probably better ways but this works.

hope this helps.

--
Marco




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]