Solved

Automatically printing HTML pages

Posted on 2002-04-26
13
215 Views
Last Modified: 2008-02-01
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 ?
0
Comment
Question by:milsy
  • 5
  • 3
  • 3
  • +1
13 Comments
 

Accepted Solution

by:
Leandro earned 200 total points
ID: 6973142
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
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6977458
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
 

Expert Comment

by:Leandro
ID: 6977623
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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6977850
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
 

Expert Comment

by:Leandro
ID: 6978284
Anhony, is it possible to turn an answer into a comment to unlock the question ?
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6978736
The only way I am familiar with is when the questioner rejects an answer.

Anthony
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6979454
hearing...
0
 

Author Comment

by:milsy
ID: 7005582
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
 

Expert Comment

by:Leandro
ID: 7006914
I'm glad I could help you. Thanks for the poins.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7007006
Strange, code provided works fine and you give "B" grade?
0
 

Author Comment

by:milsy
ID: 7008133
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
 

Expert Comment

by:Leandro
ID: 7008362
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
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7008402
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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Updates not working for MS Windows 7 12 181
maro to copy and paste from one worksheet to another based on a condition 11 55
How to Add / Edit Windows Menu 4 68
Advice in Xamarin 21 97
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question