Hi,
I have been tasked to find an easy solution to convert Html pages to Pdf files and your product seemed to be exactly what we needed so I went ahead and tried your exemple here.
Sadly the result was not what I expected as I was presented with a blank Pdf file (with a size of 0Ko) although I only did a simple Copy/Past or your presented solution.
I also tried my own simple implementation
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(PathUrl);
request.Timeout = 10000;
Encoding encoding = Encoding.GetEncoding(1252);
using (HttpWebResponse localWebResponse = (HttpWebResponse)request.GetResponse())
using (StreamReader localResponseStream = new StreamReader(localWebResponse.GetResponseStream(), encoding))
{
Pdf pdfGenerator = new Pdf();
Section section = pdfGenerator.Sections.Add();
Text textGenerator = new Text(section, localResponseStream.ReadToEnd())
{
IsHtmlTagSupported = true
};
section.Paragraphs.Add(textGenerator);
pdfGenerator.HtmlInfo.ExternalResourcesBasePath = PathUrl.Substring(0, PathUrl.IndexOf('/', 10) + 1);
pdfGenerator.HtmlInfo.ImgUrl = pdfGenerator.HtmlInfo.ExternalResourcesBasePath;
pdfGenerator.Save(_outputFile);
}
With the almost the same result, some pages giving empty Pdf file (http://www.google.com, http://en.wikipedia.org/wiki/Main_Page), some giving almost the expected result (http://www.w3schools.com/html/default.asp) and some even giving a StackOverflow exception (http://www.neogaf.com/forum/forumdisplay.php?f=2).
Am I doing something horribly wrong, did I miss anything ?
With Visual Studio 2010 SP1, .NET Frameword 4.0, Any CPU, Windows 7 64Bits.