Re: [Gnome-print] multiple pages



Hello!

On 01 Aug 2001 10:51:37 -0400, Don Mellen wrote:
> I am trying to get multiple pages to print.

You mean multiple pages sequentially?

> I noticed the gnome_print_multipage.h file
> but could not seem to get it to work

GnomePrintMultipage fits several pages to single page.

> I noticed in evolutions source that they
> declare the multipage and assign it to a pc.
> After trying this it did not seem to work.
> So, I am trying just to keep a boolean variable 
> as to whether or not it is the first page if it is 
> not the first page I close the pc and declare a new one.
> Here is my code:

Basically you should do:

GnomePrintContext *pc;

/* Create print context */
pc = gnome_print_context_new_with_paper_size (printer, paper);

/* Page 1 */
gnome_print_beginpage (pc, name_of_page);
/* Print graphics here */
gnome_print_showpage (pc);

/* Page 2 */
gnome_print_beginpage (pc, name_of_page);
/* Print graphics here */
gnome_print_showpage (pc);

...

/* Send job to printer after last page */
gnome_print_context_close (pc)

So - beginpage starts new page, and showpage completes it. No graphic
operator is allowed between showpage and beginpage.

Now, if you want to use multipage, you start with:

GnomePrintContext *pc, *subpc;

  subpc = gnome_print_context_new_with_paper_size (printer, paper);
  pc = gnome_print_multipage_new (subpc, affines);

And then continue as earlier example. GnomePrintMultipage is
simply subclass of GnomePrintContext, that collects several pages, and
outputs these onto single page of final GnomePrintContext (subpc).

Also notice, that _beginpage operator clears ALL graphic state,
including
transformation matrix. Also you have to make sure, that gsave/grestore
pairs are balanced in each page. How this is handled, depends on
your binary (it is often ignored for compatibility), but will certainly
be an error in future.

Hope that helps,
Lauris Kaplinski

> if(!firstPage) {
>    cout<<"DBG -- getting into printing for next page"<<endl;
>    showpage = gnome_print_showpage (pc);
>    gnome_print_context_close (pc);
>    pc = gnome_print_context_new_with_paper_size (printer,"US-Letter");
>    gnome_print_setfont (pc, font);
> }
> This does not generate more than one page though
> I realize this will print each page individually to the printer instead
> of sending one.
> 
> 
> Thank you
> Don
> 
> 
> 
> _______________________________________________
> Gnome-print maillist  -  Gnome-print@ximian.com
> http://lists.ximian.com/mailman/listinfo/gnome-print






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