FixedDocument的背景图像放在哪里?我在FlowDocument上看到了,但在FixedDocument中没有看到。
在FlowDocument中
<FlowDocument.Background>
<ImageBrush>
<ImageBrush.ImageSource>
<!--Image source here...-->
</ImageBrush.ImageSource>
</ImageBrush>
</FlowDocument.Background>发布于 2020-05-28 09:38:47
你可以这样做:
<FixedPage xmlns="http://schemas.microsoft.com/xps/2005/06"
Width="793.60" Height="1122.56" xml:lang="fr">
<Canvas>
<Path Data="M 0.00,0.00 L 0.00,3508.00 L 2480.00,3508.00 L 2480.00,0.00 Z">
<Path.Fill>
<ImageBrush ImageSource="xxx.jpg"
TileMode="None"
Viewbox="0,0,3306.67,4677.33"
ViewboxUnits="Absolute"
Viewport="0.00,0.00,2480.00,3508.00"
ViewportUnits="Absolute"/>
</Path.Fill>
</Path>
...
</Canvas>发布于 2015-03-13 20:31:01
您应该能够对每个固定页面使用FixedPage.Background逐页设置它:
<DocumentViewer Name="mainRTB" >
<FixedDocument>
<FixedDocument.Resources>
<ImageBrush x:Key="backgroundImage" TileMode="Tile" Stretch="Fill" Viewport="0,0,1.0,0.33333333" AlignmentX="Center">
<ImageBrush.ImageSource>
<!--Image source here...-->
</ImageBrush.ImageSource>
</ImageBrush>
</FixedDocument.Resources>
<PageContent>
<!-- 7" x 9" page -->
<FixedPage Width="672" Height="864" Background="{StaticResource backgroundImage}">
<StackPanel Orientation="Vertical" FixedPage.Left="280" FixedPage.Top="150">
<Label FontFamily="Arial" FontWeight="Bold" FontSize="18" Content="Jane Eyre" HorizontalAlignment="Center"/>
<Label FontFamily="Arial" FontStyle="Italic" FontSize="14" Content="Charlotte Brontë" HorizontalAlignment="Center"/>
</StackPanel>
</FixedPage>
</PageContent>
<PageContent>
<FixedPage Width="672" Height="864" Background="{StaticResource backgroundImage}">
<StackPanel Margin="48">
<TextBlock FontFamily="Cambria" FontSize="14" Width="576" TextWrapping="Wrap">
There was no possibility etc.
</TextBlock>
<TextBlock FontFamily="Cambria" FontSize="14" Width="576" TextWrapping="Wrap" Margin="0,25,0,0">
I was glad of it etc.
</TextBlock>
</StackPanel>
</FixedPage>
</PageContent>
</FixedDocument>
</DocumentViewer>似乎它也打印-至少我看到我的背景图像显示时,打印到PDF995。
https://stackoverflow.com/questions/29022661
复制相似问题