Landscape printing

  • Thread starter Thread starter lord.zoltar
  • Start date Start date
L

lord.zoltar

Hi, I'm trying to print a text report from an application. It works
fine, except in landscape mode, which it seems to ignore. I have a
function that handles the PrintPage even for the PrintDocument, and I
even tried forcing it to print in landscape mode by adding:
ev.PageSettings.Landscape = True
(where ev is the parameter: ByVal ev As
System.Drawing.Printing.PrintPageEventArgs)
I also tried
printDoc.DefaultPageSettings.Landscape = True
(where printDoc is a PrintDocument that is going to be printed)

But it does not print in portrait/landscape mode. I'm not sure why.
This is kinda serious because several reports are required to be in
landscape mode only.

I'm using VB 2005, and the report's data source is a simple (but wide
;) ) text file.
 
I fixed the problem:

It seems I have to set landscape mode BEFORE I set the PrintPage event
handler, like this:
....
Me.printDoc.DefaultPageSettings.Landscape = True
AddHandler printDoc.PrintPage, AddressOf printPage
....

Well, hope this helps anyone else.
 
Back
Top