B
Bhavin Parekh
Hi Guys,
Can anyone help on this? Basically i want to send form feed to print two
string data on different page but some how its always printing in one
page...I used following code which is available on msdn site as example...
I tried /f, \f, with and without double slash as well but none of them is to
be working in c#.
private void pd_PrintPage(object sender, PrintPageEventArgs ev)
{
float linesPerPage = 0;
float yPos = 0;
int count = 0;
float leftMargin = ev.MarginBounds.Left;
float topMargin = ev.MarginBounds.Top;
leftMargin = 0;
topMargin = 0;
String line = null;
// Calculate the number of lines per page.
linesPerPage = ev.MarginBounds.Height /
printFont.GetHeight(ev.Graphics);
// Iterate over the file, printing each line.
line = "line11111111111111111111111111111";
yPos =20;
ev.Graphics.DrawString(line, printFont, Brushes.Black,leftMargin, yPos, new
StringFormat());
ev.HasMorePages = true;
yPos = 30;
string line2 = "line222222222222222222222222222";
ev.Graphics.DrawString(line2, printFont, Brushes.Black, leftMargin, yPos,
new StringFormat());
ev.HasMorePages = false;
}
below is button event code...
printFont = new Font("Arial", 8);
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);
pd.Print();
I dont want to use button event code to repeat or use in a loop if i will be
printing thousand pages it will slower the performance...
All i m looking whats the way to send form feed or page break in a data so
it prints remaining data into next page...
Any help would be appreciated...
Thnx
Can anyone help on this? Basically i want to send form feed to print two
string data on different page but some how its always printing in one
page...I used following code which is available on msdn site as example...
I tried /f, \f, with and without double slash as well but none of them is to
be working in c#.
private void pd_PrintPage(object sender, PrintPageEventArgs ev)
{
float linesPerPage = 0;
float yPos = 0;
int count = 0;
float leftMargin = ev.MarginBounds.Left;
float topMargin = ev.MarginBounds.Top;
leftMargin = 0;
topMargin = 0;
String line = null;
// Calculate the number of lines per page.
linesPerPage = ev.MarginBounds.Height /
printFont.GetHeight(ev.Graphics);
// Iterate over the file, printing each line.
line = "line11111111111111111111111111111";
yPos =20;
ev.Graphics.DrawString(line, printFont, Brushes.Black,leftMargin, yPos, new
StringFormat());
ev.HasMorePages = true;
yPos = 30;
string line2 = "line222222222222222222222222222";
ev.Graphics.DrawString(line2, printFont, Brushes.Black, leftMargin, yPos,
new StringFormat());
ev.HasMorePages = false;
}
below is button event code...
printFont = new Font("Arial", 8);
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);
pd.Print();
I dont want to use button event code to repeat or use in a loop if i will be
printing thousand pages it will slower the performance...
All i m looking whats the way to send form feed or page break in a data so
it prints remaining data into next page...
Any help would be appreciated...
Thnx