PrintPreviewDialog Control and HTML

D

dvdastor

Hello,

Is there a way that anyone knows of to preview an HTML string and have
it formatted as HTML in a PrintPreviewDialog? In other words, can the
PrintDocument that is required for this render/understand HTML?
Everything that I have seen looks like it will just print out the raw
string and not the rendered HTML.


I know I can do this with a WebBrowser Control and the
ShowPrintPreviewDialog method, but I was hoping to avoid using the
WebBrowser control this time.

Thanks for any help.
 
C

Cor Ligthert [MVP]

Dvdastor,

Why not the webbrowser? Probably every other solution will takes more from
your time.

Just my thought,

Cor
 
D

dvdastor

Cor,

Thanks for the reply. I would love to use the WebBrowser control.
However, i am running into a major snag. I am trying to show a
PrintPreviewDialog with rendered HTML, but I don't want to launch the
form that shows that Web Browser control.

The way I have my code right now, is as follows:

Public Sub PrintPreview(ByVal strHTMLItems As String)
Try

WBControl = New WebBrowser
AddHandler WBControl.DocumentCompleted, AddressOf
WBControl_PreviewDocumentCompleted

WBControl.DocumentText = (strHTMLItems)

WBControl.Height = 800
WBControl.Width = 800

Catch ex As Exception

End Try
End Sub

Private Sub WBControl_PreviewDocumentCompleted(ByVal sender As
Object, ByVal e As WebBrowserDocumentCompletedEventArgs)
'shows the actual preview.
WBControl.ShowPrintPreviewDialog()

End Sub

This runs fine, but it opens the dialog box for the print preview
really small. Even though I set the size to 800 x 800, it does not
resize it.

can you offer any assistance on this?
 
C

Cor Ligthert [MVP]

Dvdastor,

I am not sure anymore of this, but I thought that you could hide it behind a
panel.
Did you try that?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top