0

I need to dispay text for user before printing and allow to print it. I try to use DocumentViewer, but can't find example to display simple Text. Only Word or XPS, but it's overgear solutions.

Is there any way to print simple multiline text throw DocumentViewer

var printText = @"Multiline text to view and print
Line1 Content
Line2 Content
";

and View

<DocumentViewer>
    <FixedDocument></FixedDocument>
</DocumentViewer>     

How to make this work ?

Alex Tartan
  • 6,736
  • 10
  • 34
  • 45
Json76
  • 175
  • 2
  • 13

1 Answers1

0

A FlowDocument?

<FlowDocumentReader xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <FlowDocument>
    <Paragraph>
      <Bold>Some bold text in the paragraph.</Bold>
      Some text that is not bold.
    </Paragraph>
    <List>
      <ListItem>
        <Paragraph>ListItem 1</Paragraph>
      </ListItem>
      <ListItem>
        <Paragraph>ListItem 2</Paragraph>
      </ListItem>
      <ListItem>
        <Paragraph>ListItem 3</Paragraph>
      </ListItem>
    </List>
  </FlowDocument>
</FlowDocumentReader>
paparazzo
  • 44,497
  • 23
  • 105
  • 176
  • @Json76 Then you can give is a check mark indicate it is an answer – paparazzo May 23 '15 at 17:22
  • One issue - it's not showing Print button in reader toolbar ( where zoom buttons and other ) as DocumentViewer. Trying set IsPrintEnabled = true not helped. It's not big problem, but in layout i need reserve place for custom button – Json76 May 24 '15 at 06:19