Set WebBrowser control to print portrait or landscape

Hi all,

I have a simple windows form application to print a web page using the WebBrowser control.

I just need to know one thing, how to set the orientation of the printed page to landscape or portrait.

Any help is appreciated.

Thanks.
resourcesysAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Meir RivkinFull stack Software EngineerCommented:
did u try to set the property using:
printDialog.Document.DefaultPageSettings.Landscape = true/false
0
resourcesysAuthor Commented:
I tried printDialog.Document.DefaultPageSettings.Landscape but their is no relationship between the printdialog object and the wbebrowser object.
0
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Meir RivkinFull stack Software EngineerCommented:
ru using ShowPrintDialog  to print the content?
0
resourcesysAuthor Commented:
Hi sedgwick,

No, I am using the WebBrowser.Print() method.

I need to print the web page automatically, without the user having to select any options.

If it makes any difference, the printer is PDFCreator as I am turning the webpage into a PDF document.

Thanks.
0
resourcesysAuthor Commented:
Hi all,

I finally have a solution:

I downloaded an .exe file called PageSet.exe from the following location: http://support.microsoft.com/kb/198901

I registered the .dll file contained and then added either obj.ChngOrientationLandscape or obj.ChngOrientationPortrait before calling the print method against the web browser object.

Check out the link for more information.

Thanks for the replies.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
peteredmCommented:
reourcesys, does the dll need to be registered on just your development machine or all user machines?
0
resourcesysAuthor Commented:
Hi peteredm,

The application I developed runs only on one computer, the main server, as such, we only registered the .dll on that server.

In short, the .dll would need to be registered on any computer where the application is to be run.

Hope this helps.
0
peteredmCommented:
Afraid not, for a windows app that could be used on any machine in our organisation (hospital).

Looked into modifying the registry but can only find page orientation for ie5 & 6 not 7 which is what's used here. CSS3 don't work until ie9..

At a loss on this one...
0
peteredmCommented:
set-up is as below if anyone's got any thoughts

vb.net (v2) windows application
html document in a webbrowser control

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.