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.
Syncfusion Feedback

PdfElements flow in multiple pages

Thread ID:

Created:

Updated:

Platform:

Replies:

97048 Oct 22,2010 04:37 PM UTC Oct 26,2010 11:00 AM UTC ASP.NET Web Forms (Classic) 3
loading
Tags: PDF
Antonis Mylonas
Asked On October 22, 2010 04:37 PM UTC

Hi,
We are currently developing a project that we have to generate many lengthy PDF reports.
Each PDF consist of many elements (Text Elements, Grids, Images, (Un)ordered Lists etc) and the presentation order of these elements is determined by many variables.
Even the visibility of those elements is not constant.

I would like to ask if there is an easy way to draw all these elements in multiple pages without checking for each one if it fits into the current page and if not to create a new page manually?



Geetha M [Syncfusion]
Replied On October 25, 2010 10:04 AM UTC

Hi Antonis,

Thank you for your continued interest in Syncfusion products.

All the elements you mentioned (Text Elements, Grids, Images and Unordered Lists) are associated with Begin and End PageLayoutEvents, from which you can get the end bounds and the page information. You can make use of these informations and calculate the starting location of the next element. I have created a simple sample and placed it in the link below.

F97048.zip

Please try this and let me know if you have any questions.

Regards,
Geetha


Antonis Mylonas
Replied On October 25, 2010 02:34 PM UTC

Hi Geetha,
Thanks for your help.

Unfortunately it does not always work (please replace the manual.txt file, with the one attached and rerun the example you have sent me) due to the fact that you increment the Y property to leave space between the Pdf elements (this is something we do also)

i.e.
//Draw list
list.Draw(page, new PointF(0, pagebounds.Bottom + 10));

The above increment by 10 of the Y property, if it gets out of page bounds then it does not create a new page and instead is drawn on the top of the existing page.

We have tried result.Bounds.Inflate(0, 10) and result.Bounds.Offset(0, 10) but both methods do not work.

Is there any other way to overcome this problem.

Thanks & Regards
AM




WebSite1_5ae5bd9d.rar

Geetha M [Syncfusion]
Replied On October 26, 2010 11:00 AM UTC

Hi Antonis,

Thank you for the details.

We can calculate whether the y coordinate has crossed the page bounds or not. Please refer to the code below:

float y = pagebounds.Bottom + 10;

if (y > page.GetClientSize().Height - 10)
{
page = doc.Pages.Add();
y = 0;
}

result = element.Draw(page, new PointF(0, y), layoutFormat);

Here -10 should be the constant value to leave space at the end of the page. Please try this and let me know if you have any questions.

Regards,
Geetha


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

;