问题标签 [documentpaginator]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
wpf - WPF Printing large custom control
I'm sorry if this is a duplicate, but I couldn't find anything relating to it.
I'm trying to create an XpsDocument from a custom control that I have. The custom control already defines properties for a header and a footer, along with the body.
The idea is to be able to use that same control (or derivatives of it) as an input to some custom DocumentPaginator that will create a printer-ready version of that "report", with the header and the footer put on every page, and the controls, inside the body, showing in full (I don't want to create a bitmap of the whole control, then scale it and cut it where the page ends).
Any ideas on how I can split the contents of a user control into pages? Or suggestions on a different way to achieve the printing of the control onto pages?
Thanks a lot in advance
wpf - WPF:有没有办法只使用 PrintDialog 来选择目标打印机而不必提供 DocumentPaginator 类?
我想打印一个非常简单的布局PrintDocument
,适合一页,所以它不需要DocumentPaginator
. 但是我想用来PrinterDialog
选择打印机。我看到了PrinterSettings
作为属性的例子,PrinterDialog
它被简单地分配给PrintDocument
. 但这似乎不再可能了。我还寻找了其他解决方案,例如要使用的自定义分页器类,但结果是空的。我可能对 WPF 没有这么深入的了解,但为什么它必须始终以这种方式加密...
c# - 将 Grid/FrameworkElement 添加到 ContainerVisual
好吧,这可能是一个奇怪的问题。但正如标题所说,你可以将 Grid 添加到 ContainerVisual。由于 Grid 继承了 Visual,我应该可以通过 Children.Add 来实现。
为什么我需要这个?好吧,我正在使用 FlowDocument 打印报告。这个报告需要有一个标题,由于流文档不支持标题,我决定在分页期间添加标题,使用在互联网上找到的解决方案。
此外,由于我不想手动绘制整个标题但能够在设计器中进行设计时对其进行编辑,因此我将其设计为一个单独的文件作为 Grid 元素。所以我的标题看起来像这样(我缩短了它):
在每次分页调用中,我使用以下代码加载标题:
最后在分页调用中,我将它放在页面中,如下所示:
ImageShow 类只是用代表 bmp 的图像打开新窗口。我正在使用它来查看问题是否存在于为在 DocumentViewer 中显示页面所做的进一步处理中。但由于 ImageShow 不显示标题 Grid,看来我做错了什么。
简而言之: 您能否将 Grid 元素作为子项添加到 ContainerVisual 并正确绘制它。还是我需要手绘?
c# - WPF中FlowDocument打印输出的所有页面中的水印图像
简而言之:谁能帮我打印一个 FlowDocument,它可能跨越多个页面,每页都有相同的水印图像?我当前的实现仅在第一页打印水印。在这种情况下如何做某种模板?
描述:我正在构建一个打印 FlowDocument 的 WPF 应用程序。FlowDocument 包含用作水印的图像,并且文档将根据内容的长度打印在一页或多页中。第一页一切正常。我希望在所有页面中使用相同的图像作为当前没有发生的水印。我想我必须处理 DocumentPaginator 对象,但我不确定如何完成这项工作。是否有人在上述场景中体验过 FlowDocument 打印,听起来像是基于模板的打印?
c# - WPF 中是否可以通过页码获取每个 DocumentPage 的内容?
我使用 DocumentPaginator 将 FlowDocument 的文本分成页面。ComputePageCount() 后是否可以通过页码获取每个页面的内容?如果没有,我该如何以其他方式做到这一点?
代码:
wpf - 文档周围出现空白以进行预览
我有使用打印的 WPF 应用程序。我有从“DocumentPaginator”继承的类
当我从此分页器获得 FixedDocumentSequence 以在打印前预览文档时。“pageSize”属性没有申请这个DocumentPage,并且页面周围有空格我该如何解决这个问题
c# - 使用 WPF DocumentPaginator 打印图像的正确方法是什么
这是我在扩展类中的代码DocumentPaginator
但是,当我实际运行此代码时,它似乎并没有加载我的图像,而只是打印空白页。
加载图像并将其附加到DocumentPage
对象的正确方法是什么?
wpf - WPF DocumentPaginator:将 DocumentPage 大小更改为横向
我尝试使用 DocumentPaginator 以 A4 横向格式(尺寸(96 * 11、96 * 8.5))将 WPF 窗口打印为 pdf 文件(Microsoft Print to pdf),但始终以 A4 纵向格式获取它。(对于 DocumentPaginator,我使用此处描述的方法:WPF - 打印视觉时分页)
错在哪里?除非格式问题它完美无缺。如何调整 DocumentPage 的大小,因为它在 DocumentPage.Size 属性的文档中写入:“备注...使用受保护的 SetSize 方法设置此属性。”?
XAML:
C#:
wpf - WPF PrintPreview 获取 DocumentPaginator 页面的 PageContent
我想为更大的文本编写自己的 PrintPreview,并使用 aDocumentViewer
稍后显示。我没有找到任何对我的问题有用的东西。
目前我正在寻找一种方法来获取各个页面的内容。我找到了一种访问各个页面的方法,但我无法存储或获取它。
使用代码:
我已经为每个现有页面添加了一个新页面,但我无法获取页面的内容。
到目前为止,我知道,我需要UIElement
添加到fixedPage.Children
.
还是有一些更简单的方法可以获取flowdocument
具有许多固定页面的固定文档(取决于页数)?