How to set printer settings in code behind in vb.net2.0?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bhappy
    New Member
    • Jul 2007
    • 139

    How to set printer settings in code behind in vb.net2.0?

    Hai All,

    I want to set printer settings in code behind like Landscope="true " and page scalling="Fit to page", bcuz im having more columns in my datagrid.

    Thanks,

    Aswath.
  • DrBunchman
    Recognized Expert Contributor
    • Jan 2008
    • 979

    #2
    Hi Aswath, this snippet will set the default printer to landscape for the document. Note that this will apply to the server and not the client machine.

    Code:
     Dim printDoc As New System.Drawing.Printing.PrintDocument printDoc.PrinterSettings.DefaultPageSettings.Landscape = True
    Hope this helps,

    Dr B

    Comment

    • bhappy
      New Member
      • Jul 2007
      • 139

      #3
      Hai,

      Thanks for replay,

      currently im using javascript code <script window.print> Here it will open print dialog box but user donot select landscape option then he won't get last columns..?Any idea for this plz............ ...

      Thanks,
      Aswath.

      Comment

      • DrBunchman
        Recognized Expert Contributor
        • Jan 2008
        • 979

        #4
        I don't believe it's possible (but am not 100%) because the printer settings are part of the client machines config which you can't normally get access to for security reasons.

        You may have to settle for some sort of message telling the user to select landscape. And after all, if they print it out in portrait what's the worst that could happen? They'll just have to do it again!

        Sorry I couldn't be more helpful,

        Dr B

        Comment

        • bhappy
          New Member
          • Jul 2007
          • 139

          #5
          Hai,

          Thanks for ur response,

          I got new problem now, that is i increased no.of columns and now my datagrid contain nearly 30 columns, and if i select landscape option also im not getting last columns, Is there any way to get last columns in 2nd page........

          Thanks,
          Aswath.

          Comment

          Working...