Print Suite .Net • How It Works

Print Suite .Net - How It Works?

Begin printingPrinting process is beginning after calling Print method of DocumentDesigner or by InvalidatePreview of binded PrintPreviewControl (it can be also click on the Print button of PreviewToolbar). BeginPrintDocument event of all the print providers included into Page and Content lists of all the document sections is fired. Everything is ready for printing.

Section enterEntering first section of document. It's time to print decoration of first page by providers from the Page list of first section, and first provider already has BeginPrintProvider event fired.

Page provider cyclePrinting page decoration with first provider. DocumentDesigner calls CallPrintContent methods (that calls OnPrintContent method or PrintContent event) until provider returns ContinuePrint.Finish in the ContinuePrint property of passed event arguments. Each content printing are edged by BeginPrintContent and EndPrintContent method.

Next providerFirst provider returns ContinuePrint.Finish, receives last EndPrintContent event and EndPrintProvider event, and DocumentDesigner prepares next provider for printing... and so on, for each provider in the Page list.

Going to ContentOK, all the decoration providers were applied, and our page is ready to receive the real content. Now we are going to the Content list and first provider has BeginPrintPage event fired. This event is applicable only for providers from Content list, because there is no sense in such event for providers from Page list, because we know that we are working with one page only there.

Content provider cycleWe are printing the page content with first content provider. Each provider can return ThisPage, NextPage or Finish as a result of content printing (ContinuePrint type). When ThisPage is returned, the PrintContent event is fired for the same document page (it can be useful, if we have many similar content items printed by the same code). Returning Finish causes going to next provider in the Content list.

Returning back to page decorationWhen the provider finished printing on the current page, but it has unprinted content, it must return NextPage. In this case printing is still under control of this current provider, but new page is forsed and we returned back to the Page list to decorate the new document page.

Going to ContentNew page is decorated and we are going to the Content list again. It's automatical process, so we don't need any special events to control it. All we need is just print content and return ThisPage, NextPage or Finish. DocumentDesigner will do the rest.

Next providerWhen current provider from Content list returns Finish, it receives all the appropriated End* events and pass the control on the printing to the next provider.

Section finishedLast provider of the Content list of the current section returned Finish, so we leave this section and starts everything again and again with each section of document...

End printingLast section printed. Document done. All providers receive EndPrintDocument event to know that everything is finished and it's time to dispose all the resources (if any) and to have a rest.