PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Get Page Number of actual table row
https://forum.pdfsharp.net/viewtopic.php?f=2&t=1864
Page 1 of 1

Author:  elPete [ Sat Dec 03, 2011 11:06 pm ]
Post subject:  Get Page Number of actual table row

Hi!

I developed a software tool to create invoices. In many cases the invoice has several pages. The products that are in the invoice are printed in a big table which uses more than one page. The automatical page break works great.
I need to implement a page-summery for every page. This means that on every page there should be a footer with the summary of alle product prices on THIS page.
I had the idea to sum up the product prices for alle products on a page while rendering and printing the price sum in the footer. But while rendering I have no information about on which page the renderer is currently. Any ideas how to implement this?

Or any suggestion about a totally different way to create that summary?

Author:  Thomas Hoevel [ Mon Dec 05, 2011 12:49 pm ]
Post subject:  Re: Get Page Number of actual table row

Hi!

No simple solution available.

You can call "renderer.RenderPage" to create the document page by page. You can call "renderer.GetDocumentObjectsFromPage" to get the objects on that page. You can add Tags to all MigraDoc objects (e.g. "row.Tag = price;" or define a class if you need more than a single value).

Problem is that GetDocumentObjectsFromPage will return the whole table for every page where a part of the table appears.
You will need a GetRenderInfoFromPage routine to get the TableRenderInfo which contains a FormatInfo of type TableFormatInfo that contains startRow and endRow.
See here for "GetRenderInfoFromPage":
viewtopic.php?p=1960#p1960

Then you can get all the information you need to calculate the sum and draw on the page using PDFsharp routines after RenderPage drew the table.

Author:  elPete [ Wed Dec 14, 2011 10:06 am ]
Post subject:  Re: Get Page Number of actual table row

Now I got a solution in counting the printed table rows and adding a manual page break. Not a good solution but works :D

Author:  wasers [ Wed Aug 27, 2014 1:30 pm ]
Post subject:  Re: Get Page Number of actual table row

GetRenderInfoFromPage routine returns only the top-level objects and there is no solution to get all rendered objects?

e.g. currently I am searching for the rendered Textframe object inside an Paragraph element that is inside the primary footer.
GetRenderInfoFromPage returns two paragraph objects but I can't get 'down' to the text frame object inside one of them :(

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/