CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2000
    Posts
    20

    Some API functions for printer

    Hi,
    Some printers that I could set the pagesize to User-defined and set the printer.width and printer.height. But some printer does not let me to do these kinds of settings. I did some research about it, and it said that it has to do with the printer's driver.
    I am wondering if any API functions that I can set the page size to 5' x 3'?
    Your answer will be valuable to me.

    Thank you very much!


  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: Some API functions for printer


    Const DC_PAPERS = 2
    private Declare Function DeviceCapabilities Lib "winspool.drv" Alias "DeviceCapabilitiesA" (byval lpDeviceName as string, byval lpPort as string, byval iIndex as Long, lpOutput as Any, lpDevMode as Any) as Long
    private Sub Form_Load()
    'KPD-Team 1999
    'URL: http://www.allapi.net/
    'E-Mail: [email protected]
    Dim Ret as Long, PaperSizes() as Integer
    Ret = DeviceCapabilities(Printer.DeviceName, "LPT1", DC_PAPERS, byval 0&, byval 0&)
    ReDim PaperSizes(1 to Ret) as Integer
    Call DeviceCapabilities(Printer.DeviceName, "LPT1", DC_PAPERS, PaperSizes(1), byval 0&)
    me.AutoRedraw = true
    me.print "Supported papersizes:"
    Dim Cnt as Long
    for Cnt = 1 to Ret
    me.print Str$(PaperSizes(Cnt))
    next
    End Sub





    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
    and all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

    The Rater
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured