The right approach is to let the platform dealing with all the different printers; your task is to provide rendering which is not dependent from the printer. For example, you cannot deny that if you output some data in a vector format like XPS (
http://en.wikipedia.org/wiki/Open_XML_Paper_Specification[
^]), the OS with the installed printer will print it correctly despite the printer detail.
Of course, you can always print to XPS, because there is a printer which prints to a file of this type, but more generally, you need to render your graphics on the fly. You can do it using the class
System.Drawing.Printing.PrintDocument
:
http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx[
^].
Look at the code sample to see how this is done. It's important to note that the main thing is such code is adding the event handler to the even
PrintPage
. Event arguments passed as a parameters of the handler method provides you with the information on the page metrics; and you also are given the instance of the class
System.Drawing.Graphics
to be used for rendering:
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.aspx[
^].
In you rendering method, you have to scale your graphics according to the size and orientation of the page, that's it. For any printer with sufficient page size and resolution, you can arrange your Avery-formatted data with sufficient accuracy.
Good luck,
—SA