Solved

TWebBrowser and Print

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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Suggested Courses
Course of the Month5 days, 1 hour left to enroll

635 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