Private Sub document_PrintPage(ByVal sender As Object, _
ByVal e As System.Drawing.Printing.PrintPageEventArgs) _
Handles docToPrint.PrintPage
' Insert code to render the page here.
' This code will be called when the control is drawn.
' The following code will render a simple
' message on the printed document.
'Dim text As String = "In document_PrintPage method."
'Dim printFont As New System.Drawing.Font _
' ("Arial", 35, System.Drawing.FontStyle.Regular)
'' Draw the content.
'e.Graphics.DrawString(text, printFont, _
' System.Drawing.Brushes.Black, 10, 10)
End Sub
I have code to display a printer dialog box that will call this procedure to render a document for printing. The document I want to print is accessible from a URL as an HTML webpage, and the webpage is understood to be available for printing. The sample code above, for rendering strings only, will not do what I need. I was thinking of using system.drawing.graphics.drawimage
, if that can be made to work. Any ideas? I'm having trouble fully picturing the process of converting the HTML page to an image datatype. If that's not necessary, all the better.