Solved

TWebBrowser and Print

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 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

19 Experts available now in Live!

Get 1:1 Help Now