A
Abhay
private void pd_PrintPage(object sender, PrintPageEventArgs e)
{
RectangleF objR = new RectangleF();
PrintDocument pd = (PrintDocument)sender;
float fT, fB, fL, fR;
//GET THE BEST POSSIBLE TOP MARGIN
if ((float)e.MarginBounds.Top >=
pd.PrinterSettings.DefaultPageSettings.PrintableArea.Top)
{
fT = (float)e.MarginBounds.Top;
}
else
{
fT =
pd.PrinterSettings.DefaultPageSettings.PrintableArea.Top;
}
//GET THE BEST POSSIBLE LEFT MARGIN
if ((float)e.MarginBounds.Left >=
pd.PrinterSettings.DefaultPageSettings.PrintableArea.Left)
{
fL = (float)e.MarginBounds.Left;
}
else
{
fL =
pd.PrinterSettings.DefaultPageSettings.PrintableArea.Left;
}
//GET THE BEST POSSIBLE BOTTOM MARGIN
if ((float)e.MarginBounds.Bottom <=
pd.PrinterSettings.DefaultPageSettings.PrintableArea.Bottom)
{
fB = (float)e.MarginBounds.Bottom;
}
else
{
fB =
pd.PrinterSettings.DefaultPageSettings.PrintableArea.Bottom;
}
//GET THE BEST POSSIBLE RIGHT MARGIN
if ((float)e.MarginBounds.Right <=
pd.PrinterSettings.DefaultPageSettings.PrintableArea.Right)
{
fR = (float)e.MarginBounds.Right;
}
else
{
fR =
pd.PrinterSettings.DefaultPageSettings.PrintableArea.Right;
}
objR.Location = new PointF(fL, fT);
objR.Height = fB - fT;
objR.Width = fR - fL;
e.Graphics.DrawRectangle(Pens.Black, objR.Left , objR.Top ,
objR.Width , objR.Height );
}
i want to utilize the whole printable area to print a rectangle
(creating some vouchers) when i go and print i dont get the RIGHT and
BOTTOM margins the left and top are perfect
whats the reason ??
{
RectangleF objR = new RectangleF();
PrintDocument pd = (PrintDocument)sender;
float fT, fB, fL, fR;
//GET THE BEST POSSIBLE TOP MARGIN
if ((float)e.MarginBounds.Top >=
pd.PrinterSettings.DefaultPageSettings.PrintableArea.Top)
{
fT = (float)e.MarginBounds.Top;
}
else
{
fT =
pd.PrinterSettings.DefaultPageSettings.PrintableArea.Top;
}
//GET THE BEST POSSIBLE LEFT MARGIN
if ((float)e.MarginBounds.Left >=
pd.PrinterSettings.DefaultPageSettings.PrintableArea.Left)
{
fL = (float)e.MarginBounds.Left;
}
else
{
fL =
pd.PrinterSettings.DefaultPageSettings.PrintableArea.Left;
}
//GET THE BEST POSSIBLE BOTTOM MARGIN
if ((float)e.MarginBounds.Bottom <=
pd.PrinterSettings.DefaultPageSettings.PrintableArea.Bottom)
{
fB = (float)e.MarginBounds.Bottom;
}
else
{
fB =
pd.PrinterSettings.DefaultPageSettings.PrintableArea.Bottom;
}
//GET THE BEST POSSIBLE RIGHT MARGIN
if ((float)e.MarginBounds.Right <=
pd.PrinterSettings.DefaultPageSettings.PrintableArea.Right)
{
fR = (float)e.MarginBounds.Right;
}
else
{
fR =
pd.PrinterSettings.DefaultPageSettings.PrintableArea.Right;
}
objR.Location = new PointF(fL, fT);
objR.Height = fB - fT;
objR.Width = fR - fL;
e.Graphics.DrawRectangle(Pens.Black, objR.Left , objR.Top ,
objR.Width , objR.Height );
}
i want to utilize the whole printable area to print a rectangle
(creating some vouchers) when i go and print i dont get the RIGHT and
BOTTOM margins the left and top are perfect
whats the reason ??