public static void Print()
{
const string printerName =
"Microsoft Office Document Image Writer";
if (m_streams == null || m_streams.Count == 0)
return;
PrintDocument printDoc = new PrintDocument();
printDoc.PrinterSettings.PrinterName = printerName;
if (!printDoc.PrinterSettings.IsValid)
{
string msg = String.Format(
"Can't find printer \"{0}\".", printerName);
return;
}
printDoc.PrintPage += new PrintPageEventHandler(PrintPage);
printDoc.Print();
}
private static void PrintPage(object sender, PrintPageEventArgs ev)
{
Metafile PageImage = new Metafile(m_streams[m_currentPageIndex]);
ev.Graphics.DrawImage(PageImage, ev.PageBounds);
Debug.Print(m_currentPageIndex.ToString());
m_currentPageIndex++;
ev.HasMorePages = (m_currentPageIndex < m_streams.Count);
}
{
const string printerName =
"Microsoft Office Document Image Writer";
if (m_streams == null || m_streams.Count == 0)
return;
PrintDocument printDoc = new PrintDocument();
printDoc.PrinterSettings.PrinterName = printerName;
if (!printDoc.PrinterSettings.IsValid)
{
string msg = String.Format(
"Can't find printer \"{0}\".", printerName);
return;
}
printDoc.PrintPage += new PrintPageEventHandler(PrintPage);
printDoc.Print();
}
private static void PrintPage(object sender, PrintPageEventArgs ev)
{
Metafile PageImage = new Metafile(m_streams[m_currentPageIndex]);
ev.Graphics.DrawImage(PageImage, ev.PageBounds);
Debug.Print(m_currentPageIndex.ToString());
m_currentPageIndex++;
ev.HasMorePages = (m_currentPageIndex < m_streams.Count);
}