0
Hello. Referent: Windows Forms.
I have a Webbrowser control on a form that is displayed to the user. This Webbrowser displays an HTML document in its Documenttext property. I can display the form perfectly, but when printing the orientation: Landscape is what I want to define.
What I’ve already tried: Create a Printdocument control and assign Webbrowser HTML, so you could configure the page in the Printdocument properties. Unfortunately it is not possible to transfer from a String to Drawing.Printdocument;
What might solve, I don’t know if I’m on the right track: A Printdialog control that will receive page settings. Apparently you need a Printdocument with the page settings, but return to the problem of the previous paragraph
Below is the code that displays the form, where dhtml is from the Stringbuilder class:
FrmVisualizadorHTML f = new FrmVisualizadorHTML(dHTML.ToString());
f.ShowDialog();
Form Frmvisualizadorhtml
public partial class FrmVisualizadorHTML : Form
{
private string DocHtml;
public FrmVisualizadorHTML(string HtmlParaMostrar)
{
InitializeComponent();
DocHtml = HtmlParaMostrar;
}
private void FrmVisualizadorHTML_Load(object sender, EventArgs e)
{
webBrowser.DocumentText = DocHtml;
}
}
I am printing the document using the standard Crtl+P shortcut.