I am using the following code to convert a html file(a.html) to b pdf file(b.pdf) using Acroat PDF Writer.
Please note that I used 'b' for the pdf file name instead of 'b.pdf' since I thought that 'Acrobat PDF Writer' will automatically convert the file to PDF format.
When I run the following code, I see 2 problems.
1. 'b.pdf' file is created. However, the file 'a'(with no type. when I open its property window 'type of file' is jsut 'file') is created as well.
2. When I open 'b.pdf' file, I don't see any content from a.html. It just displays unreadable characters on 'b.pdf'. No chart or report from 'a.html' is displayed in 'b.pdf'.
What should I do to resolve these two problems?
private void button1_Click(object sender, EventArgs e)
printDocument.PrinterSettings.PrinterName = "Acrobat PDFWriter";
printDocument.PrinterSettings.PrintToFile = true;
printDocument.PrinterSettings.PrintFileName = @"C:\b";
catch (Exception err)
private void printDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
objSr = new StreamReader(@"C:\a.html");
Font printFont = new Font("Arial", 10);