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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Measure of a PdfGrid before draw or force a PdfGrid to insert a page break to fit completley on on page

Thread ID:

Created:

Updated:

Platform:

Replies:

117587 Nov 12,2014 02:47 PM UTC Nov 13,2014 12:14 PM UTC WinForms 1
loading
Tags: PDF
Walter Porada
Asked On November 12, 2014 02:47 PM UTC

Hi there

Is there a method to measure the size of a PdfGrid before I draw it to a page or can I set any properties to force the PdfGrid on one page?

I´m doing a complex layout so the content is variable. But I want the content of a specific PdfGrid not possibly allocated on two pages but only on one page. If there is not enough room left to fit it, a page break should be inserted.

Is there a way to archive this?

I found no way to measure the size of the PdfGrid before it is drawn and PdfGridLayoutFormat seems only to care for single rows, not for the whole PdfGrid. And besides it seems to remove sometimes Information of the grid. 

Any ideas?


Regards,
Walter Porada


Praveenkumar H [Syncfusion]
Replied On November 13, 2014 12:14 PM UTC

Hi Walter,

Thank you for using Syncfusion product.

Currently Essential Pdf doesn’t have any property to get PdfGrid table height, we have created a   workaround to get the solution. We have created dummy PdfDcocument to get the height of the table.

 Please refer following the code snippet.

  //Calculate the Table Height

PdfLayoutResult result = pdfGrid.Draw(page, new PointF(0, 0));

 

float height = result.Bounds.Height;

If the element exceeds the page, pagination is used to proceed it on the next page. We can enable the pagination by using the Pagination property available in the PdfLayoutType enumeration. Please refer the following code snippet:

//Create the PdfGird

PdfGrid pdfGrid = new PdfGrid();

PdfGridLayoutFormat format = new PdfGridLayoutFormat();                   

format.Layout=PdfLayoutType.Paginate

format.Break = PdfLayoutBreakType.FitElement;

//Draws the grid in to the page of the PDF document using that layoutformat 

 pdfGrid.Draw(pdfPage, new PointF(10, 10),format);

We have attached the sample for your reference in below links

 

Sample Link to get PdfGrid Table Height:

http://www.syncfusion.com/downloads/support/directtrac/general/PdfGridTable1194063503.zip

 

Sample Link for Page break:

http://www.syncfusion.com/downloads/support/directtrac/general/PdfGridPageBreak1574123688.zip


Please try this and let us know if you have any further assistance.

Thanks,

Praveen.          


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

;