The C1MultiDocument component is designed to allow creating, persisting, and exporting large documents that cannot be handled by a single C1PrintDocument object due to memory limitations.
A C1MultiDocument object provides a Items collection that can contain one or more elements of the type C1MultiDocumentItem. Each such element represents a C1PrintDocument. Use of compression and temporary disk storage allows combining several C1PrintDocument objects into a large multi-document that would cause an out of memory condition if all pages belonged to a single C1PrintDocument. The following snippet of code illustrates how a multi-document might be created and previewed:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim mdoc As New C1MultiDocument() mdoc.Items.Add(C1PrintDocument.FromFile("myDoc1.c1dx")) mdoc.Items.Add(C1PrintDocument.FromFile("myDoc2.c1dx")) mdoc.Items.Add(C1PrintDocument.FromFile("myDoc3.c1dx")) Dim pview As New C1PrintPreviewDialog() pview.Document = mdoc pview.ShowDialog() |
To write code in C#
C# |
Copy Code
|
---|---|
C1MultiDocument mdoc = new C1MultiDocument(); mdoc.Items.Add(C1PrintDocument.FromFile("myDoc1.c1dx")); mdoc.Items.Add(C1PrintDocument.FromFile("myDoc2.c1dx")); mdoc.Items.Add(C1PrintDocument.FromFile("myDoc3.c1dx")); C1PrintPreviewDialog pview = new C1PrintPreviewDialog(); pview.Document = mdoc; pview.ShowDialog(); |
C1MultiDocument supports links between contained documents, common TOC, common page numeration, and total page count.
Note that a C1MultiDocument does not store references to the C1PrintDocument objects added to it - rather, it serializes them (as .c1d/x) and stores the result. Thus, you can create really large multi-documents without running out of memory - provided, of course, that your code itself does not keep references to the individual C1PrintDocument objects that were added to the C1MultiDocument. So when using C1MultiDocument please make sure that you do not keep references to the individual document objects after you have added them to the multi-document.
C1MultiDocument can be persisted as "C1 Open XML Multi Document" with the default extension of .c1mdx.
C1MultiDocument can be exported to most formats using any of the Export method overloads. See Exporting a C1MultiDocument File for details.
C1MultiDocument can be printed using any of the Print and PrintDialog methods overloads. See Printing a C1MultiDocument File for details.