Changing printer papersize at runtime
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Changing printer papersize at runtime

  1. #1
    Join Date
    Apr 2014
    Posts
    4

    Changing printer papersize at runtime

    Hi,
    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
    Posts
    5

    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
    Posts
    4

    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
    Next
    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
    Posts
    5

    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

This is a CodeGuru survey question.


Featured


HTML5 Development Center