Printing select pages from the middle of a PDF not working


Hi There,

I am using DocumentPrinter to print PDF files using XPS. I am NOT able to print in following cases -

1) All pages when document is of size 4Mb+ and number of pages is more than 10.
2) Printing selected pages in middle of pages not working if trying to print pages like 10-12 or even 7-8

When user tries to view PDF when printing is in progress, UI freezes. So we would like to have a busy indicator while printing is in progress, to avoid user scrolling the PDF.
 <doc:LoadXpsDocumentSettings ImageMaxSize="9999,9999" FixedPageCacheSize="9999" ImageCacheSize="9999"/>
Tried using FixedPageCacheSize and ImageCacheSize properties but looks like this is not working.

Can you please please help us to solve this problem? I went through 'Printing issues when specifying page range' but could not find the specified alternative links provided in the last post by Koen.
  • Varsha


varshaH wrote Mar 12, 2014 at 10:04 AM


Tried with Custom Filter option, but it is also not working. Getting same error 'Maximum retry count exceeded'.
  • Varsha

kozw wrote Mar 12, 2014 at 4:39 PM

What you're running into is a known limitation of Document Toolkit that is related to how the current Silverlight printing API is implemented. The Silverlight printing API, with its polling mechanism, doesn't work well with Document Toolkit's async loading of document pages. Most of the time it works fine, but sometimes it can happen that the Silverlight PrintDocument is requesting a page to be printed while the page has not been loaded yet. The PrintDocument will try a number of times before giving up with the 'Maximum retry count has been exceeded' error.

I've been trying to resolve this issue in the past, but with no success. Alternative implementations such as preloading pages are not usable, since loading a complete document in memory (especially in combination with spooling bitmaps when printing huge images such as TIFF) simply runs into OutOfMemoryExceptions.

I'm afraid there's good solution here, unless the Silverlight printing API changes. This most likely will not happen.