473,405 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

PrintPreviewDialog Control and HTML

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.

Oct 5 '06 #1
3 5251
Dvdastor,

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

Just my thought,

Cor

<dv******@yahoo.comschreef in bericht
news:11**********************@i3g2000cwc.googlegro ups.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.

Oct 6 '06 #2
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

<dv******@yahoo.comschreef in bericht
news:11**********************@i3g2000cwc.googlegro ups.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.
Oct 6 '06 #3
Dvdastor,

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

Cor

<dv******@yahoo.comschreef in bericht
news:11**********************@c28g2000cwb.googlegr oups.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

<dv******@yahoo.comschreef in bericht
news:11**********************@i3g2000cwc.googlegr oups.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.

Oct 7 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ramsey Schaffnit | last post by:
Context: I have to print personal information on a preprinted form I've never seen using a printer I've never seen. I want to use a control to overlay the PrintPreview to indicate where I've...
2
by: Michael A. Covington | last post by:
By default, my PrintPreviewDialog is coming out too small. What is the best way to control its size and position? Ideally, I'd just like to maximize it. Thanks!
2
by: Randy | last post by:
Hello all, I'm trying to print using PrintPreviewDialog. What's happening is that the PrintPreviewDialog shows the correct information to be printed, but when I click the print icon, it prints a...
3
by: sachin | last post by:
How to customize PrintPreviewDialog, such that, addition of a new button, change the functionality of existing button should be possible programatically. Sample code will help a lot. Moreover, what...
0
by: Harry J. Smith | last post by:
I am using the PrintPreviewDialog Window Form from the Toolbox. It displays my RichTextBox contents correctly, but when I click on the Print icon on this form it prints one blank page and no text....
4
by: gsb58 | last post by:
Hi! I have a Textbox control on a form and a PrintPreviewDialog. How on earth can I associate the Textbox control with the PrintPreviewDialog, so that the text from the Textbox control will...
2
by: Richard MSL | last post by:
I am using PrintPreviewDialog to preview a file. There is a button that the user can press, which seems to print the file to the default printer. I would like to capture a click on that button so...
10
by: choupi | last post by:
Hello, Is there a way to call a printDialog from a printPreviewDialog (from print icon for example)? Indeed, the print icon in the printpreviewdialog prints directly the document without...
1
by: inpuarg | last post by:
I have a windows form, there are button , textbox label etc. controls on it. and i can programmatically get each of their names. and i also have a printPreviewDialog on a form. I cannot get it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.