Solved

VB6 HTML OCX - other than using Internet Explorer?

Posted on 2010-11-30
9
459 Views
Last Modified: 2012-05-10
I'm looking for a library that will render an HTML page and allow it to be printed.

Functionality to be like using IE via the VB6 Web browser control, but NOT using IE.

I'm having issues trying to properly trap errors generated from IE, so need something that is running in-process and without the IE overhead.

User display is not needed.


Does anyone know of such a control?



Thanks.
0
Comment
Question by:StuckInTheMud
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 45

Expert Comment

by:aikimark
ID: 34251148
what about the WinInet control?

What compatibility level of rendering do you need?

Does the user need to see the rendered page or do you just need to print the page?

What are you trying to do by printing the page? (problem context)
0
 

Author Comment

by:StuckInTheMud
ID: 34251187
I'm creating a simple report (just paragraphs & tables and bit of in-line styling) in HTML and then just printing it.

Base HTML comes from a pre-prepared template, it's warehouse picking notes which should give you a good idea about the simplicity of layout!

No requirement to see the page.

So I need something that is going to interpret the HTML and render it correctly on a printed page.
0
 
LVL 45

Expert Comment

by:aikimark
ID: 34251424
Why don't you use the default browser to do the print?  I don't see any need to do any rendering in your VB6 application.

Your application could Shell() the necessary DOS command string to cause the HTML file to be printed.  There are two ways you might do this.

* use the default browser's file association (your command string will need to start with CMD.EXE
* find the path of the default browser in the registry and use that as the program you launch.
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

Author Comment

by:StuckInTheMud
ID: 34251665
Problem is trapping errors, e.g. if the print server isn't available and the print function hangs and eventually times out.

Running external processes (web browser control or shell) will just return "automation error" or similar, which is very difficult to sensibly trap and recover from, hence wanting to run it in-process.



Jim
0
 

Author Comment

by:StuckInTheMud
ID: 34251690
Additional info - I have been using the web browser control in the application for some while (year+) so looking to improve on what we have and give a better "user experience" when there are system problems.
0
 
LVL 45

Expert Comment

by:aikimark
ID: 34251993
Here are some options to consider.
* use a more intelligent print server that queues print jobs
* look at the print server event log entries for problems, taking action as necessary.  You should probably institute a process that notes which documents were to be printed and then reprint any documents that weren't printed.  This creates a feedback mechanism for your application.
* Introduce an intermediate process that might be more resilient.  For instance, you might do your application printing to PDF documents in a server directory.  Then you would have a separate process that would physically print and then delete-after-print the PDF files.
0
 

Author Comment

by:StuckInTheMud
ID: 34253355
Thanks, but we have already been round the loop on other options.

To answer you suggestions.

(1) It does queue (Windows server), just occasionally occasionally the server is off-line which is what we are trying to trap.

(2) Not feasible, as the print is on demand from a real-time ordering system in a call centre.

(3) As 2, it's an on-demand system so printing to PDF and then queuing introduces an unacceptable time delay.


I guess from the replies that using an out-of-process browser is really the only way of printing an HTML document and a library to do the job doesn't exist.
0
 
LVL 45

Accepted Solution

by:
aikimark earned 125 total points
ID: 34253423
If you are trying to trap the print server not ready condition, you might try to write a 'header page' (only has to be a single line) with your VB6 code.
0
 

Author Closing Comment

by:StuckInTheMud
ID: 34368040
Not exactly what I was looking for, but suggestions have been useful
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

691 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