I just encountered another interesting situation:
(Using the CADEDITOR Demo / 8.1)
1) Trying to print a drawing the Custom Print Preview seems to change the drawing. The page dimensions seem to be changed?
2) I'm Trying to add a Footer to the print output with drawing it on the Printpage Event into the graphics part (Code below.) I can't get the real dimensions of the page when using the Custom Print Dialog, With the normal dialog it's working, but I can't print the whole Image...
My Test Code:
Code: Select all
private void miPrintPreview_Click(object sender, System.EventArgs e)
{
//this.DoExtentsForPrint();
//this.prtForm.TypePage = CADImport.Printing.DrawingSize.Fit;
//prtForm.VisibleRectangle = ImageRectangleF;
//printPrevDlg.Document = prtForm.Print(false);
//printPrevDlg.ShowDialog();
//if(printPrevDlg.Document != null)
// printPrevDlg.Document.Dispose();
printPrevDlg.Document = cadImage.Print(false, false, null);
printPrevDlg.Document.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(PrintDocument_PrintPage);
try
{
printPrevDlg.ShowDialog();
}
catch (Exception e1)
{
MessageBox.Show(string.Format("{0}", e1.Message), "CADImport Net", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
if (printPrevDlg.Document != null)
printPrevDlg.Document.Dispose();
}
private void miPrintCustom_Click(object sender, System.EventArgs e)
{
DoExtentsForPrint();
prtForm.PrintDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(PrintDocument_PrintPage);
prtForm.ShowDialog();
}
void PrintDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.DrawRectangle(Pens.Red, e.MarginBounds);
Rectangle rect = new Rectangle(e.MarginBounds.Left, e.MarginBounds.Bottom - 100, e.MarginBounds.Width, 100);
e.Graphics.FillRectangle(Brushes.Gray, rect);
}
thank you
Roman