2014-09-25 139 views
0

我发现呈现FlowDocument的WPF RichTextBox不是所见即所得。WPF RichTextBox字体间距不一致

下面的屏幕截图显示编辑器(左)与其渲染的PDF输出(右)相比缩小了间距。

RTB vs PDF

该文档的XAML。

<ns0:FlowDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:ns0="http://schemas.microsoft.com/xps/2005/06" 
        Background="#FFFFFFFF" ColumnWidth="816" PageWidth="816" PageHeight="1056" 
        AllowDrop="True" NumberSubstitution.CultureSource="User"> 
    <ns0:FlowDocument.Blocks> 
    <ns0:Paragraph> 
     <ns0:Paragraph.Inlines> 
     <ns0:Run Text="72" FontFamily="Arial" FontSize="72" /> 
     </ns0:Paragraph.Inlines> 
    </ns0:Paragraph> 
    <ns0:Paragraph> 
     <ns0:Paragraph.Inlines> 
     <ns0:Run Text="48" FontFamily="Arial" FontSize="48" /> 
     </ns0:Paragraph.Inlines> 
    </ns0:Paragraph> 
    <ns0:Paragraph> 
     <ns0:Paragraph.Inlines> 
     <ns0:Run Text="20" FontFamily="Arial" FontSize="20" /> 
     </ns0:Paragraph.Inlines> 
    </ns0:Paragraph> 
    <ns0:Paragraph> 
     <ns0:Paragraph.Inlines> 
     <ns0:Run Text="12" FontFamily="Arial" FontSize="12" /> 
     </ns0:Paragraph.Inlines> 
    </ns0:Paragraph> 
    <ns0:Paragraph> 
     <ns0:Paragraph.Inlines> 
     <ns0:Run Text="08" FontFamily="Arial" FontSize="8" /> 
     </ns0:Paragraph.Inlines> 
    </ns0:Paragraph> 
    </ns0:FlowDocument.Blocks> 
</ns0:FlowDocument> 

您是否有解决此问题的解决方法?

回答

0

如果你想要页面保真度,那么FlowDocument是错误的工具。
FlowDocuement就是这样 - Flow - 它不知道页面规范。
对于页面保真度使用FixedDocument

在屏幕上,Microsoft Word旁边的PDF也不一定具有相同的间距。
这两幅图像也没有相同的文字高度。
阅读器具有缩放功能。
为什么你会期望这两个图像是相同的?