Products
PDFRasterizer.NET 3.0
Created
7/3/2014
Tags
Printing

void print() { index = 0;

PrintDocument printDocument = new PrintDocument(); printDocument.DocumentName = document.DocumentInfo.Title;

printDocument.DefaultPageSettings.Margins.Left = 0; printDocument.DefaultPageSettings.Margins.Top = 0; printDocument.OriginAtMargins = true;

PageSetupDialog setupDialog = new PageSetupDialog(); setupDialog.Document = printDocument;

if ( DialogResult.OK == setupDialog.ShowDialog() ) { printDocument.DefaultPageSettings = setupDialog.PageSettings; printDocument.PrinterSettings = setupDialog.PrinterSettings;

  printDocument.PrintPage += new PrintPageEventHandler( printPage );
  printDocument.Print();

} }

void printPage( object sender, PrintPageEventArgs e ) { e.Graphics.PageUnit = GraphicsUnit.Point;

Page page = document.Pages[ index++ ]; page.Draw( e.Graphics );

e.HasMorePages = index < document.Pages.Count; }]]>