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.

Issue with HTML Page Height

Thread ID:

Created:

Updated:

Platform:

Replies:

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

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
doc.PageSettings.SetMargins(30);

//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;

//Metafile
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"));
}

else
{
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);
}
else
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 10:45 AM

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.

Regards,
Angappan.

Matt Dixon
Replied On June 23, 2010 09:42 AM

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 07:10 AM

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.

Regards,
Angappan.

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.

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.

;