C # webbrowser print management

I am using a web browser control in an application to display a report. The report is plain text, but quite wide. When I look at the print using .ShowPrintPreviewDialog(), I see that the report is truncated on the right side, even if it is switched to landscape mode.

Currently, I only call the method .ShowPrintPreviewDialog(), and then I call the method .ShowPrintDialog()to actually print the report.

My question is: how do I get a report to print on multiple pages? I do a great job with covering the report by X number of pages in landscape mode, but I'm not sure which flag to set or how to set the control to actually split the report into several pages.

+3
source share
1 answer

Why don't you let you control your web browser for printing. I successfully did this when the report data was in xml, and applied the xslt to html conversion and used the webbrowser control to display the report and allowed the user to make a choice when printing it. Here is a link to CodeProject for a web browser wrapper . There is a method for printing (which includes a print preview displayed by the control itself).

Hope this helps, Regards, Tom.

+2
source

Source: https://habr.com/ru/post/1725399/


All Articles