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.

PDF from large html file

Thread ID:

Created:

Updated:

Platform:

Replies:

117500 Oct 30,2014 12:22 PM Nov 3,2014 11:20 PM ASP.NET Web Forms (Classic) 1
loading
Tags: PDF
lalleman
Asked On October 30, 2014 12:22 PM

Hello,
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 3, 2014 11:20 PM

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,

Praveen



Attachment: PDF_Html_text_ecc712c8.zip

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.

;