Hi Iulian,
Thank you for your interest in Syncfusion products.
Convert HTML code to pdf We can able to convert HTML code to pdf using FromString(string html, ImageType type, int width, int height) method.
Kindly refer the below code snippet which helps to convert HTML code to pdf.
string htmlCode = "<html> <body> <font color='#FF0000F'>PDF stands for Portable Document Format </font> </body> </html>";
//Create a PDF document
PdfDocument doc = new PdfDocument();
//Add a page
PdfPage page = doc.Pages.Add();
PdfUnitConvertor convertor = new PdfUnitConvertor();
float width = -1;
float height = -1;
//Calculates the height and width of the pdf image
AspectRatio dimension = AspectRatio.None;
//Create a html converter.
HtmlConverter html = new HtmlConverter();
//Convert html to image
Image image = html.FromString(htmlCode, Path.GetFullPath(txtUrl.Text), ImageType.Metafile, (int)width, (int)height, dimension);
//Create a pdf metafile.
PdfMetafile mf = new PdfMetafile(image as Metafile);
mf.Quality = 100;
PdfMetafileLayoutFormat format = new PdfMetafileLayoutFormat();
format.Break = PdfLayoutBreakType.FitPage;
format.Layout = PdfLayoutType.Paginate;
//Draw the metafile
mf.Draw(page, new Point(0, 0), format);
//Save the document.
doc.Save("Sample.pdf");
Please do find the sample from the below specified location which demonstrates how to convert HTML code to pdf and let me know if this helps,
http://files.syncfusion.com/support/PDF.Windows/F89490/HtmltoPdf.zipRegards,
Thiru