protected override void OnPrintPage(PrintPageEventArgs e)
{
base.OnPrintPage(e);
// Aspose.Words rendering engine creates a page that is drawn from the 0,0 of the paper,
// but there is some hard margin in the printer and the .NET printing framework
// renders from there. We need to offset by that hard margin.
// In .NET 1.1 the hard margin is not available programmatically, lets hardcode to about 4mm.
float hardOffsetX = 20;
float hardOffsetY = 20;
// This is in .NET 2.0 only. Uncomment when needed.
// float hardOffsetX = e.PageSettings.HardMarginX;
// float hardOffsetY = e.PageSettings.HardMarginY;
int pageIndex = this.mCurrentPage - 1;
this.mDocument.RenderToScale(this.mCurrentPage, e.Graphics, -hardOffsetX, -hardOffsetY, 1.0f);
this.mCurrentPage++;
e.HasMorePages = (this.mCurrentPage <= this.mPageTo);
}