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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

HTML to PDF - defected corners

Thread ID:

Created:

Updated:

Platform:

Replies:

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

Hi,

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

Testing
";

PdfDocument doc = new PdfDocument();
doc.PageSettings.SetMargins(30.0f);
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);
}
}


Regards,
Michael







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.

Regards,
Priyadharshini


CONFIRMATION

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.

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

;