Printing Retry: Maximum Retry Count Exceeded

Jul 4, 2011 at 11:35 AM

Hi,

I'm having a problem printing documents from my Document Toolkit enabled app. The error message is 'Maximum retry count exceeded'. According to Google, no one has the same issue, so that's no good. The problem happens with any document, also when it's embedded in the XAP. Have you experienced anything like this before or do you know any way to get more detailed error information?

I'm declaring the document printer like this, maybe I'm missing something?

Printer = new DocumentPrinter
{
   DocumentDataSource = documentDataSource
};

 

Thx,

-Morten Christiansen

Coordinator
Jul 4, 2011 at 11:42 AM

Hi Morten,

Try adding the printer to XAML, as demonstrated in this tutorial: http://documenttoolkit.codeplex.com/wikipage?title=How%20To%20Add%20Thumbnails%2c%20Navigation%20and%20Printing.

DocumentPrinter is a control and needs to be alive in the visual tree for printing to happen properly.

Also do you use the latest doctoolkit binaries?

- Koen

Jul 4, 2011 at 12:15 PM

Hmm, that didn't work either. I can see that the DocumentDataSource class is a control as well, and I'm not creating it in XAML. Would this be a problem and if so, how do I share the data source between several views in XAML?

Jul 5, 2011 at 6:44 AM

I put the data source in the XAML as well, but that didn't help. Any other ideas? If not I guess I'll just have to break the app apart until it works.

Coordinator
Jul 5, 2011 at 9:36 AM

Hi Morten,

The printer error indicates that a document page is requested but it is never loaded. How does your solution differ from the XAML approach in the tutorial I mentioned earlier?


- Koen

Jul 5, 2011 at 9:59 AM

Hi,

I have several views/view models that all need access to the DocumentDataSource instance, and the printer, viewer, thumbnail etc. are spread out over those different views. Right now I have the DocumentDataSource instantiated in the XAML for the application shell. In the shell constructor I assign it to a static property such that the different view models can work with it. The most of the other document browser controls are created in one view while the printer is added in another. The DocumentDataSource is bound to the printer and other controls via model binding from the view models. I guess the link between the document viewer and printer is somehow broken, but I'm not sure how they find each other in the first place if not through the DocumentDataSource.

-Morten

Coordinator
Jul 5, 2011 at 12:50 PM

Hi Morten,

The only thing you need to do is assign your DocumentDataSource instance to the DocumentPrinter.DocumentDataSource property. That should get things started. Just to be sure, is the code in the tutorial working for you? Maybe the issue is related to the documents you want to print.

- Koen

Jul 6, 2011 at 7:41 AM

Hi,

I've found a way to make it work, though I'm not sure why. I moved the printer and the printer button from the view it was placed in to the same view as the document viewer, and it works. There is no change in how they're linked to the data source, so the only thing I can see that has changed is that they are now located in the same user control. Anyways, thanks for the help, it got me in the right mode of thinking. I don't know if you have any influence over it, but if you can add a bit of info to the error message, I'm sure it would be helpful for others running into the same problem.

-Morten

Coordinator
Jul 6, 2011 at 8:49 AM

Hi Morten,

Is it possible that the view that contained the datasource and printer was invisible? That may influence it's behavior as well.

- Koen

Jul 6, 2011 at 9:04 AM

Hmm, now that you mention it, in my haste to test declaring the printer in the XAML I actually dropped the printer in a popup box, so that would explain why it still didn't work. Bad luck :)

-Morten