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

headers telephone directory style / callback
https://forum.pdfsharp.net/viewtopic.php?f=2&t=2195
Page 1 of 1

Author:  tawulf [ Mon Oct 29, 2012 8:14 pm ]
Post subject:  headers telephone directory style / callback

Hi again,

I am creating a different type of list of artists and concerts now and would like the headers to to show the names of the first and the last artist on each page.

But as I don't know when a new page is starting I can't set the value for the first name on the page right.

I could try to count the lines but they have differing spacings and I think the renderer can do that a lot better..

So how can I tackle this problem? Is there maybe a callback for the renderer's page change event?

Thanks again for any hints,

Thomas

Author:  Thomas Hoevel [ Tue Oct 30, 2012 10:50 am ]
Post subject:  Re: headers telephone directory style / callback

Hi, Thomas!
tawulf wrote:
Is there maybe a callback for the renderer's page change event?
None that I know.

You can add a tag to each paragraph - this tag could be a string with the artists name.

After layouting the document, you can use GetDocumentObjectsFromPage (or maybe GetRenderInfoFromPage) to find which tags are on which page.
Then create a new document with correct headers based on the information from the first run.

GetDocumentObjectsFromPage is public, so this is the preferred method.

See also (on how to make GetRenderInfoFromPage available):
viewtopic.php?p=1960#p1960

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