[英]c# webbrowser control printing
I'm using the web browser control in an application to display a report. 我在应用程序中使用Web浏览器控件来显示报表。 The report is just straight HTML text but is fairly wide.
该报告只是直接的HTML文本,但相当广泛。 When I preview the print using the
.ShowPrintPreviewDialog()
I see that the report is truncated on the right hand side, even when switched to landscape mode. 当我使用
.ShowPrintPreviewDialog()
预览打印时,我看到报告在右侧被截断,即使切换到横向模式也是如此。
Currently I am only calling the .ShowPrintPreviewDialog()
method and then calling the .ShowPrintDialog()
method to actually print the report. 目前我只调用
.ShowPrintPreviewDialog()
方法,然后调用.ShowPrintDialog()
方法来实际打印报告。
My question is ... how do I get the report to print over multiple pages? 我的问题是......如何让报告在多个页面上打印? I'm perfectly fine with spanning the report over X number of pages in landscape mode but I'm not sure what flag to set or how to set the control to actually split the report over multiple pages.
我完全可以在横向模式下跨越X页数覆盖报告,但我不确定要设置什么标志或如何设置控件以实际将报告分割为多个页面。
Why not let the webbrowser control handle the printing for you. 为什么不让webbrowser控件为您处理打印。 I have successfully done this where a report data was in xml, and applied a xslt transformation to html and used the webbrowser control to display the report and let the user make the choice in printing it.
我已成功完成此操作,其中报告数据为xml,并将xslt转换应用于html并使用webbrowser控件显示报告并让用户在打印时做出选择。 Here is a link to CodeProject on this webbrowser wrapper .
以下是此webbrowser包装器上CodeProject的链接。 There is a method in there to do a print (which includes the print preview as rendered by the control itself).
在那里有一种方法可以进行打印(包括由控件本身呈现的打印预览)。
Hope this helps, Best regards, Tom. 希望这会有所帮助,最好的问候,汤姆。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.