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

Get number of pages before rendering?
https://forum.pdfsharp.net/viewtopic.php?f=2&t=2918
Page 1 of 1

Author:  Blackbee [ Tue Sep 02, 2014 8:51 pm ]
Post subject:  Get number of pages before rendering?

Please, Help!
How I can get number of pages before rendering?

I've read, that i can query the renderer to get number.

I need to write number as words in my document.
Our standarts are forced to write number of pages as words on the title page.
I create technical report consisting more than 500 pages.
With tables and charts, calculating values etc, document render about 15 minutes...

Sorry for my English.

Regards,
Egor

Author:  Thomas Hoevel [ Wed Sep 03, 2014 7:59 am ]
Post subject:  Re: Get number of pages before rendering?

Hi!

Also see answer here:
http://stackoverflow.com/a/25639027/162529

Adding the number as a word to the title page using PDFsharp should be no problem.
Render the PDF with MigraDoc and you will know how many pages there are, then open the PDF file with PDFsharp and add one line of text with the page number as a word.

Is the position fixed?
If not, add a method "GetRenderInfoFromPage(int page)" to MigraDoc to get the position of a placeholder on the title page.
viewtopic.php?p=1960#p1960

Author:  Blackbee [ Wed Sep 03, 2014 8:44 am ]
Post subject:  Re: Get number of pages before rendering?

Ok. I have class which rewrite numbers as words.
I need to get some int value as number of pages to convert it to words.

I realized that I have to render the document in a stream of MigraDoс, received at the same time the number of pages to execute a method in my class, and then open the document from a stream in PDFSharp and add a single line?

Sorry for English

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