How I can get the number of pages before rendering? I need to write the number as words in my document.
For page numbers as numbers:
You don't have to get the number, you can add placeholders (called Fields) to your document and MigraDoc will insert the page numbers automatically while rendering the document.
See AddPageField()
in this sample:
http://pdfsharp.net/wiki/HelloMigraDoc-sample.ashx
Other field functions are AddNumPagesField()
, AddSectionField()
, AddSectionPagesField()
, AddDateField()
, and AddPageRefField(string name)
For page numbers as words:
There is no built-in solution to get page numbers as words.
Where do you need the page numbers? It is possible to have MigraDoc create a document without page numbers and then use PDFsharp to add the page numbers as words in either the header or the footer. If you need page numbers as references within the text then I don't have an easy answer.
See also:
http://forum.pdfsharp.net/viewtopic.php?p=8476#p8476
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With