Hi,
if you want to follow your first way with "printto" Verb in process the only way to cancel printing is to Kill() your process.
For second way do you had a view into your saved file and it's right encoded?
It seems you're using the
doc_PrintPage
method from msdn example, I would put
Font printFont = new Font(FontFamily.GenericSerif, 12);
back before creating a new PrintDocument and declare the font
printFont = new Font("Arial", 10);
Does this Code work?
private void printButton_Click(object sender, EventArgs e)
{
try
{
streamToPrint = new StreamReader
("C:\\My Documents\\MyFile.txt");
try
{
printFont = new Font("Arial", 10);
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler
(this.pd_PrintPage);
pd.Print();
}
finally
{
streamToPrint.Close();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Well, exactly a similar CP Article.
Print HTML in C# with or without the web browser control and the print dialog[
^]
With Best Regards