#744 Need printer API in FWT

qualidafial Tue 15 Sep 2009

FWT should API for printing and for displaying the printer dialog. I have extensive experience with the printing API in SWT and would be willing to help out with this.

Edit: removed redundant redundancies

andy Tue 15 Sep 2009

If you want to take a stab, we'd love the help!

qualidafial Tue 15 Sep 2009

I'll try a spike tonight and get back to you

brian Tue 15 Sep 2009

might helpful as first step to figure out a simple, lean API and how you "paint" to the printer context

I haven't looked at what SWT provides yet

qualidafial Tue 15 Sep 2009

Here's a Java sample:

PrinterData printerData = new PrintDialog(shell).open();
if (printerData != null)
{
  Printer printer = new Printer(printerData);
  if (printer.startJob("Job name shown in system queue"))
  {
    GC gc = new GC(printer);
    for (page : pages)
    {
      if (printer.startPage())
      {
        // draw page contents on GC

        // draw "some sample text" at (1",1") from top-left
        Point dpi = printer.getDPI();
        gc.drawText(dpi.x, dpi.y, "some sample text");

        printer.endPage();
      }
    }
    printer.endJob();
  }
}

I'm still trying to figure out what a good idiomatic interface would look like for Fan.

Login or Signup to reply.