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 corner

Thread ID:

Created:

Updated:

Platform:

Replies:

97277 Nov 15,2010 05:11 AM UTC Nov 18,2010 01:19 PM UTC WinForms 2
loading
Tags: PDF
Michael Tse
Asked On November 15, 2010 05:11 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_c8c0e2ba.zip

Michael Tse
Replied On November 15, 2010 05:12 AM UTC

It was supposed to post this to the PDF ASP.NET forum. Now posted to there as well


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 vistinghttps://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

;