Solved

TWebBrowser and Print

Posted on 2002-03-07
5
479 Views
Last Modified: 2010-04-04
I hope this is an easy one.
I'm using a TWebbrowser component in D6 to display some html pages, and so my question is - "how do I print" the page displayed ?
I've tried printing Form.Print - but that didn't work.
0
Comment
Question by:DelRunner
[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 Comments
 
LVL 26

Accepted Solution

by:
Russell Libby earned 100 total points
ID: 6848529

if (WebBrowser1.QueryStatusWB(OLECMDID_PRINT) and OLECMDF_ENABLED     > 0) then
begin
   WebBrowser1.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DODEFAULT);

// The second option can be changed to one of
// OLECMDEXECOPT_DODEFAULT     0     Use the default
// behavior, whether prompting the user for input or not.
// OLECMDEXECOPT_PROMPTUSER     1     Execute the
// command after obtaining user input.
// OLECMDEXECOPT_DONTPROMPTUSER     2     Execute the
// command without prompting the user.
// OLECMDEXECOPT_SHOWHELP     3     Show help for the
// command, but do not execute it.

end;
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 6849658
var
  vaIn,
  vaOut: OleVariant;
begin
  WebBrowser1.Navigate('http://www.MyAddress.com');
  WebBrowser1.ControlInterface.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, vaIn, vaOut);
end;
0
 
LVL 1

Expert Comment

by:logicthought
ID: 6853568

this will prompt user before print
 WebBrowser.ControlInterface.ExecWB(OLECMDID_PRINT,OLECMDEXECOPT_PROMPTUSER,vInput,vOutput)

this will print immediately
 WebBrowser.ControlInterface.ExecWB(OLECMDID_PRINT,OLECMDEXECOPT_DONTPROMPTUSER,vInput,vOutput);
0
 
LVL 1

Expert Comment

by:logicthought
ID: 6853570
sorry for some reason i didn't get the previos comments before submiting my comment...

0
 
LVL 1

Author Comment

by:DelRunner
ID: 6857595
Thank's for a quick answer !
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

738 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