By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,011 Members | 1,000 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,011 IT Pros & Developers. It's quick & easy.

HTML Printing Options

P: n/a
Hi,

My back is against the wall and I've tried to figure out something to do.
Here is my scenario:

I have an automated process running in a service that generates HTML files.
Each resulting file can be sent to one of the printers on the network -- not
necessarily the default. It would seem that the AxWebBrowser control would
be a good way to print the files, however, it only prints to the default
printer for that user when you issue the ExecWB command.

Here is the process:

1. Data is received from a data source
2. Each row is used to create the HTML file and also defines its
destination.
3. An HTML file is created;
4. The HTML file is delivered/printed, etc. to the destination specified in
that row of data.
5. Go back to #2 until there are no rows left.

Right now, I'm looking for any thoughts on how I can do this. I don't care
if I have to write a C++ object and use Interop to use it. The best case
scenario seems to be to get something that will print HTML to a dynamic
printer location. Here are some things I have thought of:

A. Have another service that would monitor a "spool" type of a directory.
When the HTML file is generated, it would be put into that directory with an
XML file defining where it should go. The service would read that
information and change the registry defining the default printer, page
settings, etc. It would open an instance of the AxWebBrowser control, print
the document, and destroy the control.

B. Somehow use MSOHTMED (Microsoft Office's HTML editor component). By
looking a the "print" command for HTML file types in folder options, I see
this command: "<path>/msohtmed.exe /p %1" Unfortunately, I don't see where
you could specify the destination with this solution unless I modify the
registry ahead of time similar to option A.

C. Automate Microsoft Word. Through Word automation, I can specify the
printer destination, document settings (page size, etc.) directly through
code. This would require Office to be installed on the server, however.

D. Somehow, convert to PCL, then print the PCL to a raw location. This
would follow a similar train of thought as option A, but how do I convert
HTML to PCL? Use a print driver? I thought of defining a printer that
prints to a file, but that always prompts for a filename. If there was a
way I could dynamically specify a filename, that would be good.

Anyway, any help would be absolutely wonderful. If possible, I would like
to avoid solutions that are very expensive. If there is a control or a
library out there that would help, I would certainly like to look at it.

Thank you in advance,
cj

Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Take a look at some of the offerings from http://www.activepdf.com/,
specifically:

"activePDF WebGrabber™ is the industry leader in scalable, multithreaded
URL-to-PDF or HTML-to-PDF generation. Whether converting static HTML
files or dynamic, data-driven web-based reports, WebGrabber provides the
functionality and control needed to create secure, useable, and
printable PDF files."

and

"activePDF Spooler™ allows you to redirect PDF documents to any printer
on your network, without requiring any end-user intervention!"

I haven't used these particular products, but I've worked with some of
their other tools and they seem reliable and pretty-well documented.

-Jason
Curtis Justus wrote:
Hi,

My back is against the wall and I've tried to figure out something to do.
Here is my scenario:

I have an automated process running in a service that generates HTML files.
Each resulting file can be sent to one of the printers on the network -- not
necessarily the default. It would seem that the AxWebBrowser control would
be a good way to print the files, however, it only prints to the default
printer for that user when you issue the ExecWB command.

Here is the process:

1. Data is received from a data source
2. Each row is used to create the HTML file and also defines its
destination.
3. An HTML file is created;
4. The HTML file is delivered/printed, etc. to the destination specified in
that row of data.
5. Go back to #2 until there are no rows left.

Right now, I'm looking for any thoughts on how I can do this. I don't care
if I have to write a C++ object and use Interop to use it. The best case
scenario seems to be to get something that will print HTML to a dynamic
printer location. Here are some things I have thought of:

A. Have another service that would monitor a "spool" type of a directory.
When the HTML file is generated, it would be put into that directory with an
XML file defining where it should go. The service would read that
information and change the registry defining the default printer, page
settings, etc. It would open an instance of the AxWebBrowser control, print
the document, and destroy the control.

B. Somehow use MSOHTMED (Microsoft Office's HTML editor component). By
looking a the "print" command for HTML file types in folder options, I see
this command: "<path>/msohtmed.exe /p %1" Unfortunately, I don't see where
you could specify the destination with this solution unless I modify the
registry ahead of time similar to option A.

C. Automate Microsoft Word. Through Word automation, I can specify the
printer destination, document settings (page size, etc.) directly through
code. This would require Office to be installed on the server, however.

D. Somehow, convert to PCL, then print the PCL to a raw location. This
would follow a similar train of thought as option A, but how do I convert
HTML to PCL? Use a print driver? I thought of defining a printer that
prints to a file, but that always prompts for a filename. If there was a
way I could dynamically specify a filename, that would be good.

Anyway, any help would be absolutely wonderful. If possible, I would like
to avoid solutions that are very expensive. If there is a control or a
library out there that would help, I would certainly like to look at it.

Thank you in advance,
cj

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.