I am still trying out aspose pdf product. I was trying to convert a testing page to pdf, but the resulting pdf does not look like the webpage. Either the image did not get rendered, or the table is out of place, or there is gap that’s not supposed be there.
the url is “http://preview.shoom.com/InvoiceView/PDFTest1.htm
”… and i have attached the resulting pdf from my testing using aspose pdf library.
The code i used is as follows:
WebRequest request = WebRequest.Create(@“http://preview.shoom.com/InvoiceView/PDFTest1.htm”);
// If required by the server, set the credentials.
request.Credentials = CredentialCache.DefaultCredentials;
// time out in miliseconds before the request times out
request.Timeout = 10000;
// Get the response.
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
// Get the stream containing content returned by the server.
Stream dataStream = response.GetResponseStream();
// Open the stream using a StreamReader for easy access.
StreamReader reader = new StreamReader(dataStream);
// Read the content.
string responseFromServer = reader.ReadToEnd();
reader.Close();
dataStream.Close();
response.Close();
MemoryStream stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(responseFromServer));
HtmlLoadOptions options = new HtmlLoadOptions(@“http://preview.shoom.com/InvoiceView/”);
// Load HTML file
options.UseNewConversionEngine = true;
options.PageInfo.Margin.Bottom = 0;
options.PageInfo.Margin.Top = 0;
options.PageInfo.Margin.Right = 0;
options.PageInfo.Margin.Left = 0;
options.PageInfo.Height = Aspose.Pdf.Generator.PageSize.LetterHeight;
options.PageInfo.Width = Aspose.Pdf.Generator.PageSize.LetterWidth;
Aspose.Pdf.Document pdfDocumentAs = new Aspose.Pdf.Document(stream, options);
pdfDocumentAs.Save(@“c:\incoming\HTMLtoPDF_As_HAL.pdf”);
Please advise if this is a bug in your product. Thank you.