CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2014

    Changing printer papersize at runtime

    We are using a application which needs to print 2 types of documents. one is A4 and another one is custom made which has width lesser than A4. So we need to automatically change the papersize at runtime. How we can do that?? Please help.
    Thank you

  2. #2
    Join Date
    Jan 2014

    Re: Changing printer papersize at runtime

    <printer.papersize=vbprpsa4> or <printer.papersize=vbprpsa3> 'or http://msdn.microsoft.com/en-us/libr...papersize.aspx

    <printer.orientation=1> '1=portrait 2=landscape

  3. #3
    Join Date
    Apr 2014

    Re: Changing printer papersize at runtime

    We are trying to use this code for changing papersize to A4 befor printing report.
    Dim x1 As Printer
    For Each x1 In Printers
    If x1.DeviceName = Printer.DeviceName Then
    Set printer as system default.
    Set Printer = x1
    Stop looking for a printer.
    Exit For
    End If
    Printer.PaperSize = 9 'for changing to A4 papersize
    report1.Show vbModal
    report2.Show vbModal
    Printer.PaperSize = 122 'for changing to custom papersize
    But its not working. It still says report width is higher. If we manually change papersize to A4 then no problem at all. Why is this code not working?? please help

  4. #4
    Join Date
    Jun 2014

    Re: Changing printer papersize at runtime

    PaperSize=122? As far as I know custom form is 256. At least ?vbPRPSUser shows me 256.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.