Modfying Print Document
-
Hi everyone; I want to add some information on my print document. To be precise I'm printing my DataGridView like this:
private void button5_Click(object sender, EventArgs e)//YAZDIR
{
if (SetupThePrinting())
MyPrintDocument.Print();
}private bool SetupThePrinting()
{
PrintDialog MyPrintDialog = new PrintDialog();
MyPrintDialog.AllowCurrentPage = false;
MyPrintDialog.AllowPrintToFile = false;
MyPrintDialog.AllowSelection = false;
MyPrintDialog.AllowSomePages = false;
MyPrintDialog.PrintToFile = false;
MyPrintDialog.ShowHelp = false;
MyPrintDialog.ShowNetwork = false;if (MyPrintDialog.ShowDialog() != DialogResult.OK) return false; MyPrintDocument.DocumentName = "Customers Report"; MyPrintDocument.PrinterSettings = MyPrintDialog.PrinterSettings; MyPrintDocument.DefaultPageSettings = MyPrintDialog.PrinterSettings.DefaultPageSettings; MyPrintDocument.DefaultPageSettings.Margins = new Margins(40, 40, 40, 40); if (MessageBox.Show("Verilerin sayfaya ortalanmasını istiyor musunuz?", "Baskı Özellikleri - Sayfa Ortalama", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) MyDataGridViewPrinter = new DataGridViewPrinter(dbGridView, MyPrintDocument, true, true, "KASA DÖKÜMÜ\\n\\nbakiye:"+label17.Text+" gelir:"+label19.Text+" gider:"+label18.Text+"", new Font("Tahoma", 10, FontStyle.Bold, GraphicsUnit.Point), Color.Black, true); else MyDataGridViewPrinter = new DataGridViewPrinter(dbGridView, MyPrintDocument, false, true, "KASA DÖKÜMÜ\\n\\nbakiye:"+label17.Text+" gelir:"+label19.Text+" gider:"+label18.Text+"", new Font("Tahoma", 10, FontStyle.Bold, GraphicsUnit.Point), Color.Black, true); return true; }
So, I need to make two changes: 1. I need to add a line to the end of the document to put the information on my label#'s, how to put this line properly ( if possible such as:
"The information is" +label7.text+ "
format) 2. Because of the number of columns, my document prints 6 pages for a 3-paged information. also uses first 3 pages for first 4 columns, and the last 3 pages for the rest of the columns. Reducing the character size in the print document could be a solution, but I don't know how to do that either. Can anybo -
Hi everyone; I want to add some information on my print document. To be precise I'm printing my DataGridView like this:
private void button5_Click(object sender, EventArgs e)//YAZDIR
{
if (SetupThePrinting())
MyPrintDocument.Print();
}private bool SetupThePrinting()
{
PrintDialog MyPrintDialog = new PrintDialog();
MyPrintDialog.AllowCurrentPage = false;
MyPrintDialog.AllowPrintToFile = false;
MyPrintDialog.AllowSelection = false;
MyPrintDialog.AllowSomePages = false;
MyPrintDialog.PrintToFile = false;
MyPrintDialog.ShowHelp = false;
MyPrintDialog.ShowNetwork = false;if (MyPrintDialog.ShowDialog() != DialogResult.OK) return false; MyPrintDocument.DocumentName = "Customers Report"; MyPrintDocument.PrinterSettings = MyPrintDialog.PrinterSettings; MyPrintDocument.DefaultPageSettings = MyPrintDialog.PrinterSettings.DefaultPageSettings; MyPrintDocument.DefaultPageSettings.Margins = new Margins(40, 40, 40, 40); if (MessageBox.Show("Verilerin sayfaya ortalanmasını istiyor musunuz?", "Baskı Özellikleri - Sayfa Ortalama", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) MyDataGridViewPrinter = new DataGridViewPrinter(dbGridView, MyPrintDocument, true, true, "KASA DÖKÜMÜ\\n\\nbakiye:"+label17.Text+" gelir:"+label19.Text+" gider:"+label18.Text+"", new Font("Tahoma", 10, FontStyle.Bold, GraphicsUnit.Point), Color.Black, true); else MyDataGridViewPrinter = new DataGridViewPrinter(dbGridView, MyPrintDocument, false, true, "KASA DÖKÜMÜ\\n\\nbakiye:"+label17.Text+" gelir:"+label19.Text+" gider:"+label18.Text+"", new Font("Tahoma", 10, FontStyle.Bold, GraphicsUnit.Point), Color.Black, true); return true; }
So, I need to make two changes: 1. I need to add a line to the end of the document to put the information on my label#'s, how to put this line properly ( if possible such as:
"The information is" +label7.text+ "
format) 2. Because of the number of columns, my document prints 6 pages for a 3-paged information. also uses first 3 pages for first 4 columns, and the last 3 pages for the rest of the columns. Reducing the character size in the print document could be a solution, but I don't know how to do that either. Can anybo -
probably using PrintPage event from PrintDocument: http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx[^]
Thank you but it seems like PrintPage event is more likely used for adjusting the margins or determining the printable boundaries; generally features about the document. I think I just need to decrease the font size of the text in the printed document. any idea?
-
Hi everyone; I want to add some information on my print document. To be precise I'm printing my DataGridView like this:
private void button5_Click(object sender, EventArgs e)//YAZDIR
{
if (SetupThePrinting())
MyPrintDocument.Print();
}private bool SetupThePrinting()
{
PrintDialog MyPrintDialog = new PrintDialog();
MyPrintDialog.AllowCurrentPage = false;
MyPrintDialog.AllowPrintToFile = false;
MyPrintDialog.AllowSelection = false;
MyPrintDialog.AllowSomePages = false;
MyPrintDialog.PrintToFile = false;
MyPrintDialog.ShowHelp = false;
MyPrintDialog.ShowNetwork = false;if (MyPrintDialog.ShowDialog() != DialogResult.OK) return false; MyPrintDocument.DocumentName = "Customers Report"; MyPrintDocument.PrinterSettings = MyPrintDialog.PrinterSettings; MyPrintDocument.DefaultPageSettings = MyPrintDialog.PrinterSettings.DefaultPageSettings; MyPrintDocument.DefaultPageSettings.Margins = new Margins(40, 40, 40, 40); if (MessageBox.Show("Verilerin sayfaya ortalanmasını istiyor musunuz?", "Baskı Özellikleri - Sayfa Ortalama", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) MyDataGridViewPrinter = new DataGridViewPrinter(dbGridView, MyPrintDocument, true, true, "KASA DÖKÜMÜ\\n\\nbakiye:"+label17.Text+" gelir:"+label19.Text+" gider:"+label18.Text+"", new Font("Tahoma", 10, FontStyle.Bold, GraphicsUnit.Point), Color.Black, true); else MyDataGridViewPrinter = new DataGridViewPrinter(dbGridView, MyPrintDocument, false, true, "KASA DÖKÜMÜ\\n\\nbakiye:"+label17.Text+" gelir:"+label19.Text+" gider:"+label18.Text+"", new Font("Tahoma", 10, FontStyle.Bold, GraphicsUnit.Point), Color.Black, true); return true; }
So, I need to make two changes: 1. I need to add a line to the end of the document to put the information on my label#'s, how to put this line properly ( if possible such as:
"The information is" +label7.text+ "
format) 2. Because of the number of columns, my document prints 6 pages for a 3-paged information. also uses first 3 pages for first 4 columns, and the last 3 pages for the rest of the columns. Reducing the character size in the print document could be a solution, but I don't know how to do that either. Can anybono one :( ?
-
Thank you but it seems like PrintPage event is more likely used for adjusting the margins or determining the printable boundaries; generally features about the document. I think I just need to decrease the font size of the text in the printed document. any idea?