FlowDocument PrintDialog gesamten Bereich drucken

  • WPF

    FlowDocument PrintDialog gesamten Bereich drucken

    Ich versuche den Inhalt eines FlowDocument als PDF zu drucken.

    Der Code des FlowDokument sieht folgendermaßen aus:

    XML-Quellcode

    1. <FlowDocumentScrollViewer Grid.Row="1" Grid.Column="1" Width="Auto" Height="Auto" Zoom="80" ZoomIncrement="5" IsToolBarVisible="True">
    2. <FlowDocument Name="FlowDokument" IsColumnWidthFlexible="True" PageWidth="21cm" ColumnWidth="21cm">
    3. <Paragraph Name="Paragraph_Content">
    4. <Frame NavigationUIVisibility="Hidden" Name="content" Height="auto"/>
    5. </Paragraph>
    6. </FlowDocument>
    7. </FlowDocumentScrollViewer>


    Im Frame wird wird eine RichTextBox geladen. Der gesamte Inhalt der RTF wird im Flowdocument angezeigt. Der Druckbereich ist etwas größer als eine Din A4 Seite.
    Beim Aufruf von PrintDialog:

    VB.NET-Quellcode

    1. Dim MyPrintDialog As New PrintDialog
    2. Dim MyFlowDokument = Me.FlowDokument
    3. Dim MyIDPSource As IDocumentPaginatorSource = MyFlowDokument
    4. If MyPrintDialog.ShowDialog() Then
    5. MyPrintDialog.PrintTicket.PageOrientation = Printing.PageOrientation.Portrait
    6. MyPrintDialog.PageRangeSelection = PageRangeSelection.AllPages
    7. MyPrintDialog.UserPageRangeEnabled = True
    8. MyPrintDialog.PrintDocument(MyIDPSource.DocumentPaginator, datum & " - " & Titel)
    9. End If


    wird allerdings nicht der geamte Bereich des FlowDocument ausgegeben. Nur der Teil der auf eine Seite A4 paßt. Die zweite Seite fehlt.
    Irgend etwas fehlt an den Einstellungen?

    Das ist die Lösung:

    MyFlowDokument.PageHeight = MyPrintDialog.PrintableAreaHeight

    Es ist doch nicht de Lösung: Die zweite Seite wird einfach nicht gedruckt. Warum nicht?

    Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von „Thomas2705“ ()