We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

HTML to PDF in earlier version?

Thread ID:





90501 Oct 5,2009 09:33 PM UTC Oct 9,2009 11:41 AM UTC ASP.NET Web Forms (Classic) 5
Tags: PDF
Jesse Robbins
Asked On October 5, 2009 09:33 PM UTC


Is there a way in a previous version of syncfusion (6.3) to be able to take an html string and convert to PDF?

Many thanks,

Jesse Robbins

Sri Subhashini M [Syncfusion]
Replied On October 6, 2009 07:30 AM UTC

Hi Jesse,

Thank you for your interest in Essential PDF.

We can convert a HTML content as PDF document using the method FromString() in previous version of Essential PDF (6.3). We recommend you to upgrade to our latest version. We have very good support for HTML to PDF in this version.

Please let me know if you need any further assistance.


Jesse Robbins
Replied On October 6, 2009 02:20 PM UTC

Can you please give me an example of this? Does this use HTMLConverter? If so, what namespace is this using (i.e. System.PDF) in version



Sri Subhashini M [Syncfusion]
Replied On October 7, 2009 01:35 PM UTC

Hi Jesse,

Could you please do find the sample which demonstrates the FromString() method and let me know if this helps?



Jesse Robbins
Replied On October 7, 2009 06:54 PM UTC


Please see error (attached) and code snippet below.

private void GeneratePDF(HttpResponse httpResponse, string PDFPass, string PayYear, string P11D)
//Create P11D PDF Document

PdfDocument doc = new PdfDocument();

//Add Page
PdfPage page = doc.Pages.Add();
SizeF pageSize = page.GetClientSize();

//PdfSolidBrush brush = new PdfSolidBrush(Color.Black);
//PdfPen pen = new PdfPen(Color.Black, 1f);

//Set font
//PdfFont font1 = new PdfStandardFont(PdfFontFamily.Helvetica, 8);

//Set Page Dimensions
//page.Section.PageSettings.Orientation = PdfPageOrientation.Portrait;
//page.Section.PageSettings.Margins.Bottom = 0;
//page.Section.PageSettings.Margins.Left = 15;
//page.Section.PageSettings.Margins.Right = 15;
//page.Section.PageSettings.Margins.Top = 0;

PdfUnitConvertor converter = new PdfUnitConvertor();
float width = converter.ConvertToPixels(page.GetClientSize().Width, PdfGraphicsUnit.Point);

//Draw Logo
//string ImagePath = Server.MapPath("..\\Images\\");
//PdfGraphics g = page.Graphics;
//PdfImage pdfImage = new PdfBitmap(ImagePath + "\\urgbx1.jpg");
//g.DrawImage(pdfImage, 5, 20, 69, 24);

HtmlConverter html = new HtmlConverter();
Image img = html.FromString(P11D, ImageType.Metafile);

//PdfMetafile metafile = (PdfMetafile)PdfImage.FromImage(img);
//PdfMetafileLayoutFormat format = new PdfMetafileLayoutFormat();
//format.Break = PdfLayoutBreakType.FitPage;
//format.Layout = PdfLayoutType.Paginate;
//doc.PageSettings.Height = img.Height;
//format.SplitTextLines = false;
//metafile.Draw(page, new RectangleF(0, 25, pageSize.Width, -1), format);

doc.Security.UserPassword = PDFPass;
doc.Save("P11D_" + PayYear + ".pdf", httpResponse, HttpReadType.Save);


The above code is failing at assigning the new IMage to the FromString conversion. Can you please assist?




Thiruvenkadam E [Syncfusion]
Replied On October 9, 2009 11:41 AM UTC

Hi Jesse,

I regret for the long delay in getting back to you on this.


I am afraid that I was not able to reproduce the reported issue in our side . Please check the working sample in the link below location ,


Please have a look at the above sample and if still the issue exists,

Could you please try to reproducing it in the above sample or send us few html files or html text so that we could sort out the cause of the issue and provide you a solution?

Please let us know if you need any further information.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon