Home All Groups Group Topic Archive Search About

PrintPreviewDialog Control and HTML

Author
5 Oct 2006 4:26 PM
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.

Author
6 Oct 2006 3:56 AM
Cor Ligthert [MVP]
Dvdastor,

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

Just my thought,

Cor

<dvdas***@yahoo.com> schreef in bericht
Show quoteHide quote
news:1160065617.995007.233190@i3g2000cwc.googlegroups.com...
> 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.
>
Author
6 Oct 2006 2:04 PM
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?

Cor Ligthert [MVP] wrote:
Show quoteHide quote
> Dvdastor,
>
> Why not the webbrowser? Probably every other solution will takes more from
> your time.
>
> Just my thought,
>
> Cor
>
> <dvdas***@yahoo.com> schreef in bericht
> news:1160065617.995007.233190@i3g2000cwc.googlegroups.com...
> > 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.
> >
Author
7 Oct 2006 6:51 AM
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

<dvdas***@yahoo.com> schreef in bericht
Show quoteHide quote
news:1160143478.185196.122570@c28g2000cwb.googlegroups.com...
> 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?
>
> Cor Ligthert [MVP] wrote:
>> Dvdastor,
>>
>> Why not the webbrowser? Probably every other solution will takes more
>> from
>> your time.
>>
>> Just my thought,
>>
>> Cor
>>
>> <dvdas***@yahoo.com> schreef in bericht
>> news:1160065617.995007.233190@i3g2000cwc.googlegroups.com...
>> > 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.
>> >
>