Automatically printing HTML pages

I have a site which displays application forms in HTML on a private entry web site.

I am trying to build a VB application that will go to the most recently received application on the site and send the HTML content straight to the printer with no user intervention (don't want the print dialog box to appear).

I may also need to set the printer's page orientation to Landscape in order to optimise the printed output.

I am planning to use an embedded Internet Explorer page in the VB form to receive the HTML and then send the rendered output to the printer. the contents will be rendered in an IFrame.

Am I mad doing things this way ? Is there a better or easier way of doing this ?
milsyAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
LeandroConnect With a Mentor Commented:
You can use de WebBrowser (SHOWDOCVW.dll) control's Navigate method to show the html document.

  And then invoke the ExecWb method to print the page:

    Webbrowser.ExecWb OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, NULL, NULL

  Where OLECMDID_PRINT = 6 and OLECMDEXECOPT_DONTPROMPTUSER = 2.

  It will print the page without propmting anything to the user.

  To set the printer's orientation you use this code:

  Printer.Orientation = vbPRORLandscape

I hope it helps you, and sorry for my poor english.
0
 
Anthony PerkinsCommented:
Leandro,

Welcome to EE. Please do not lock questions with answers.  If you are unsure of the policy, re-read the EE Guidelines (http://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp)

Anthony
0
 
LeandroCommented:
Anthony,
 I've got your point, but if you don't want that someone lock the question, why to create a system that does that, I think my answer is clear and specifc, and I agree that locking the question is not good, so if we must always put comments, why to keep this "answer" loking system?
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Anthony PerkinsCommented:
That is a question best directed at Community Support (http://www.experts-exchange.com/commspt/), but I believe your question is one of the most frequently asked questions.

Anthony
0
 
LeandroCommented:
Anhony, is it possible to turn an answer into a comment to unlock the question ?
0
 
Anthony PerkinsCommented:
The only way I am familiar with is when the questioner rejects an answer.

Anthony
0
 
Richie_SimonettiIT OperationsCommented:
hearing...
0
 
milsyAuthor Commented:
Thanks Leandro. Your English is good enough for me to understand the given answer so don't worry.

I had tried using the Webrowser control before asking the question but I hadn't managed to get the OLECMDEXECOPT_DONTPROMPTUSER option to work.

Thanks again.

Shane
0
 
LeandroCommented:
I'm glad I could help you. Thanks for the poins.
0
 
Richie_SimonettiIT OperationsCommented:
Strange, code provided works fine and you give "B" grade?
0
 
milsyAuthor Commented:
The point is Richie that I still haven't got the DONTPROMTUSER option to work and as I need this to act as a robotic process then I haven't quite reached the answer I was originally hoping for... hence the the "B" grade... a good answer but not a total solution.

Shane
0
 
LeandroCommented:
Oh, and I forgot to tell you that some things just don't work in Vb, and this is an example: the OLECMDEXECOPT_DONTPROMPTUSER flag does not work, I am sorry, but I have forgotten this.
0
 
Richie_SimonettiIT OperationsCommented:
That flag depends upon which version of IE you have. In IE4 and 5.0, it works (if i remember well), if you have latter version, IE doesn't cares about it and shows the dialog anyway.
But, if you need more help, don't accept a comment until matter is resolved at your wishes or you found that it is impossible to do.
Anyway, you can avoid it not using IE objects.
Cheers
0
All Courses

From novice to tech pro — start learning today.