The .NET PreviewPrintController creates metafiles with gdi+ commands. This is bad for us because the format of such emf records is not documented, and so we can not e.g. search for text. But, if we just use .NET PrintController, the page generation process slows down by a factor of 2 (at least). The only way to avoid this is to inherit from PreviewPrintController but provide our own graphics, based on emf-only metafiles. Another caveat is which base methods to call and which not. Invoking base.OnStartPrint/base.OnEndPrint is necessary because if we do not do that performance is the same as with the regular PrintController (i.e. bad). OTOH, invoking base.OnStartPage/ base.OnEndPage looks like wasting time (as we can not use the provided graphics anyway) and what is more, for big documents at some point seems to drain resources and causes our creation of metailes to fail. So what is below seems to be the only combination that works. Still, the whole printing stuff in .NET is a mess. --dima.

Namespace:  C1.C1PrintDocument.Util
Assembly:  C1.C1PrintDocument.Classic.2 (in C1.C1PrintDocument.Classic.2.dll)

Syntax

C#
[EditorBrowsableAttribute(EditorBrowsableState.Never)]
public class PrintDocumentPrintController : PreviewPrintController
Visual Basic (Declaration)
<EditorBrowsableAttribute(EditorBrowsableState.Never)> _
Public Class PrintDocumentPrintController _
	Inherits PreviewPrintController

Inheritance Hierarchy

System..::.Object
  System.Drawing.Printing..::.PrintController
    System.Drawing.Printing..::.PreviewPrintController
      C1.C1PrintDocument.Util..::.PrintDocumentPrintController

See Also