I have this method that should generate what I need to print:
private void myPrintDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.PageUnit = GraphicsUnit.Inch;
e.Graphics.DrawImage(makeBarcode(), 500, 1000);
e.Graphics.DrawString("Do Not Seperate", makeFont(), Brushes.Black, 100, 2);
e.Graphics.DrawString("Choking Hazard", makeFont(), Brushes.Black, 200, 2);
}
How ever when I print it, it comes up blanks and when I look at it in PrintPreviewDialog it comes up blanket. What I am missing here?
This is my constructor by the way:
public Form1()
{
InitializeComponent();
this.myPrintDocument.PrintPage += new
System.Drawing.Printing.PrintPageEventHandler
(this.myPrintDocument_PrintPage);
}
For Mark
private Image makeBarcode()
{
InventoryBLL ibll = new InventoryBLL();
Barcode b = new Barcode();
b.IncludeLabel = true;
b.Height = 35;
b.Width = 200;
b.BackColor = Color.White;
b.ForeColor = Color.Black;
b.Alignment = BarcodeLib.AlignmentPositions.CENTER;
return b.Encode(TYPE.CODE128, ibll.getFNSKU(txtASIN.Text));
}
private Font makeFont()
{
Font myFont = new Font("arial", 10);
return myFont;
}
e.Graphics.PageUnit = GraphicsUnit.Inch;
...
e.Graphics.DrawString("Choking Hazard", ..., 200, 2);
That string is going to print at 200 inches. Somewhat safe to assume that your paper isn't that big, 8 inch is about typical. You cannot see what's off the paper. Consider changing the PageUnit or using much smaller floating point print positions.