0

I have a custom DocumentPaginator, that creates a table with some values and repeats table header in the beginning of every page. (Similar as here.) How can i show pages generated by it in DocumentViewr?

I believe first i need to create an XpsDocument. So i tried to use XpsDocumentWriter:

var xpsw = XpsDocument.CreateXpsDocumentWriter(xpsDocument);
xpsw.Write(paginator);

But it doesn't work. Does someone have any ideas how to do it?

max_hassen
  • 387
  • 1
  • 5
  • 16
  • *But it doesn't work.* Well, that's certainly informative. By the way, pagination is **hard**. There are many things that can go wrong, and for many reasons. If you can't narrow down the issue or be more detailed in your question, you probably won't get an answer. –  Mar 04 '13 at 14:54
  • It crushes with the following exception: **"FixedDocument must contain at least one FixedPage."**. On the line: `xpsw.Write(paginator);`. – max_hassen Mar 05 '13 at 04:17
  • Well, the paginator isn't providing any actual `FixedPage`s. Not sure why, however. A bit of debugging might help. –  Mar 05 '13 at 04:33
  • Thank you, Will. The problem was that `PageCount` wasn't implemented correctly. – max_hassen Mar 05 '13 at 05:15
  • You can provide a (at least a couple paragraph) description of the solution and close out the question, and you can close this out. Not required, but [it can help your account's status.](http://meta.stackexchange.com/questions/121087/automatically-redirect-or-block-meta-questions-regarding-question-bans) –  Mar 05 '13 at 05:25

1 Answers1

0

It turned out that Paginator.PageCount overridden property wasn't implemented correctly. It used to return a negative number, so Paginator.GetPage method couldn't provide any pages.

max_hassen
  • 387
  • 1
  • 5
  • 16