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 - defected corners

Thread ID:





97279 Nov 15,2010 05:13 AM UTC Nov 18,2010 01:19 PM UTC ASP.NET Web Forms (Classic) 1
Tags: PDF
Michael Tse
Asked On November 15, 2010 05:13 AM UTC


I am using HtmlConverter to create PDF from my own web page. It looks good except that the left-bottom corner of every box border has the same defect. The line being drawn to the corner is a bit over-extended and drew over the tip of the box. It happens to the Metafile option only. PDF generated with the ImageType as Bitmap doesn't has this issue. Unfortunately, the resolution of Bitmap option is not good enough for my business need. The following is the code to recreate the attached PDF, which can show you what I mean the defect corner is.

string s = "
Hello world


PdfDocument doc = new PdfDocument();
doc.PageSettings.Orientation = PdfPageOrientation.Portrait;
PdfPage page = doc.Pages.Add();
SizeF pageSize = page.GetClientSize();
PdfUnitConvertor unitConvertor = new PdfUnitConvertor();
float pageWidth = unitConvertor.ConvertToPixels(page.GetClientSize().Width, PdfGraphicsUnit.Point);

using (HtmlConverter cv = new HtmlConverter())
cv.EnableJavaScript = false;
cv.AutoDetectPageBreak = true;
cv.EnableHyperlinks = false;

string baseUrl = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath + "/";

HtmlToPdfResult hpresult = cv.Convert(s, baseUrl, ImageType.Metafile, (int)pageWidth, -1, AspectRatio.KeepWidth);
if (hpresult != null)
PdfMetafile mf = new PdfMetafile(hpresult.RenderedImage as Metafile);
mf.Quality = 100;
PdfMetafileLayoutFormat format = new PdfMetafileLayoutFormat();
format.Break = PdfLayoutBreakType.FitElement;
format.Layout = PdfLayoutType.Paginate;
doc.PageSettings.Height = hpresult.RenderedImage.Size.Height;
format.SplitTextLines = false;
format.SplitImages = true;

hpresult.Render(page, format);
doc.Save("hello.pdf", Response, HttpReadType.Open);


defected corner_12216ac.zip

Priyadharshini J [Syncfusion]
Replied On November 18, 2010 01:19 PM UTC

Hi Michael,

Thank you for your interest in syncfusion products.

Could you please report this issue through Direct Trac Developer Support System, by visting https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents because you can take the advantage of the expertise of a dedicated support engineer and a guaranteed response time. We hope you will take advantage of this system as well.

Please let us know if you have any queries.



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

or the page will be automatically redirected to 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