+ All Categories
Home > Documents > APD4 T81 Devmode E RevE

APD4 T81 Devmode E RevE

Date post: 20-Feb-2018
Category:
Upload: fernando
View: 222 times
Download: 0 times
Share this document with a friend

of 28

Transcript
  • 7/24/2019 APD4 T81 Devmode E RevE

    1/28

    Devmode API /

    PRINTERINFO Manual

    Advanced Printer Driver for TM-T81 Ver.4

    Outline of Devmode API and PRINTERINFO.

    How to use the Devmode API.

    About Devmode API in Win32 environment andthe functions of TM-T81.

    About PRINTERINFO.

    About Devmode API used under .NET environment.

    M00003704

    Rev.E

    Overview

    How to Use Devmode API

    Reference for Win32

    Reference for .NET

    PRINTERINFO

  • 7/24/2019 APD4 T81 Devmode E RevE

    2/28

    Cautions

    No part of this document may be reproduced, stored in a retrieval system, or transmitted in any form or

    by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written

    permission of Seiko Epson Corporation.

    The contents of this document are subject to change without notice. Please contact us for the latest

    information.

    While every precaution has taken in the preparation of this document, Seiko Epson Corporation assumes

    no responsibility for errors or omissions.

    Neither is any liability assumed for damages resulting from the use of the information contained herein.

    Neither Seiko Epson Corporation nor its affiliates shall be liable to the purchaser of this product or third

    parties for damages, losses, costs, or expenses incurred by the purchaser or third parties as a result of:

    accident, misuse, or abuse of this product or unauthorized modifications, repairs, or alterations to this

    product, or (excluding the U.S.) failure to strictly comply with Seiko Epson Corporations operating and

    maintenance instructions.

    Seiko Epson Corporation shall not be liable against any damages or problems arising from the use of anyoptions or any consumable products other than those designated as Original EPSON Products or EPSON

    Approved Products by Seiko Epson Corporation.

    Trademarks

    EPSONand ESC/POSare registered trademarks of Seiko Epson Corporation in the U.S. and other coun-

    tries.

    MS-DOS, Microsoft, Win32, Windows, Windows Vista, Windows Server, Visual Studio, Visual Basic,

    Visual C++, and Visual C#are either registered trademarks or trademarks of Microsoft Corporation in the

    United States and other countries.

    ESC/POSCommand System

    EPSON leads the printer business by ESC/POS, the original POS printer command system. ESC/POS imple-

    ments a lot of original commands, some of them have patents, and makes it possible to build a high-

    expandability and versatile POS system. It also has a compatibility for all the EPSON POS printers (excluding

    TM-C100) and display devices and a flexibility of unique control system so that it is easy to upgrade the sys-

    tem in the future easily. The function and user-friendliness is valued all over the world.

    Copyright 2008-2010 Seiko Epson Corporation. All rights reserved.

  • 7/24/2019 APD4 T81 Devmode E RevE

    3/28

    3

    For Safety

    Key to Symbols

    Thesymbolsinthismanualareidentifiedbytheirlevelofimportance,asdefinedbelow.Readthe

    followingcarefullybeforehandlingtheproduct.

    Restriction of UseWhenthisproductisusedforapplicationsrequiringhighreliability/safetysuchastransportation

    devicesrelatedtoaviation,rail,marine,automotiveetc.;disasterpreventiondevices;varioussafety

    devicesetc;orfunctional/precisiondevicesetc,youshouldusethisproductonlyaftergiving

    considerationtoincludingfailsafesandredundanciesintoyourdesigntomaintainsafetyandtotal

    systemreliability.Becausethisproductwasnotintendedforuseinapplicationsrequiringextremely

    highreliability/safetysuchasaerospaceequipment,maincommunicationequipment,nuclearpower

    controlequipment,ormedicalequipmentrelatedtodirectmedicalcareetc,pleasemakeyourown

    judgmentonthisproductssuitabilityafterafullevaluation.

    About this Manual

    Aim of the Manual

    Thismanualisaimedtoprovideallthenecessaryinformationfordevelopmentengineersto

    develop,design,andinstallPOSsystem,ortodevelopanddesignprinterapplications.

    Manual Content

    Themanualismadeupofthefollowingsections:

    Provides information that must be observed to avoid damage to your equipment or a

    malfunction.

    Provides important information and useful tips.

    Chapter 1 Overview

    Chapter 2 How to Use Devmode API

    Chapter 3 Reference for Win32

    Chapter 4 Reference for .NET

    Chapter 5 PRINTERINFO

  • 7/24/2019 APD4 T81 Devmode E RevE

    4/28

    4

  • 7/24/2019 APD4 T81 Devmode E RevE

    5/28

    5

    Contents

    For Safety...............................................................................................................................3Key to Symbols ....................................................................................................................................... 3

    Restriction of Use ..................................................................................................................3

    About this Manual ................................................................................................................3

    Aim of the Manual................................................................................................................................. 3

    Manual Content .................................................................................................................................... 3

    Contents ................................................................................................................................ 5

    Overview ........................................................................................7

    Contents of This Manual ....................................................................................................................... 7

    Devmode API Overview.......................................................................................................8

    Devmode API Functions........................................................................................................................ 8

    Provided File..........................................................................................................................8

    Sample Program .................................................................................................................................... 8

    Operational Environment.....................................................................................................9

    OS ............................................................................................................................................................ 9

    .NET Framework Version ........................................................................................................................ 9

    How to Use Devmode API ...........................................................11

    Sequence............................................................................................................................11

    Devmode API Development Information .........................................................................14

    Character Code.................................................................................................................................. 14

    Devmode Type .................................................................................................................................... 14

    Memory Allocation.............................................................................................................................. 14

    Multi-process/Multi-thread/Multi-user................................................................................................ 15

    Error Code............................................................................................................................................. 15

    Reference for Win32 ....................................................................17

    Functions for TM-T81 ...........................................................................................................17

    APDDM_OpenW..................................................................................................................17

    APDDM_GetRange .............................................................................................................18

    APDDM_GetData ................................................................................................................18

    APDDM_SetData .................................................................................................................19

    APDDM_GetDevModeW.....................................................................................................19

  • 7/24/2019 APD4 T81 Devmode E RevE

    6/28

    6

    APDDM_Close..................................................................................................................... 20

    Command ID ...................................................................................................................... 21

    APD_DM_PAPER_SIZE............................................................................................................................21APD_DM_ORIENTATION........................................................................................................................21

    APD_DM_PAPERSAVE ...........................................................................................................................21

    APD_DM_INPUT_UNIT............................................................................................................................21

    APD_DM_PAPER_BIN.............................................................................................................................22

    APD_DM_SPEED_DEVICE......................................................................................................................22

    APD_DM_REPLACEFONT ......................................................................................................................22

    Reference for .NET........................................................................23

    OpenW ................................................................................................................................ 23

    GetRange............................................................................................................................ 24

    GetData .............................................................................................................................. 24

    SetData................................................................................................................................ 25

    GetDevModeW................................................................................................................... 25

    Close ................................................................................................................................... 26

    PRINTERINFO .................................................................................27

    Acquiring TM Printer Status Using PRINTERINFO_2 ........................................................... 27

  • 7/24/2019 APD4 T81 Devmode E RevE

    7/28

    Chapter 1 Overview

    7

    1

    OverviewThismanualdescribesDevmodeAPIandPrinterInfo.

    DevmodeAPIforAPDprovidesafunctiontoacquire/setupdeviceuniqueDevmodefrom

    usersapplication.ParametersandsettingrangeofcommandIDs(functionsofDevmodeAPI)

    areacquiredfromthedevice,andtheparameterissettothedevicebytheapplication.

    PRINTERINFOisoneofWindowsstructures.InadditiontoStatusAPIprovidedbyEPSONto

    acquireTMprinterstatusbytheuserapplication,Windowsfunctionscanbeusedforthat

    purpose.ForPRINTERINFOinformation,refertoAcquiringTMPrinterStatusUsing

    PRINTERINFO_2onpage27.Fordetails,refertotheMicrosoftwebsite.

    Contents of This Manual

    Install manualDescriptionsoftheproceduresfrominstallingtheAPDtoperformingtestprint,addingprinterdrivers,changingport,andthesilentinstallationthatisanautomatedAPDinstallation.

    TM Printer ManualDescriptionsofhowtousetheAPDanditsfunctions.DescriptionsofthespecificationsofTMT81.

    Status API ManualDescriptionsofhowtoacquirethestatusoftheTMprinterfromtheuserapplicationbyusingtheStatusAPI.

    Devmode API / PRINTERINFO Manual

    Thismanual.DescriptionsofhowtosetsomefunctionsofprinterfromtheuserapplicationbyusingDevmodeAPI.DescriptionsofthePRINTERINFOFunctionofWindows.

  • 7/24/2019 APD4 T81 Devmode E RevE

    8/28

    8

    Devmode API Overview

    Thissection

    explains

    the

    functions

    of

    Devmode

    API

    and

    applicable

    devices.

    Devmode API Functions

    DevmodeAPIprovidesthefollowingfunctions(commandIDs).

    Changingpapersize

    Changingprintdirection

    Changingmarginsetting

    Changing

    input

    unit Changingpaperfeedingmode

    Changingprintspeed

    TrueTypefontsubstitution

    Provided File

    EPSONprovidesthefollowingfiles:

    Sample Program

    DevmodeAPIisusedfor Changingpaperfeedingmode inthesampleprogram.

    Type File Name Description

    Header File for API Win32 APDDM_API.H

    In this file, API is defined during creation of Win32 32-bit application.

    C:\Program Files\EPSON

    \EPSON Advanced Printer Driver 4\Sample\US

    \Src\C++\SingleFunction\Program13\Program13

    Devmode API module EAPDM32.DLLThis executable file is called by the Win32 32-bit

    application in Windows\System32.

    .NET Wrapper module EAPDM32W.DLLThis executable file is called by the application in

    Windows\assembly.

  • 7/24/2019 APD4 T81 Devmode E RevE

    9/28

    Chapter 1 Overview

    9

    1

    Operational Environment

    OS

    ConformingtotheAPDenvironment.Referto InstallManual.

    OnWindowsXP,no.NETmodulesareinstalledwithout.NETFramework2.0duringAPD

    installation.If.NETFramework2.0wasinstalledlater,installDevmodeAPI.NETusingcustom

    installationofAPD.

    .NET Framework Version

    ConformingtotheAPDenvironment.Referto InstallManual.

    IfyouuseDEVMODEAPI.NETWrapperinWindowsXP,install.NETFrameWork2.0orlater

    beforeinstallingAPD.

    In Terminal Service / Citrix XenApp environment, the status of TM printers cannot be

    acquired using PRINTER_INFO_2.

  • 7/24/2019 APD4 T81 Devmode E RevE

    10/28

    10

  • 7/24/2019 APD4 T81 Devmode E RevE

    11/28

    Chapter 2 How to Use Devmode API

    11

    2

    How to Use Devmode APIThischapterdescribeshowtouseDevmodeAPI.

    Sequence

    RecommendedsequenceforWin32isasshownbelow.

    .NETFramework

    User EPDA32W.DLL.NET Application

    2:GetProcAddress()

    1:Load Library()

    3:APDDM_OpenW(SYSTEM/Default/Input)

    8:APDDM_GetDevModeW(lpParam=NULL)

    10:APDDM_Close()

    11:FreeLibrary()

    9:return APDDM_GetDevModeW()

    7:APDDM_SetData()

    13:Printing Functions()

    12:CreateDCW(DEVMODEW)

    4:APDDM_GetRange()

    5. Provides range to user. ( )

    6. User selects a range.

    Allocate the memorysize required forDEVMODEW.

    Deletes the memoryallocated byDevmode API.

    Deletes DEVMODEWmemory.

  • 7/24/2019 APD4 T81 Devmode E RevE

    12/28

    12

    Explanation

    1 LoadLibrary()

    2 GetProcAddress()

    3 APDDM_OpenW(SYSTEM/Default/Input)Opens Devmode API. When using Devmode API of the device, use

    System Devmode to open.

    4 APDDM_GetRange()Specifies a command ID and acquires the setting range that can be set

    for the ID from the device.

    5 Provides the acquired command ID range to the user.

    6 The user makes selection from the range.

    7 APDDM_SetData()Sets a value to the device.

    8 APDDM_GetDevModeW()Acquires the set value of the device. It is recommended that theapplication acquire/store this value.

    9 return APDDM_GetDevModeW()Acquires the memory size required for DEVMODEW. The application

    allocates memory.

    10 APDDM_Close()Closes Devmode API.

    11 FreeLibrary()Deletes the memory allocated by Devmode API.

    12 CreateDCW(DEVMODEW)Deletes DEVMODEW memory.

    13 Printing Functions()Printing with the set contents is available.

  • 7/24/2019 APD4 T81 Devmode E RevE

    13/28

    Chapter 2 How to Use Devmode API

    13

    2

    Recommendedsequencefor.NETisasshownbelow.

    .NET

    Framework

    User EPDA32W.DLL.NET Application

    1:p=new APDDM()

    2:p.OpenW(SYSTEM/Default/Input)

    9:p.Close()

    8:return p.GetDevmodew()

    3:p.GetRange()

    6:p.SetData()

    11:Printing Functions()

    10:PrinterSettings m.GetHdevmode()(DEVMODEW)

    7:p.GetDevModeW(lpParam=NULL)

    4. Provides the range to the user. ( )

    5. User selects a range.

    Allocate the memorysize required forDEVMODEW.

    Deletes the memoryallocated byDevmode API.

  • 7/24/2019 APD4 T81 Devmode E RevE

    14/28

    14

    Devmode API Development Information

    Thissection

    describes

    the

    information

    required

    for

    application

    development.

    Character Code

    Unicodeisusedforallstrings.

    Unicodeisusedforallstrings.ItisrequiredtosetUNI_CODEand_UNICODEinthecompiler

    macrodefinition.UseWidecharacterforallWindowsAPIs.

    Devmode Type

    ThefollowingthreeDevmodetypesareavailablewhenopened:

    SystemDEVMODE

    DEVMODEsetintheprinterdriverisusedastheinputparameter.Inthiscase,setNULL

    becauseDEVMODEWaddressisnotusedforinput.

    DefaultDEVMODE

    ThedefaultDEVMODEfortheprinterdriverisusedastheinputparameter.Inthiscase,set

    NULLbecauseDEVMODEWaddressisnotusedforinput.

    SpecifiedDEVMODE

    DEVMODEacquiredindependentlybytheapplicationisusedastheinputparameter.

    CanbeacquiredfromDocumentPropertySheetandWindowsAPI.

    The DEVMODEWareathatis allocatedby theapplicationneedsto be releasedby the

    application.

    Memory Allocation

    TheDevmodeAPImoduledoesnotneedtoreleasethememoryareathatreturnsasaparameter.

    FreeLibrary()oftheDevmodeAPImodulereleasesthememoryarea.Thatiswhyyoushould

    copythememoryareainadvancewhenthedataneedstobestored.

    DEVMODEWacquiredbyGetDevmodeW(.NET)orAPDDM_GetDevModeW(Win32)isusedin

    alaterprinting processandisnotreleasedbytheDevmodeAPImodule.So,releaseitbythe

    application.

  • 7/24/2019 APD4 T81 Devmode E RevE

    15/28

    Chapter 2 How to Use Devmode API

    15

    2

    Multi-process/Multi-thread/Multi-user

    Becausethe

    Devmode

    API

    can

    handle

    the

    instances

    of

    DEVMODEW

    at

    the

    same

    time,

    it

    supportsmultiprocess/multithread/multiuser.

    Forapplications,.NETversioncandistinguishtheinstanceswiththeobject,andWin32version

    candistinguishtheinstanceswiththeprinterdeviceinformationhandle.TheDevmodeAPI

    moduledoesnotneedtoreleasethememoryareathatreturnsasaparameter.

    Error Code

    TheerrorcodesreturnedbyeachAPIareidenticaltotheWindowserrorcodes(definedin

    WinError.h).

  • 7/24/2019 APD4 T81 Devmode E RevE

    16/28

    16

  • 7/24/2019 APD4 T81 Devmode E RevE

    17/28

    Chapter 3 Reference for Win32

    17

    3

    Reference for Win32ThischapterdescribesthefunctionsofTMT81,APIreferenceandcommandID.

    Functions for TM-T81

    Changingpapersize(APD_DM_PAPER_SIZE onpage21)

    Changingprintdirection(APD_DM_ORIENTATION onpage21)

    Changingmarginsetting(APD_DM_PAPERSAVE onpage21)

    Changinginputunit(APD_DM_INPUT_UNIT onpage21)

    Changingpaperfeedingmode(APD_DM_SPEED_DEVICE onpage22)

    Changingprintspeed(APD_DM_PAPER_SIZE onpage21)

    TrueTypefontsubstitution(APD_DM_REPLACEFONT onpage22)

    APDDM_OpenW

    Opensthespecifiedprinterdeviceandenablesdeviceinformationacquisition/setting.

    lphAPDDMforthespecifiedDEVMODE,itisrequiredtoallocateanddeletememorybythe

    application.

    Syntax

    DWORDAPDDM_OpenW ( LPCWSTR lpwDevName,DWORD dwType, LPDEVMODEW lpDM,LPHANDLE lphAPDDM)

    Argument

    lpwDevName: Printerdevicenameaddress.ThisisLPCWSTRtype.

    dwType: DEVMODEtypewhenopened.Selectamongthefollowing:

    SystemDEVMODE/DefaultDEVMODE/SpecifiedDEVMODE.

    ThisisDWORDtype.

    lpDM: DEVMODEWaddress.ThisisLPDEVMODEWtype.

    lphAPDDM: Printerdeviceinformationhandleaddress.ThisisLPHANDLEtype.

  • 7/24/2019 APD4 T81 Devmode E RevE

    18/28

    18

    APDDM_GetRange

    Acquiresthe

    setting

    range

    of

    the

    specified

    command

    ID

    from

    the

    device.

    Syntax

    DWORDAPDDM_GetRange ( HANDLE hAPDDM,DWORD nCommad,LPVOID* lpParam,LPDWORD pdwCount,LPDWORD pdwSize)

    Argument

    hAPDDM: Printerdeviceinformationhandle.ThisisHandle.

    nCommad CommandID(function)toacquiretheexecutionlevel.

    ThisisDWORDtype.

    lpParam: Thesettingrangestorageparameter.ThisisLPVOID*type.

    pdwCount: Thenumberofelements.ThisisLPDWORDtype.

    pdwSize: Theparametersize.Thenumberofparametersdividedbythenumber

    ofelementsindicatesthenumberofarraysofParam.

    ThisisLPDWORDtype.

    APDDM_GetData

    AcquiresthedataofthespecifiedcommandIDfromthedevice.

    Syntax

    DWORDAPDDM_GetData ( HANDLE hAPDDM,DWORD nCommad,LPVOID* lpParam, LPDWORD pdwSize)

    Argument

    hAPDDM: Printerdeviceinformationhandle.ThisisHandle.

    nCommad CommandID(function)toacquiretheexecutionlevel.

    ThisisDWORDtype.

    lpParam: Obtaineddatastorageparameter.ThisisLPVOID*type.

    pdwSize: Obtaineddatasize.ThisisLPDWORDtype.

  • 7/24/2019 APD4 T81 Devmode E RevE

    19/28

    Chapter 3 Reference for Win32

    19

    3

    APDDM_SetData

    Configuresthe

    specified

    data

    to

    the

    device.

    Syntax

    DWORDAPDDM_SetData ( HANDLE hAPDDM, DWORD nCommad,LPVOID lpParam, LPDWORD pdwSize)

    Argument

    hAPDDM: Printerdeviceinformationhandle.ThisisHandle.

    nCommad CommandID(function)toconfigurethedata.ThisisDWORDtype.

    lpParam: Configureddatastorageparameter.ThisisLPVOIDtype.

    pdwSize: Configureddatasize.ThisisLPDWORDtype.

    APDDM_GetDevModeW

    AcquiresDEVMODEinformation,towhichtheprinterdeviceinformationisapplied,tothe

    specifiedarea.ForlpDMoftheobtainedDEVMODE,itisrequiredtoallocateanddelete

    memorybytheapplication.

    Syntax

    DWORDAPDDM_GetDevModeW ( HANDLE hAPDDM,LPDEVMODE lpDM,LPDWORD pdwSize)

    Argument

    hAPDDM: Printerdeviceinformationhandle.ThisisHandle.

    lpDM DEVMODEaddress.ThisisLPDEVMODEtype.

    pdwSize: Obtained

    DEVMODEW

    size.

    This

    is

    LPDWORD

    type.

  • 7/24/2019 APD4 T81 Devmode E RevE

    20/28

    20

    APDDM_Close

    Closesthe

    specified

    printer

    device.

    Syntax

    DWORDAPDDM_Close ( HANDLE hAPDDM)

    Argument

    hAPDDM: Printerdeviceinformationhandle.ThisisHandle.

  • 7/24/2019 APD4 T81 Devmode E RevE

    21/28

    Chapter 3 Reference for Win32

    21

    3

    Command ID

    APD_DM_PAPER_SIZE

    Acquiresorchangesthepapersize.Userdefinedpapersarenotsupported.

    Forpapersizenameacquisition,thefollowingtwomethodsareavailable:

    Enumerationtype:Enumeratesthepapersizenames.Thepapersizenamescorrespondtothe

    arrayofpapersizes.

    ThecommandIDcanbespecifiedwiththefollowingmacro:

    GET_ENUM_STRING_COMMAND_ID(COMMAND) Singletype:Acquiresapapernamebyspecifyingasinglepapersize.

    ThecommandIDcanbespecifiedwiththefollowingmacro:

    GET_STRING_COMMAND_ID(COMMAND,ID)

    APD_DM_ORIENTATION

    Acquiresorchangestheprintdirection.Selecttheprintdirectionamongthefollowing:0degree,

    90degree,180degree,and270degree.

    Tochangethedirectiontoanyoptionotherthan0degree,itisrequiredtoset Yes to Printall

    documentsasimage informatting.

    APD_DM_PAPERSAVE

    Acquiresorchangesthemarginreductionsetting.Selectthesettingamongthefollowing:No

    marginreduction/Uppermarginreduction/Bottommarginreduction/Upperandbottommargin

    reduction.Availableoptionsdependontheprintermodel.

    APD_DM_INPUT_UNIT

    Acquiresorchangesthedriverinputunit.Specifyeithermmorinch.

  • 7/24/2019 APD4 T81 Devmode E RevE

    22/28

    22

    APD_DM_PAPER_BIN

    Acquiresorchangesthepaperfeeder.Availableoptionsdependontheprintermodel.Foracquisitionofpaperfeedername,enumerationtypeandsingletypemacrosareavailableas

    withchangingpapersize.

    APD_DM_SPEED_DEVICE

    Acquiresorchangestheprintspeed.Availableoptionsdependontheprintermodel.

    APD_DM_REPLACEFONT

    SpecifieswhetherornottosubstituteTrueTypefontstodevicefonts.Itisrequiredtoassign

    TrueTypefontstodevicefontsmanuallyinadvance.

  • 7/24/2019 APD4 T81 Devmode E RevE

    23/28

    Chapter 4 Reference for .NET

    23

    4

    Reference for .NETThischapterdescribestheAPIreferencein.NETenvironment.Forthefunctionsofeachprinterand

    commandID,refertoReferenceforWin32onpage17.

    OpenW

    CallsAPDDM_OpenWforWin32.

    Opensthespecifiedprinterdeviceandenablesdeviceinformationacquisition/setting.

    Theprinterinformationhandleretainedbythewrapper.

    ToacquiretheDEVMODEstructurepointer,acquirethehandletotheDEVMODEstructurepointer

    fromtheapplicationfirstandthenacquirethepointerusingGlobalLockwhichisanunmanaged

    method.Afteruse,callGlobalUnLock,GlobalFreewhichareunmanagedmethods,andreleasethe

    pointerbytheapplication.

    Syntax

    OpenW ( String strDevName, UInt32 un32Type, IntPtr npDM)

    Argument

    strDevName: Printerdevicenamestring.ThisisStringtype.

    un32Type DEVMODEtype

    when

    opened.

    Select

    among

    the

    following:

    System

    DEVMODE/DefaultDEVMODE/SpecifiedDEVMODE.

    ThisisUInt32type.

    npDM: DEVMODEstructurepointer.ThisisIntPtrtype.

  • 7/24/2019 APD4 T81 Devmode E RevE

    24/28

    24

    GetRange

    CallsAPDDM_GetRange

    for

    Win32.

    AcquiresthesettingrangeofthespecifiedcommandIDfromthedevice.

    Syntax

    GetRange ( UInt32 un32Commad, out IntPtr npParam,out UInt32 un32Count, out UInt32 un32Size)

    Argument

    un32Commad CommandID(function)toacquiretheexecutionlevel.ThisisUInt32

    type.

    npParam: Thesettingrangestorageparameter.Contentsdifferdepending

    onthecommandID.ThisisIntPtrtype.

    un32Count: Thenumberofelements.ThisisUInt32type.

    un32Size Theparametersize.Thenumberofparametersdividedbythenumber

    ofelementsindicatesthenumberofarraysofParam.ThisisUInt32type.

    GetData

    CallsAPDDM_GetDataforWin32.

    AcquiresthedataofthespecifiedcommandIDfromthedevice.

    Syntax

    GetData ( UInt32 un32Commad, out IntPtr npParam,out UInt32 un32Size)

    Argument

    un32Commad CommandID

    (function)

    to

    acquire

    the

    execution

    level.

    ThisisUInt32type.

    npParam: Obtaineddatastorageparameter.ThisisIntPtrtype.

    un32Size: Datasizeoftheobtainedparameter.ThisisUInt32type.

  • 7/24/2019 APD4 T81 Devmode E RevE

    25/28

    Chapter 4 Reference for .NET

    25

    4

    SetData

    CallsAPDDM_SetData

    for

    Win32.

    Configuresthespecifieddatatothedevice.

    Syntax

    SetData ( UInt32 un32Commad, IntPtr npParam, UInt32 un32Size)

    Argument

    un32Commad CommandID(function)toacquiretheexecutionlevel.

    ThisisUInt32type.

    npParam: Configureddatastorageparameter.ThisisIntPtrtype.

    un32Size: Specifiestheparameterdatasize.ThisisUInt32type.

    GetDevModeW

    CallsAPDDM_GetDevModeWforWin32.

    AcquiresDEVMODEinformation,towhichtheprinterdeviceinformationisapplied,tothe

    specifiedarea.

    ToacquiretheDEVMODEstructurepointer,acquirethehandletotheDEVMODEstructure

    pointerfromtheapplicationfirstandthenacquirethepointerusingGlobalLockwhichisan

    unmanagedmethod.Afteruse,callGlobalUnLock,GlobalFreewhichareunmanagedmethods,

    andreleasethepointerbytheapplication.

    Syntax

    GetDevModeW ( IntPtr npDM, out UInt32 un32Size)

    Argument

    npDM DEVMODEWstructure

    pointer.

    This

    is

    IntPtr

    type.

    un32Size DEVMODEWstructuresize.ThisisUInt32type.

  • 7/24/2019 APD4 T81 Devmode E RevE

    26/28

    26

    Close

    CallsAPDDM_Close

    for

    Win32.

    Closesthespecifiedprinterdevice.

    Syntax

    Close ()

  • 7/24/2019 APD4 T81 Devmode E RevE

    27/28

    Chapter 5 PRINTERINFO

    27

    5

    PRINTERINFO

    Acquiring TM Printer Status Using PRINTERINFO_2

    StatusAPIisprovidedforyourapplicationstoobtainthestatusoftheTMprinter.Thestatuscan

    beobtainedalsousingWindowsfunctions.

    ThestatusofPRINTER_INFO_2structurecanbeobtainedusingGetPrinterfunction.Fordetails,

    refertoMicrosofthomepage.

    ThestatusesofPRINTER_INFO_2structureandtheTMprinterareshownbelow.

    In Terminal Service / Citrix XenApp environment, the status of TM printers cannot be

    acquired using PRINTER_INFO_2.

    PRINTERINFO_2 Status TM Printer

    PRINTER_STATUS_BUSY Not supported.

    PRINTER_STATUS_DOOR_OPEN Printer cover is open.

    PRINTER_STATUS_ERROR Not supported.

    PRINTER_STATUS_INITIALIZING Initializing the TM printer.

    PRINTER_STATUS_IO_ACTIVE Not supported.

    PRINTER_STATUS_MANUAL_FEED Feeding paper with the Feed switch.

    PRINTER_STATUS_NO_TONER Ink cartridge is not installed/requires replacement.

    PRINTER_STATUS_NOT_AVAILABLEUnable to access the TM printer. (TM printer is not powered

    on/Cables are disconnected)

    PRINTER_STATUS_OFFLINE TM printer is off-line.

    PRINTER_STATUS_OUT_OF_MEMORY Not supported.

    PRINTER_STATUS_OUTPUT_BIN_FULL Not supported.

    PRINTER_STATUS_PAGE_PUNT Not supported.

    PRINTER_STATUS_PAPER_JAM Not s upported.

    PRINTER_STATUS_PAPER_OUT No roll paper.

    PRINTER_STATUS_PAPER_PROBLEM Not supported.

    PRINTER_STATUS_PAUSED Not supported.

    PRINTER_STATUS_PENDING_DELETION Not supported.

    PRINTER_STATUS_POWER_SAVE Not supported.

    PRINTER_STATUS_PRINTING Printing.

    PRINTER_STATUS_PROCESSING Not supported.

    PRINTER_STATUS_SERVER_UNKNOWN Not supported.

    PRINTER_STATUS_TONER_LOW Low ink level.

  • 7/24/2019 APD4 T81 Devmode E RevE

    28/28

    28


Recommended