Printer API - code inside 
Author Message
 Printer API - code inside

I need some help with setting the orientation, dpi and paper size for a new
printer i created:

    aPrinterInfo.pPrinterName = "XXX"
    aPrinterInfo.pPortName = "FILE:"
    aPrinterInfo.pDriverName = "AdobePS Acrobat Distiller"
    aPrinterInfo.pPrintProcessor = "WinPrint"

    ReDim pPrinterInfo(1 To Len(aPrinterInfo))
    CopyMemory pPrinterInfo(1), aPrinterInfo, Len(aPrinterInfo)

    hPrinter = AddPrinter(vbNullString, 2, pPrinterInfo(1))
'*** Everything up to here works
    If hPrinter <> 0 Then
        retval = DocumentProperties(Me.hwnd, hPrinter, "XXX", 0&, 0&, 0)
        ReDim pDevMode(1 To retval)
        retval = DocumentProperties(Me.hwnd, hPrinter, "XXX", pDevMode(1),
        ' Fill the DevMode type
        Call CopyMemory(aDevMode, pDevMode(1), Len(aDevMode))

        ' Change the settings
        aDevMode.dmPaperSize = DMPAPER_11X17
        aDevMode.dmOrientation = 2
        aDevMode.dmYResolution = 300

        ' Copy the new settings to the ptr
        Call CopyMemory(pDevMode(1), aDevMode, Len(aDevMode))

        ' Call docprop again to get the new settings into the system
        retval = DocumentProperties(Me.hwnd, hPrinter, "XXX", pDevMode(1),
pDevMode(1), _
              DM_IN_BUFFER Or DM_OUT_BUFFER)
        ClosePrinter hPrinter
        MsgBox "error creating printer"
    End If

When i view the details of the new printer none of the new settings are
I have tried:
        aDevMode.dmFields = aDevMode or DM_ORIENTATION Or DM_PAPERSIZE Or

Any help would be greatly appreciated,

Tim H

Fri, 18 Apr 2003 23:55:39 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Need help Printing with API (usefull code inside)

2. Need help Printing with API (usefull code inside)

3. PROBLEM: Adding a printer via API, then creating a printer Share via API (source included)

4. PRINTER : Need API that gives Printable/NonPrintable Area of Printer

5. Changing Printers (was Re: Getz code error/setting printer info)

6. Using HP Printer Escape Sequences (aka Printer Passthrough Codes) in VB.Net

7. Printer.Print and printer control codes?

8. Sending Printer control Codes to printer

9. How to change the printer driver for a defined printer in VB code

10. Sending Printer Control Codes (Escape Codes)

11. Please help me reference an API function declaration from inside a module

12. TreeView API definitions Inside ...


Powered by phpBB® Forum Software