J
Jen
I am trying to print barcode labels directly to a Sato label printer.
The problem that I am having is that the MarginBound properties are
set to one inch margins. I cannot seem to figure out when and where
these properties are being set. I am using the following code,
pDlgBarcode is a PrintDialog control. I have a PrintDocument attached
to the PrintDialog control. It prints one inch from the left edge. My
little labels are only 2" wide. Thanks for any help.
Jennifer
private void PrintBarcode()
{
if(DialogResult.OK == pDlgBarcode.ShowDialog())
{
pDlgBarcode.Document.Print();
}
}
private void pDocBarcode_PrintPage(object sender,
System.Drawing.Printing.PrintPageEventArgs e)
{
//They can only print one part at a time from this screen.
Barcode bc = new Barcode();
double dLabelHeight = e.PageSettings.PaperSize.Height;
double dLabelWidth = e.PageSettings.PaperSize.Width;
bool bLarge = false;
Brush bBrush = Brushes.Black;
int iLineSpace = 0;
int iLineAt = 0;
Font fFont;
if(dLabelWidth > 200 && dLabelHeight > 150)
bLarge = true;
if(bLarge == true)
{
fFont = new Font("Times New Roman", 18, FontStyle.Regular,
GraphicsUnit.Point);
iLineSpace = 50;
}
else
{
fFont = new Font("Times New Roman", 7, FontStyle.Regular,
GraphicsUnit.Point);
iLineSpace = 13;
}
//Print Barcode text
GetBarcodeInfo();
e.Graphics.DrawString(msDescription, fFont, bBrush, 0,
iLineAt); //Description
iLineAt += iLineSpace;
e.Graphics.DrawString("VPN#"+msVPN, fFont, bBrush, 0,
iLineAt); //VPN#
iLineAt += iLineSpace;
e.Graphics.DrawString("SN#"+msSN, fFont, bBrush, 0, iLineAt); //SN#
iLineAt += iLineSpace;
e.Graphics.DrawString("ORD#"+msOrder+msLoc+msShelfLife,
fFont, bBrush, 0, iLineAt); //ORD# Loc SLL
e.HasMorePages = false;
}
The problem that I am having is that the MarginBound properties are
set to one inch margins. I cannot seem to figure out when and where
these properties are being set. I am using the following code,
pDlgBarcode is a PrintDialog control. I have a PrintDocument attached
to the PrintDialog control. It prints one inch from the left edge. My
little labels are only 2" wide. Thanks for any help.
Jennifer
private void PrintBarcode()
{
if(DialogResult.OK == pDlgBarcode.ShowDialog())
{
pDlgBarcode.Document.Print();
}
}
private void pDocBarcode_PrintPage(object sender,
System.Drawing.Printing.PrintPageEventArgs e)
{
//They can only print one part at a time from this screen.
Barcode bc = new Barcode();
double dLabelHeight = e.PageSettings.PaperSize.Height;
double dLabelWidth = e.PageSettings.PaperSize.Width;
bool bLarge = false;
Brush bBrush = Brushes.Black;
int iLineSpace = 0;
int iLineAt = 0;
Font fFont;
if(dLabelWidth > 200 && dLabelHeight > 150)
bLarge = true;
if(bLarge == true)
{
fFont = new Font("Times New Roman", 18, FontStyle.Regular,
GraphicsUnit.Point);
iLineSpace = 50;
}
else
{
fFont = new Font("Times New Roman", 7, FontStyle.Regular,
GraphicsUnit.Point);
iLineSpace = 13;
}
//Print Barcode text
GetBarcodeInfo();
e.Graphics.DrawString(msDescription, fFont, bBrush, 0,
iLineAt); //Description
iLineAt += iLineSpace;
e.Graphics.DrawString("VPN#"+msVPN, fFont, bBrush, 0,
iLineAt); //VPN#
iLineAt += iLineSpace;
e.Graphics.DrawString("SN#"+msSN, fFont, bBrush, 0, iLineAt); //SN#
iLineAt += iLineSpace;
e.Graphics.DrawString("ORD#"+msOrder+msLoc+msShelfLife,
fFont, bBrush, 0, iLineAt); //ORD# Loc SLL
e.HasMorePages = false;
}