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

Issue with HTML Page Height

Thread ID:





95078 Jun 18,2010 08:38 PM UTC Jun 24,2010 11:10 AM UTC ASP.NET Web Forms (Classic) 3
Tags: PDF
Matt Dixon
Asked On June 18, 2010 08:38 PM UTC

My page is getting cut off... I'm only getting the top part of the page in HTMLtoPDF instead of the 3 pages i'd expect to see.

This is what my code looks like:

PdfDocument doc = new PdfDocument();

//Set page margins

//Set page orientation
doc.PageSettings.Orientation = PdfPageOrientation.Portrait;

//Add a page
PdfPage page = doc.Pages.Add();

// Footer.
// Create a Template that can be used as a footer.
//Create a page template
RectangleF rect = new RectangleF(0, 0, doc.Pages[0].GetClientSize().Width, 50);
PdfPageTemplateElement footer = new PdfPageTemplateElement(rect);

//Creates a solid brush.
PdfBrush brush = new PdfSolidBrush(Color.Silver);
//Sets the font.

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

//Add the fields in composite fields
PdfCompositeField compositeField = new PdfCompositeField(font, brush, IKS.ConfigOptions.Config.Label.Get("LABEL_REPORT_GENERATED") + ": " + DateTime.Now.ToString());
compositeField.Bounds = footer.Bounds;

//Draw the composite field in footer
compositeField.Draw(footer.Graphics, new PointF(20, 20));
//Add the footer template at the bottom
//doc.Template.Bottom = footer;

SizeF pageSize = page.GetClientSize();

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

using (HtmlConverter html = new HtmlConverter())
// setting Javascript
html.EnableJavaScript = false;
// Setting Pagebreak
html.AutoDetectPageBreak = false;
// set hyperlink
html.EnableHyperlinks = false;

HtmlToPdfResult result;
if (ConfigurationManager.AppSettings.Get("REPORT_REQUIRES_SECURE_CONNECTION") == "1")
result = html.Convert(ConfigurationManager.AppSettings.Get("REPORT_EXECUTIVE_SUMMARY_PATH") + "?period=" + month + "&year=" + year + "&cat=" + category.Id, ImageType.Metafile, (int)width, -1, AspectRatio.KeepWidth, ConfigurationManager.AppSettings.Get("SECURE_CONNECTION_USERNAME"), ConfigurationManager.AppSettings.Get("SECURE_CONNECTION_PASSWORD"));

result = html.Convert(ConfigurationManager.AppSettings.Get("REPORT_EXECUTIVE_SUMMARY_PATH") + "?period=" + month + "&year=" + year + "&cat=" + category.Id, ImageType.Metafile, (int)width, -1, AspectRatio.KeepWidth);

if (result != null)
PdfMetafile mf = new PdfMetafile(result.RenderedImage as Metafile);
mf.Quality = 100;

PdfMetafileLayoutFormat format = new PdfMetafileLayoutFormat();
format.Break = PdfLayoutBreakType.FitPage;
format.Layout = PdfLayoutType.Paginate;

format.SplitTextLines = true;
format.SplitImages = false;

result.Render(page, format);
Response.Write("Warning ! Please check the HTML link");

return doc;

This is an ASPX page, not an HTML page. All controls are in an unstyled div. Thanks.

Angappan G [Syncfusion]
Replied On June 22, 2010 02:45 PM UTC

Hi Matt,

Thank you for your interest in Essential Studio.

We are unable to reproduce the issue on our side, could you please send us the sample and the template document, this will help us a lot in further investigating this issue.

Please let us know if you have any queries.


Matt Dixon
Replied On June 23, 2010 01:42 PM UTC

Due to the nature of our product, it would be difficult to post the nessecary code on this forum. Would it be possible to set up a webcast where I could share my code with you?

Angappan G [Syncfusion]
Replied On June 24, 2010 11:10 AM UTC

Hi Matt,

Could you please report these issues through Direct Trac Developer Support Systemhttps://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 and we hope you will take advantage of this system as well.In this mode your code will be kept as confidential.

Please let us know if you have any other questions.



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