2022 年 12 月 13 日,微软为 .NET 4.8.1 发布了 Windows 更新 KB5020880 (CVE-2022-41089),应该可以修复 XPS 上的安全问题。
从那时起,将渲染到 XPS 的 FlowDocument 将不再显示本地图像。我确实需要本地图像,因为我必须动态创建和嵌入它们。
<FlowDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
PageHeight="29.7cm"
PageWidth="21cm" >
<Section Padding="40,0,20,0">
<Paragraph>before image</Paragraph>
<Paragraph FontSize="10" FontFamily="Verdana">
<Image Source="c:/Test/MyImage.jpg" Margin="40,40,0,0" />
</Paragraph>
<Paragraph>after image</Paragraph>
</Section>
</FlowDocument>
Run Code Online (Sandbox Code Playgroud)
一旦 FlowDocument 转换为 XpsDocument,DocumentViewer 就会像这样显示它。
有人有解决方案吗?
非常欢迎任何帮助。
干杯,爵士乐