Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

TWebBrowser and Print

Posted on 2002-03-07
5
Medium Priority
?
635 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 300 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Loops Section Overview
Suggested Courses

916 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