?
Solved

TWebBrower - Printing Problem

Posted on 2001-07-02
6
Medium Priority
?
937 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
[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
  • 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 1200 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
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…
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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month9 days, 14 hours left to enroll

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