Solved

TWebBrower - Printing Problem

Posted on 2001-07-02
6
924 Views
Last Modified: 2012-05-04
Can anyone help me with this problem.  I need to be able to print the contents of a TWebBrowser, but I first need to set it's printer settings (namely, changing it to print in landscape instead of portrait).  I am able to print perfectly well, but I would like to prevent my users from having to change the layout type each time they print.

Is this possible to do?

Thanks in advance,

Stuart.
0
Comment
Question by:SJohnson
  • 3
  • 2
6 Comments
 
LVL 13

Expert Comment

by:Epsylon
ID: 6247457
Try this:


Uses priners;

Printer.Orientation := poLandscape;
0
 
LVL 1

Author Comment

by:SJohnson
ID: 6247473
Hi Epsylon,

Nope.  Didn't work :(  The dialog is still displayed too.  To print, I use: Browser.OleObject.Document.ExecCommand('Print');

I guess that the Document's printer is different to what we can set within Delphi.

I need to print out a stack of different HTML pages, and I only want to display the printer setup dialog box once, not for each page.

Thanks for the input.

Stu.
0
 
LVL 17

Accepted Solution

by:
inthe earned 300 total points
ID: 6247539
hi stu,
dunno how to tell webbrowser to print landscape but to hide the dialog after the first time you could set a boolean variable and check if its set then use:

var
I,O : OleVariant;
begin
 WebBrowser1.ExecWB(OLECMDID_PRINT,OLECMDEXECOPT_DONTPROMPTUSER,I,O);

assuming the dialog will hold the landscape setting for all print jobs.

0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 1

Author Comment

by:SJohnson
ID: 6247570
HOLY **** BARRY IT WORKED!!!!

You're a genius!!!

For an extra 100 points, where did you find that info out??


Stu.
0
 
LVL 17

Expert Comment

by:inthe
ID: 6247731
from newsgroups originally?(its pretty old)

i subscribe to egroups-delphi-webbrowser (recently taken over by yeahaa
http://groups.yahoo.com/group/delphi-webbrowser/
thats where the fellas who made embeddedwb:
http://www.euromind.com/iedelphi/
and author of this site:
http://members.home.com/hfournier/
hang out so probably the best place for finding stuff..
i should mention you should really use embeddedwb ,it has many bugs from ie fixed like the message handling is much better,alot of extra properties also ,it really saves much coding out of the bugs.

Regards Barry


some extras with similarities:

procedure TForm1.copy1Click(Sender: TObject);
var
 I,O : OleVariant;
begin
 WebBrowser1.ExecWB(OLECMDID_COPY,0,I,O);
end;


procedure TForm1.SelectAll1Click(Sender: TObject);
var
I,O : OleVariant;
begin
 WebBrowser1.ExecWB(OLECMDID_SELECTALL,0,I,O);
end;


was hoping there was one of the following for the print dialog cause we could have automated it but unfortunatly theres not :-(

procedure TForm1.Button2Click(Sender: TObject);
var
v : OleVariant;
Sh: ISHellUIHelper;
const
  CLSID_ShellUIHelper: TGUID = '{64AB4BB7-111E-11D1-8F79-00C04FC2FBE1}';
begin
Sh := CreateComObject(CLSID_SHELLUIHELPER) as ISHELLUIHELPER;
Sh.ShowBrowserUI('LanguageDialog', v);
//  or
//sh.ShowBrowserUI('OrganizeFavorites', v);
end;
0
 
LVL 1

Author Comment

by:SJohnson
ID: 6248026
Thanks very much, Barry!  You're a true gentleman and a scholar!

I have book marked the links and will try out your code in the morning.  It's dinner time now :)

Cheers mate!

Stu.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

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…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

770 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