Hi I am wondering if it is possible to print a few images with specific options in c#. We have bunch of images in our db. The options also will be coming from db. For ex: Option 1: FileName1, A3 Size, Landscape, Print Quality = Best, Pages persheet = 1, 600 DPI, whole page. Will appreciate any input. Thanks, N
+3
A:
Yes. Use PrintTicket, for example:
PrintDialog printDialog = new PrintDialog();
if(printDialog.ShowDialog()==true)
{
PrintTicket ticket = new PrintTicket();
ticket.PageOrientation = MyDocument.PaperSize.PageOrientation;
ticket.PageMediaSize = MyDocument.PaperSize.PageMediaSize;
XpsDocumentWriter writer = PrintQueue.CreateXpsDocumentWriter(printDialog.PrintQueue);
writer.WritingPrintTicketRequired += (s, printTicketEvent) => { printTicketEvent.CurrentPrintTicket = ticket; };
MyDocument.PrintTo(writer);
}
You can also set the PrintTicket more directly and not use the event, but I had some trouble with driver compatibility that caused me to do it this way instead.
Ray Burns
2009-11-12 07:21:39