views:

437

answers:

1

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.

+1  A: 

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.

tommieb75
@tommieb75: Thanks for the reply! Acutally I am letting the browser handle the printing for me and I think that's what is causing the issue. I'm not sure why but it won't print the entire report over multiple pages. It just stops at a certain point. I'm just using the native print methods within the control.
Scott Vercuski
@Scott Vercuski: Oh...Now I understand, I am not sure now how would you do this...but have a look here...http://www.codeproject.com/KB/printing/custom_paper_sizes.aspx,other than that I am stumped..I would imagine that there would be an option via p/invoke to force the print layout over multiple pages. I have not seen IE doing this... :( Sorry if I cannot help you any further..
tommieb75
@tommieb75: That's ok ! I appreciate the effort ! I'll dig into the printing link and see where that leads me. Thanks again.
Scott Vercuski