Solved

TWebBrowser and Print

Posted on 2002-03-07
5
388 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

930 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now