1

consider the following idea:

There can be X amount of client applications that need to print labels with differing layouts. There is one server with a WCF service app which contains all the layout logic of those labels. The service gets called with parameters and returns an Image object which the client can send to an attached printer.

My mind blocks on the idea of returning an image and then draw that on a Graphics object needed for printing.

Normally generating the Image to print happens in the context of the printer so a good size of the image is generated.

void print(object sender, PrintPageEventArgs ev)
{
    Graphics g = ev.Graphics;
    g.DrawString() // etc
}

But how should the WCF service generate its image so the client can just call

Graphics g = ev.Graphics;
g.DrawImage(service.GenerateLabel(), 0, 0);

I hope Im clear

Serve Laurijssen
  • 9,266
  • 5
  • 45
  • 98

1 Answers1

1

You should still be able to use GDI+ (Graphics class) in the server environment. If your only concern is the image size, consider using Metafile instead of bitmap, which is a pretty compact and resolution-independent format (you set the DPI).

noseratio
  • 59,932
  • 34
  • 208
  • 486
  • 1
    You could also look at [XPS](http://stackoverflow.com/questions/321168/how-to-create-an-xps-document-in-a-wcf-service-to-store-and-return) if you want a higher level of document format abstraction, but that'd probably take a lot more code to render and print. – noseratio Sep 09 '13 at 08:40