Hi, I'm running VB.Net code that prints the error file using DOS and it is plain text file. I want it to be more informative. I want to print the error file in HTML format with or without pictures or pdf format. Any help is appreciated.


Recommended Answers

All 6 Replies

Try the following tutorial with sample code -


Thanks for the link, it is very helpful in printing the documents. I'm actually trying to print the hTML pages but it prints the source code of the html page, it doesnt print html content. Any suggestions in any methods or software for printing the actual html content is highly appreciated.


Are you using a web control within your application?

Are you using a web control within your application?

I'm using Shell cmd. Here is the code for print
tempCmd = "C:\WINDOWS\system32\cmd /C print / \\\HP LaserJet 4200 PCL 6 C:\Documents and Settings\My Documents\ROES_ERRORS" & temp
Shell(tempCmd, 0)

Other than the code when i right click the html page and hit print, it prints the source code. I'm looking for code that can print the html content or any software that can solve this issue.


If so, use the following -


Public Sub Print

' Prints the current document Imports the current print settings.
Private Sub printButton_Click( _
    ByVal sender As Object, ByVal e As EventArgs) _
    Handles printButton.Click


End Sub

If not, then -

Your best (and, unfortunately, tedious) bet may be to use XSLT - there's good support in the System.Xml.Xsl namespace. Whether that's workable may depend on how well-formed and predictable your document is.

I would suggest using the IE WebBrowser Control to render & then print the file, though i'm not sure about the validity of this approach in light of .NET. there might be something newer & better... MSDN has some info about this:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnie55/html/wb_print.asp?frame=true. Also have a look at http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_22956745.html. This might contain your answer. The following is in asp.net, might help out as well...

and lastly these -




I'm sure there must be an answer for you in there. Happy coding.

Dude I'm using the same method...
for that you should make two HTML files
1. File to store actual HTML format of Invoice
(say original.html) which will act as template
2. File that gonna used over
(say bill_print.html)

1. Copy All from original.html to bill_print.html
2. make changes in bill_print.html
"use some variable text replacment things"
3. navigate webbrowser control to bill_print.html
4. Print webbrowser control
- don't write anything to original.html

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.