简体   繁体   中英

c# webbrowser control printing

I'm using the web browser control in an application to display a report. The report is just straight HTML text but is fairly wide. 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.

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

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.

Why not let the webbrowser control handle the printing for you. 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. Here is a link to CodeProject on this webbrowser wrapper . 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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