简体   繁体   English

WPF中FlowDocument打印输出的所有页面中的水印图像

[英]Watermark image in all pages of FlowDocument printout in WPF

In short: Can anyone help me in printing a FlowDocument which may span to multiple pages with the same watermark image in every page?简而言之:任何人都可以帮助我打印一个 FlowDocument,它可能跨越多个页面,每个页面中都有相同的水印图像? My current implementation prints the watermark in first page only.我当前的实现仅在第一页打印水印。 How to do some kind of templating in this scenario?在这种情况下如何做某种模板?

Description: I am building a WPF application which prints a FlowDocument.描述:我正在构建一个打印 FlowDocument 的 WPF 应用程序。 The FlowDocument contains an image used as the watermark and the document will be printed in one or more pages according to the length of the content. FlowDocument 包含用作水印的图像,并且文档将根据内容的长度打印在一页或多页中。 Everything is working fine at the first page.在第一页一切正常。 I want the same image to be used in all pages as watermark which currently is not happening.我希望在所有页面中使用相同的图像作为当前未发生的水印。 I think I have to work on DocumentPaginator object, but I am not sure how to get this done.我想我必须处理 DocumentPaginator 对象,但我不确定如何完成这项工作。 Anyone experienced in FlowDocument printing with the above scenario that sounds like template based printing?有没有人在 FlowDocument 打印方面有过上述场景的经验,听起来像是基于模板的打印?

Yeah!是啊! I found a solution finally.我终于找到了解决方案。 It was in XAML.它是在 XAML 中。 Actually I was trying to do this for printing purpose so that every page in the printout contains the watermark image or text.实际上,我试图这样做是为了打印目的,以便打印输出中的每一页都包含水印图像或文本。 In FlowDocumentPaginator there are templates to define sections like header and footer.在 FlowDocumentPaginator 中有模板来定义页眉和页脚等部分。 You can make use of them to achieve this when printing.您可以在打印时利用它们来实现这一点。 I successfully did this for printer.我成功地为打印机做到了这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM