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

PDF from large html file

Thread ID:





117500 Oct 30,2014 04:22 PM UTC Nov 4,2014 04:20 AM UTC ASP.NET Web Forms (Classic) 1
Tags: PDF
Asked On October 30, 2014 04:22 PM UTC

I have registered to your product to test it myself before buyint it for my employer.

I want to do a PDF page from a webform with some textbox controls. The PDF is made of fixed text and values form textbox controls.
All the fixed text contains basic HTML tags and is stored in a text file.
The text include the content of textbox controls and a mutline textbox.
Minimum text length : 8254. Maximum text length : 8856

At a place in the generated PDF, I want to place some rectangles near the text.
To do this, I have made 2 files, the first start at the beginning and stop before rectangles, and the second starts after rectangles.

I draw text with this code :
PdfHTMLTextElement richTextElement = new PdfHTMLTextElement(oStringBuilder.ToString(), font, PdfBrushes.Black);
The first problem is that the whole text is not written. I have to add an additional height, like this :
PdfLayoutResult oPdfLayoutResult = richTextElement.Draw(page, new PointF(0, 70), page.GetClientSize().Width, page.GetClientSize().Height + fAditionalHeight, format);

I have a second problem. I determine the end of the text, to set the rectangles location.Y with :
float fEnd = oPdfLayoutResult.Bounds.Bottom;
RectangleF yes = new RectangleF(0, finPart1, convertor.ConvertUnits(5, PdfGraphicsUnit.Millimeter, PdfGraphicsUnit.Point), convertor.ConvertUnits(5, PdfGraphicsUnit.Millimeter, PdfGraphicsUnit.Point));
RectangleF no = new RectangleF(0,finPart1 + convertor.ConvertUnits(8, PdfGraphicsUnit.Millimeter, PdfGraphicsUnit.Point),convertor.ConvertUnits(5, PdfGraphicsUnit.Millimeter, PdfGraphicsUnit.Point),convertor.ConvertUnits(5, PdfGraphicsUnit.Millimeter, PdfGraphicsUnit.Point));
page.Graphics.DrawRectangle(PdfPens.Black, yes);
page.Graphics.DrawRectangle(PdfPens.Black, no);

but whatever the text length,  has allways the same value.
With the minimum text length (8254), there is a "hole" between the end of the first text and rectangles.
There is there a way to fix this ?
I hope you understand my problems and you could help me.

Praveenkumar H [Syncfusion]
Replied On November 4, 2014 04:20 AM UTC

Hi Lalleman,

Thank you for using syncfusion products,

We have created the sample which fulfill your requirement please try the attached sample and let us know if you need further assistance in this.

With Regards,


Attachment: PDF_Html_text_ecc712c8.zip


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

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