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. Image for the cookie policy date
close icon

How do I write some text below a table?

I'm using a PdfLightTable to render a table, e.g:

    var doc = new Syncfusion.Pdf.PdfDocument();
    var page = doc.Pages.Add();
    var table = new PdfLightTable();
    table.Style.HeaderSource = PdfHeaderSource.ColumnCaptions;
    table.DataSource = GetData(); // returns  a DataTable
    table.Draw(page, 0, 0);


This works fine, but now I'd like to append some text right below the table, and that's where I'm stuck:

- the table can span multiple pages
- to use page.Graphics.DrawString(text, font, brush, x, y) I have to specify the text's position
--> how do I determine the position for the text (the value for parameter 'y') ?



3 Replies

GL George Livingston Syncfusion Team June 18, 2012 05:14 AM UTC

Hi Martin,

Thank you for using Syncfusion Products.

It is possible to determine the position of the text in the PdfLightTable using PdfLayoutResult.

Use the below mentioned code snippet to the get bounds of the table element,

PdfLayoutResult result = table.Draw(page, PointF.Empty, format);

Please find the sample available in the link below to achieve your target,

TextBelowTable.zip

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

Regards

George.



MB Martin Bischoff June 18, 2012 06:19 AM UTC

Thanks George, that was exactly what I was looking for.

From the samples, this wasn't obvious to me, since each sample only shows exactly one small feature, but not combinations of them.

Best regards,
Martin


GL George Livingston Syncfusion Team June 21, 2012 03:51 AM UTC

Hi Martin,

Thank you for your update.

Please find the online sample available in the link below, which consist of combination of the table features.

http://asp.syncfusion.com/demos/reporting/pdf/Product%20Showcase/Invoice/CS/Invoice.aspx

Please let us know if you have any concerns.

Regards,

George


Loader.
Live Chat Icon For mobile
Up arrow icon