hi,
this is the code i used earlier before i know that the printer was a pos. i saw the article you post read throught it. just download the sdk looking throu the sample now
Code:
System.IO.StreamReader fileToPrint;
System.Drawing.Font printFont;
protected void button1_Click(object sender, System.EventArgs e)
{
string printPath = System.Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); //System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
fileToPrint = new System.IO.StreamReader(printPath + @"\Kiosk2\printme.txt");
printFont = new System.Drawing.Font("Arial", 10);
printDocument1.Print();
fileToPrint.Close();
}
private void printDocument1_printPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
float yPos = 0f;
int count = 0;
float leftMargin = e.MarginBounds.Left;
float topMargin = e.MarginBounds.Top;
string line = null;
float linesPerPage = e.MarginBounds.Height/printFont.GetHeight(e.Graphics);
while (count < linesPerPage)
{
line = fileToPrint.ReadLine();
if (line == null)
{
break;
}
yPos = topMargin + count * printFont.GetHeight(e.Graphics);
e.Graphics.DrawString(line, printFont, Brushes.Black, leftMargin, yPos, new StringFormat());
count++;
}
if (line != null)
{
e.HasMorePages = true;
}
}