1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
| using System;
using System.Collections.Generic;
using System.Management; // need to add System.Management to your project references.
using System.Runtime.InteropServices;
namespace ConsoleApplication1
{
class PlatformInvokeTest
{
ushort HP45E_RESOLUTION;
ushort HP45E_TRIGGER_OFFSET;
ushort HP45E_AUX_OUTPUT;
ushort HP45E_QUEUE_DEPTH;
ushort HP45E_SUB_SAMPLE;
ushort HP45E_JET_MASKING;
ushort HP45E_HEAD_HEIGHT;
public struct HP45E_CARTRIDGE_PROFILE_STRUCT
{
ushort voltage; // cartridge voltage, 0.1 volt units, Range 70 to 112 (7.0 to 11.2)
ushort pulseWidth; // pulse width, 0.1 microsecond units, Range 19 to 25 (1.9 to 2.5)
ushort temperature; // degrees C, Range 30 to 70
}
public struct HP45E_CONFIGURATION
{
ushort VerticalResolutionDPI; // printhead resolution
ushort HorizontalResolutionDPI; // transport resolution
ushort NumberOfPrintheads; // up to 4 printheads may be attached
ushort Head1Height; // height of each printhead in pixels
ushort Head2Height;
ushort Head3Height;
ushort Head4Height;
};
[DllImport("C:/Users/Eren/Desktop/XIJET_API.dll")]
public static extern bool HP45E_ProbePrinter(ushort index,
List<char>PrinterName);
[DllImport("C:/Users/Eren/Desktop/XIJET_API.dll")]
public static extern HandleCollector HP45E_OpenPrinter( List<char>PrinterName,
List<HP45E_CONFIGURATION> pPrinterConfig);
[DllImport("C:/Users/Eren/Desktop/XIJET_API.dll")]
public static extern void HP45E_ClosePrinter(int PrinterHandle);
[DllImport("C:/Users/Eren/Desktop/XIJET_API.dll")]
public static extern int HP45E_GetPrinterParameter(HandleCollector PrinterHandle,
ushort ParameterIndex,
void *pParameter,
ushort HeadNumber = 0);
[DllImport("C:/Users/Eren/Desktop/XIJET_API.dll")]
public static extern int HP45E_SetPrinterParameter(HandleCollector PrinterHandle,
ushort ParameterIndex,
void *pParameter,
ushort HeadNumber = 0);
[DllImport("C:/Users/Eren/Desktop/XIJET_API.dll")]
public static extern int HP45E_PrintDocumentPage( HandleCollector PrinterHandle,
ulong HorizontalWidth, // in pixels
List<ulong> pBitmappedBuffer, // 1-bit per pixel image
ulong Head1Offset, // Vertical offset in pixels
ulong Head2Offset, // Vertical offset in pixels
ulong Head3Offset, // Vertical offset in pixels
ulong Head4Offset, // Vertical offset in pixels
ulong Timeout ); // timeout in msecs
[DllImport("C:/Users/Eren/Desktop/XIJET_API.dll")]
public static extern int HP45E_CanvasBegin( HandleCollector PrinterHandle, // as returned from open call
ulong VerticalHeight, // in pixels
ulong HorizontalWidth); // in pixels
[DllImport("C:/Users/Eren/Desktop/XIJET_API.dll")]
public static extern int HP45E_CanvasWrite( HandleCollector PrinterHandle, // as returned from open call
ulong VerticalOffset, // in pixels
ulong HorizontalOffset,// in pixels
ulong VerticalHeight, // in pixels
ulong HorizontalWidth, // in pixels
List <char> pBitmappedBuffer); // 1-bit per pixel image
[DllImport("C:/Users/Eren/Desktop/XIJET_API.dll")]
public static extern HandleCollector HP45E_LoadFontXFT( HandleCollector PrinterHandle, // as returned from open call
List <char> filename); // full pathname to XFT font file
[DllImport("C:/Users/Eren/Desktop/XIJET_API.dll")]
public static extern int HP45E_CanvasWriteStr( HandleCollector PrinterHandle, // as returned from open call
HandleCollector FontHandle, // as returned from HP45E_LoadFont
List <char> printString, // pointer to string to print
ulong VerticalOffset, // in pixels
ulong HorizontalOffset); // in pixels
[DllImport("C:/Users/Eren/Desktop/XIJET_API.dll")]
public static extern int HP45E_CanvasPrint ( HandleCollector PrinterHandle, // as returned from open call
ulong Head1Offset, // Vertical offset in pixels
ulong Head2Offset, // Vertical offset in pixels
ulong Head3Offset, // Vertical offset in pixels
ulong Head4Offset, // Vertical offset in pixels
ulong Timeout ); // timeout in msecs
[DllImport("C:/Users/Eren/Desktop/XIJET_API.dll")]
public static extern int HP45E_CanvasPrintExt2 ( HandleCollector PrinterHandle, // as returned from open call
ulong Head1Offset, // Vertical offset in pixels
ulong Head2Offset, // Vertical offset in pixels
ulong Head3Offset, // Vertical offset in pixels
ulong Head4Offset, // Vertical offset in pixels
ulong Timeout, // timeout in msecs
List<float> pTransportSpeedIPS); // Returned transport speed
[DllImport("C:/Users/Eren/Desktop/XIJET_API.dll")]
public static extern int HP45E_WaitForPrintComplete( HandleCollector PrinterHandle, // as returned from open call
ulong Timeout); // Timeout in msecs
[DllImport("C:/Users/Eren/Desktop/XIJET_API.dll")]
public static extern void HP45E_Reset( HandleCollector PrinterHandle );
[DllImport("C:/Users/Eren/Desktop/XIJET_API.dll")]
public static extern void HP45E_ResetPrintData(HandleCollector PrinterHandle );
[DllImport("C:/Users/Eren/Desktop/XIJET_API.dll")]
public static extern void HP45E_ResetPrintQueue(HandleCollector PrinterHandle );
[DllImport("C:/Users/Eren/Desktop/XIJET_API.dll")]
public static extern int HP45E_GetStatus( HandleCollector PrinterHandle, // as returned from open call
List <char> pStatusMessage); // returned text message
[DllImport("C:/Users/Eren/Desktop/XIJET_API.dll")]
public static extern int HP45E_ActivatePens( HandleCollector PrinterHandle );
[DllImport("C:/Users/Eren/Desktop/XIJET_API.dll")]
public static extern int HP45E_DeactivatePens( HandleCollector PrinterHandle );
[DllImport("C:/Users/Eren/Desktop/XIJET_API.dll")]
public static extern int HP45E_SelectPens( HandleCollector PrinterHandle, // as returned from open call
ulong bmPensSelect ); // bit mapped pens selector
[DllImport("C:/Users/Eren/Desktop/XIJET_API.dll")]
public static extern int HP45E_GetInkRemaining( HandleCollector PrinterHandle, // as returned from open call
ushort headIndex, // zero-based index of head number
List<short>remainingPen1, // returned SHORT
List<short>remainingPen2,
List<short>remainingPen3,
List<short>remainingPen4 );List<short>
[DllImport("C:/Users/Eren/Desktop/XIJET_API.dll")]
public static extern int HP45E_ResetInkCartridge( HandleCollector PrinterHandle, // as returned from open call
ushort headIndex, // zero-based index of head number
ushort penIndex); // zero-based index of pen number
[DllImport("C:/Users/Eren/Desktop/XIJET_API.dll")]
public static extern int HP45E_QueueOutputToggle( HandleCollector PrinterHandle, // as returned from open call
ushort headIndex, // zero-based index of head number
ushort outputBitmask, // bit 0 = new state of output
ushort toggleTimeMS, // time in milliseconds (0=permanent)
ushort syncOption = 0, // 0 = immediate
ushort syncDelay = 0 ); // synchronize delay (time or distance)
[DllImport("C:/Users/Eren/Desktop/XIJET_API.dll")]
public static extern FILETIME* HP45E_OpenLogFile( List<char>filename); // filename including full path;
[DllImport("C:/Users/Eren/Desktop/XIJET_API.dll")]
public static extern void HP45E_CloseLogFile( );
[DllImport("C:/Users/Eren/Desktop/XIJET_API.dll")]
public static extern ulong HP45E_TestUSB( HandleCollector PrinterHandle); // as returned from open call
[DllImport("C:/Users/Eren/Desktop/XIJET_API.dll")]
public static extern double HP45E_GetVersionAPI( );
public static void Main()
{
HP45E_GetVersionAPI();
}
}
} |
Partager