GoView.PrintView question!


I have a question regarding GoView.PrintView

I am currently facing a situation where GoView.PrintView is never accessed while printing!

I have made an override of the GoView.PrintView method, where I call the PrintBackgroundDecoration method, and it all works great as long as there are actual Go objects in the print document that I am trying to print, but if I try to print a section of my document where there is no Go objects present, I just get out a blank page, which is understandable. However, I want it to print out the BackgroundDecoration nonetheless, and that is why I have made an override of the GoView.PrintView Method, to have it call the PrintBackgroundDecoration method manually, but apparently the GoView.PrintView Method is never entered, and therefore not the PrintBackgroundDecoration method either.

I have made an override of the PrintPreviewShowDialog and the PrintShowDialog methods aswell, if I leave out the PrintShowDialog override and have the solution just use the default print method it does seem to access the GoView.PrintView overrride I have created, is there something special I need to do to have my overrides of PrintPreviewShowDialog and PrintShowDialog access the GoView.PrintView method when there is no Go objects present in the print document?

As mentioned above I only have this issue when there is no Go object present in the print document, if there are Go object present, my overrides of the PrintPreviewShowDialog and PrintShowDialog has no problems accessing the GoView.PrintView Method, and everything is fine!

I hope my question isn’t too confusing Smile

Best Regards

Dan Tejsner

So the situation you are concerned with is when the GoDocument is empty.

You are right--GoView.PrintView is not called when the GoView.PrintDocumentSize is zero in either width or height. Neither is GoView.PrintDecoration. (Clarification: GoView.PrintView calls both GoView.PaintBackgroundDecoration and GoView.PaintObjects, which are called by both PrintView and PaintView. I'm sorry that "Paint" is easily confused with "Print"!)
I suggest that the easiest solution is not to override anything but GoView.PrintDocumentSize (and maybe GoView.PrintDocumentTopLeft), to make sure it returns a value large enough to cover the area you want to paint in GoView.PaintBackgroundDecoration.
Note that even if GoView.PrintDocumentPage didn't skip calling PrintView when the print document size is zero, the rendering would have been clipped to a zero-size clip bounds. That's why you ought to change the value returned by GoView.PrintDocumentSize.