Intersoft ClientUI 8 > ClientUI Fundamentals > Document Framework Overview |
This topic describes the concept of Intersoft Document Framework, fixed document, and provides guidance on how to print the documents.
WPF provides a wide range of document features, enabling users to create a document, arrange the document layout, and print it. On the other hand, the similar rich document framework is not available in Silverlight. Intersoft Document Framework addresses this limitation by providing a similar document architecture in both WPF and Silverlight, allowing users to create documents that works consistently in both platforms.
Fixed documents are intended for applications that require a precise "what you see is what you get" (WYSIWYG) presentation, independent of the display or printer hardware used. Typical uses for fixed documents include desktop publishing, word processing, and form layout, where adherence to the original page design is critical. As part of its layout, a fixed document maintains the precise positional placement of content elements independent of the display or print device in use. For example, a fixed document page viewed on 96 dpi display will appear exactly the same when it is output to a 600 dpi laser printer as when it is output to a 4800 dpi phototypesetter. The page layout remains the same in all cases, while the document quality maximizes to the capabilities of each device.
This topic contains the following sections:
FixedDocument logically binds an ordered sequence of pages together into a single, multi-page, fixed-layout document.
A FixedPage represents a page in FixedDocument. It provides content for the page within the FixedDocument. To support fixed content layout, FixedPageis inherited from Canvas. You can add controls with specific size and position inside a FixedPage.
XAML |
Copy Code
|
---|---|
<Intersoft:FixedPage Width="816" Height="1056"> <TextBlock Text="Text" Canvas.Left="100" Canvas.Top="100"></TextBlock> </Intersoft:FixedPage> |
FixedDocument only allows PageContent element as its child element. Each PageContent can either refer to a source of content for a single page or contain the page itself. PageContent elements must be in sequential markup order, matching the page order of the document.
XAML |
Copy Code
|
---|---|
<Intersoft:FixedDocument> <Intersoft:PageContent> <Intersoft:FixedPage Width="816" Height="1056"> <TextBlock Text="Text" Canvas.Left="100" Canvas.Top="100"></TextBlock> </Intersoft:FixedPage> </Intersoft:PageContent> <Intersoft:PageContent Source="Pages/1.fpage" /> </Intersoft:FixedDocument> |
FixedDocumentSequence hosts an ordered sequence of one or more fixed documents that are organized as a single unit.
FixedDocumentSequence only allows DocumentReference element as its child element. Each DocumentReference refers to a single FixedDocument. Document reference elements must be in sequential order, matching the order in which the fixed documents are processed.
XAML |
Copy Code
|
---|---|
<Intersoft:FixedDocumentSequence> <Intersoft:DocumentReference Source="Documents/1/FixedDocument.fdoc"/> <Intersoft:DocumentReference Source="Documents/2/FixedDocument.fdoc"/> </Intersoft:FixedDocumentSequence> |
FixedDocument should be contained within UXDocumentViewer or XPSDocumentViewer. Both viewer has built-in printing capability which allows users to easily print the fixed document. If you don't want to use the built-in capability, you can print a document programmatically.
CS |
Copy Code
|
---|---|
private void Print() { PrintDocument pd = new PrintDocument(); pd.Print(FixedDocument1.DocumentPaginator, "Employee Document"); } |
PrintDocument class will use the Print method to print the document. Print method needs two parameters, DocumentPaginator object and the document name. DocumentPaginator is an abstract base class that supports creation of multiple-page elements from a single document. By default, each FixedDocument has DocumentPaginator property that contain DocumentPaginator object for the fixed document.
Additionally, you can specify a custom paginator class to add custom elements for printing purpose only, such as header or footer. To learn more about how to implement custom paginator class for printing purpose, see How-to: Use Custom Paginator to Print FixedDocument. To learn more about how to implement custom paginator class in UXDocumentViewer, see How-to: Use Custom Paginator in UXDocumentViewer.
Intersoft ClientUI includes several full-featured document viewer controls that are built upon the Document Framework. These document viewer controls provide rich viewing and printing capabilities, and consistently support both Silverlight and WPF platforms.
For more information about the document viewer controls, see Document Controls Overview.