این هم نمونه کد های من
public void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
// create brush...
StringFormat format = new StringFormat(StringFormatFlags.FitBlackBox | StringFormatFlags.DirectionRightToLeft);
SolidBrush brush1 = new SolidBrush(Color.Black);
SolidBrush brush2 = new SolidBrush(Color.DarkGreen);
Font font1 = new Font(Pro.Default.DocFontName, Pro.Default.DocFontSize);
Font font2 = new Font(Pro.Default.DocFontName, Pro.Default.DocFontSize, FontStyle.Bold);
Pen pen = new Pen(new SolidBrush(Color.Black), 2.0F);
RectangleF rec = e.PageSettings.Bounds;
rec.Width -= (e.PageSettings.Margins.Left + e.PageSettings.Margins.Right);
float height = e.Graphics.MeasureString("بند 1:", font2, (int)rec.Width, format).Height;
/*----------------------------Title------------------------------*/
// draw Logo
if (Pro.Default.DocIsLogo & System.IO.File.Exists(Application.StartupPath + @"\logo.jpg"))
{
format.Alignment = StringAlignment.Center;
e.Graphics.DrawImage(new Bitmap(Application.StartupPath + @"\logo.jpg"), (rec.Width / 2) - 35, rec.Y, 70, 70);
rec.Y += 50;
}
format.Alignment = StringAlignment.Center;
e.Graphics.DrawString("فرم قرارداد", new Font("IranNastaliq", 45), brush2, rec, format);
rec.Y += e.Graphics.MeasureString("فرم قرارداد", new Font("IranNastaliq", 45), e.PageBounds.Width, format).Height + 10;
e.HasMorePages = true;
{