We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

HTML to PDF works not good

Hi,

I want to convert file html to pdf, and it doesnt work good.
I was converted file: wall_321819.html
http://www29.zippyshare.com/v/qIQuSAWt/file.html

I use this code:
{
string dataDir = Path.GetFullPath("…/…/…/Data/");
Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
Aspose.Pdf.Generator.Section sec = pdf.Sections.Add();

sec.PageInfo.PageWidth = Aspose.Pdf.Generator.PageSize.A3Width;
sec.PageInfo.PageHeight = Aspose.Pdf.Generator.PageSize.A3Height;
sec.IsLandscape = true;

StreamReader r = File.OpenText(“L:/Temp/wall_321819.html”);
Aspose.Pdf.Generator.Text text2 = new Aspose.Pdf.Generator.Text(sec, r.ReadToEnd());
text2.IsHtmlTagSupported = true;
sec.Paragraphs.Add(text2);
pdf.Save(dataDir + “HTMLpdf.pdf”);
}

I added 3 file.
It looks different.
My file .html is not good?

Hi Mihal,


Thanks for your inquiry. I am afraid I am unable to download your shared HTML file for testing as it is showing 0 KB size. Please share it again, you can zip the html file or change its extension to html and share here in forum post.

Furthermore, you are using old generator code, it is recommend to use new DOM approach for HTML to PDF conversion, it is more improved and efficient. Please check following documentation link for details and sample code snippet. You can use PageInfo object of HtmlLoadOptions class to set page size and margins.


We are sorry for the inconvenience.

Best Regards,

This file have 4kb size, but i add new file in format .rar


I think i used code with this side: http://www.aspose.com/docs/display/pdfnet/Convert+HTML+to+PDF+Format

I remember, something went wrong, but now J can’t test code again, and show you error.

Hi Mihal,


Thanks for sharing your source document. I have tested the scenario with new DOM approach for HTML to PDF conversion using Aspose.Pdf for .NET 11.0.0 and noticed that the output is not as expected, some unwanted vertical dashed lines are appearing in resultant PDF. So I have logged a ticket PDFNEWNET-39756 in our issue tracking system for further investigation and rectification. We will notify you as soon as it is resolved.

Document pdfDocument = new Document(@“wall_321819.html”, new HtmlLoadOptions());<o:p></o:p>

pdfDocument.Save(myDir + "HTMLtoPDF_DOM.pdf");


We are sorry for the inconvenience caused.

Best Regards,

This code doesn’t work in my computer.

I have this error:

Hi Mihal,


Thanks for your inquiry. It seems you are evaluating Aspose.Pdf for .NET without a license. Please note Aspose.Pdf
evaluation version has two limitations, evaluation watermark and at most
four elements of any collection can be viewed. Please make a request for 30
days temporary license to evaluate our product without
any limitation. Hopefully your issue will be resolved.

Please feel free to contact us for any further assistance.

Best Regards,

I have full license, but this code I am testing without license.

I will try use this code with full license.
Thank you for answer.

Ok, i used license and problem was solved.

Thank you

Hi Mihal,


Thanks for the acknowledgement. When using the API without license, there is limitation in terms of number of objects that can be processed with API. Should you have any further query, please feel free to contact.