[ Djoks @ 12.07.2006. 14:27 ] @
Postovanje svima! Da li neko moze da napise kako se iz nekog od .NET programskih jezika (VB, V#) pise kod koji ce EPSON LX300 stampacu poslati escape sekvencu FF (form-feed)? Hvala unapred! |
[ Djoks @ 12.07.2006. 14:27 ] @
[ DarkMan @ 12.07.2006. 16:29 ] @
Code: using System.Runtime.InteropServices; void LineFeed() { Microsoft.Win32.SafeHandles.SafeFileHandle handle = CreateFile("LPT1:", FileAccess.Write, FileShare.None, IntPtr.Zero, FileMode.Open, 0, IntPtr.Zero); if(handle.IsInvalid) return; System.IO.FileStream stream = new FileStream(handle, FileAccess.Write); if(stream != null) { stream.WriteByte((byte)EscapeCodes.FormFeed); stream.Close(); stream.Dispose(); } handle.Close(); } public enum EscapeCodes : byte { NUL = 0x00, EscapeCode = 0x1B, LineFeed = 0x0A, FormFeed = 0x0C, CarriageReturn = 0x0D, SelectCondensedMode = 0x0F, CancelCondensedMode = 0x12 } [DllImport("Kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] static extern Microsoft.Win32.SafeHandles.SafeFileHandle CreateFile( string fileName, [MarshalAs(UnmanagedType.U4)] FileAccess fileAccess, [MarshalAs(UnmanagedType.U4)] FileShare fileShare, IntPtr securityAttributes, [MarshalAs(UnmanagedType.U4)] FileMode creationDisposition, [MarshalAs(UnmanagedType.U4)] FileAttributes flags, IntPtr template); [DllImport("kernel32.dll", SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] static extern bool CloseHandle(IntPtr hObject); [ IgorMikovic @ 12.07.2006. 18:40 ] @
Zdravo!
Kod koji je poslao DarkMan ne moze da se kompajlira u VisualStudio 2003, jer je, koliko sam ja shvatio, Microsoft.Win32.SafeHandles.Win32SafeHandle klasa nova i postoji, izgleda, tek od .NET Framework 2.0 (tako barem pise na http://msdn2.microsoft.com/en-...afehandles.safefilehandle.aspx). Da li postoji neki nacin da se isto ovo uradi (slanje Escape sekvenci za printer LX-300) pod .NET 1.1 verzijom? Igor [ dusans @ 12.07.2006. 20:22 ] @
Probaj da umesto SafeHandle klase koristiš System.IntPtr, trebalo bi da radi. Umesto handle.Close koristi CloseHandle API funkciju a CreateFile funkcija bi trebala da ti vrati handle različit od -1 ako je uspešno izvršena.
[ IgorMikovic @ 12.07.2006. 21:48 ] @
Ja se izvinjavam za svoje neznanje, inače sam vb.net programer (i to ne baš vičan ovim stvarima), pa se debelo patim sa C# sintaksom. Dušane, uradio sam kako si napisao, ali mi javlja dvije greške:
kada poredim handle sa -1 (ja sam napisao 'if handle == -1 return' ), javlja da se ne može porediti IntPtr sa tipom int (-1), i posle toga na stream.dispose(): u tooltipu piše 'System.IO.FileStream.Dispose(bool) is not accessible due to its protection level'... Ja sam na Microsoft-ovom sajtu našao dva članka: 'How To Send Raw Data to a Printer Using the Win32 API from Visual Basic' - http://support.microsoft.com/kb/q154078/ i 'How to send raw data to a printer by using Visual C# .NET' - http://support.microsoft.com/?kbid=322091 i oba primjera rade, i za slanje stringova i fajlova na printer, ali sam toliko neuk, da ne umijem da pomoću ovih primjera pošaljem Escape sekvencu za npr. FormFeed (kad završim slanje stringova da kažem štampaču da se prebaci na sledeću stranu...) Elem - ako biste mi pomogli da ovaj primjer koji je poslao Darko proradi - bio bih Vam zahvalan. Ili barem da ukažete način kako da primjere koje je dao Microsoft modifikujem i iskoristim da, osim stringa, mogu da proslijedim i Escape sekvencu. U tim primjerima se koriste nekakve metode klase Marshal koja prebacuje 'managed' memoriju u 'unmanaged' (Marshal.StringToCoTaskMemAnsi i Marshal.AllocCoTaskMem i Marshal.Copy...), ali ja ih ne znam primijeniti na Escape sekvence... Oprostite Igor [ DarkMan @ 13.07.2006. 11:25 ] @
Za NET 1.1 probaj sledece:
Code: using System.Runtime.InteropServices; void FormFeed() { IntPtr handle = CreateFile("LPT1:", EFileAccess.Write, EFileShare.None, IntPtr.Zero, ECreationDisposition.OpenExisting, 0, IntPtr.Zero); if(handle.ToInt32() == -1) return; System.IO.FileStream stream = new FileStream(handle, FileAccess.Write); if(stream != null) { stream.WriteByte((byte)EscapeCodes.FormFeed); stream.Close(); stream.Dispose(); } CloseHandle(handle); } public enum EscapeCodes : byte { NUL = 0x00, EscapeCode = 0x1B, LineFeed = 0x0A, FormFeed = 0x0C, CarriageReturn = 0x0D, SelectCondensedMode = 0x0F, CancelCondensedMode = 0x12 } [Flags] public enum EFileAccess : uint { Read = 1, Write = 2, ReadWrite = 3, GenericRead = 0x80000000, GenericWrite = 0x40000000, GenericExecute = 0x20000000, GenericAll = 0x10000000, } [Flags] public enum EFileShare : uint { None = 0x00000000, Read = 0x00000001, Write = 0x00000002, Delete = 0x00000004, } public enum ECreationDisposition : uint { New = 1, CreateAlways = 2, OpenExisting = 3, OpenAlways = 4, TruncateExisting = 5, } [Flags] public enum EFileAttributes : uint { Readonly = 0x00000001, Hidden = 0x00000002, System = 0x00000004, Directory = 0x00000010, Archive = 0x00000020, Device = 0x00000040, Normal = 0x00000080, Temporary = 0x00000100, SparseFile = 0x00000200, ReparsePoint = 0x00000400, Compressed = 0x00000800, Offline = 0x00001000, NotContentIndexed = 0x00002000, Encrypted = 0x00004000, Write_Through = 0x80000000, Overlapped = 0x40000000, NoBuffering = 0x20000000, RandomAccess = 0x10000000, SequentialScan = 0x08000000, DeleteOnClose = 0x04000000, BackupSemantics = 0x02000000, PosixSemantics = 0x01000000, OpenReparsePoint = 0x00200000, OpenNoRecall = 0x00100000, FirstPipeInstance = 0x00080000 } [DllImport("kernel32.dll", SetLastError = true)] public static extern IntPtr CreateFile( string lpFileName, EFileAccess dwDesiredAccess, EFileShare dwShareMode, IntPtr lpSecurityAttributes, ECreationDisposition dwCreationDisposition, EFileAttributes dwFlagsAndAttributes, IntPtr hTemplateFile); [DllImport("kernel32.dll", SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] static extern bool CloseHandle(IntPtr hObject); PS: Obavezno stavi u bookmark browsera http://pinvoke.net/ [ IgorMikovic @ 13.07.2006. 15:44 ] @
Veliko i radosno hvala!
Probao sam i - radi. U međuvremenu sam, dok sam čekao odgovor, kopao po VB.NET primjeru koji je dao Microsoft na 'How To Send Raw Data to a Printer Using the Win32 API from Visual Basic' - http://support.microsoft.com/kb/q154078/, koji se odnosio na slanje teksta direktno na printer. Tek danas sam "provalio" u čemu sam griješio - u sintaksi escape sekvence za Form Feed: trebalo je samo da napišem Chr(27).ToString. Tako da se može slati i pomoću ovog primjera. Čim imadnem malo vremena, i kada osposobim oba primjera, testiraću da vidim da li ima neke razlike u brzini rada (pošto će u mom slučaju trebati u jednom mahu odštampati i do 200-500 virmana). Još jednom - hvala svima koji su se potrudili da pomognu! Igor [ IgorMikovic @ 14.07.2006. 16:07 ] @
Opet mi!
A kako da pošaljem Escape sekvencu koja izabira naš karakter set tabelu, što bi mi omogućilo da štampam naša slova? U uputstvu sam našao da je to naredba 'ESC (t nl nh d1 d2 d3', gdje su nl, nh, d1...d3 brojevi koji određuju tip karakter tabele, i ako sam ja to dobro shvatio (očigledno nisam), string-sekvenca bi trebala da glasi: Chr(27) & "(t301100" za Epson LX300, za karakter tabelu 852 - Eastern Europe. Medjutim, kada pošaljem tu sekvencu na printer - printer se 'zakuca' i više ne štampa ništa dok se ne restartuje. A pitanje je i da li je ta tabela uopšte podržana u standardnom LX-300 (u uputstvu piše da nije za standardni, a jeste za nekakav NLSP model, pri čemu na mom štampaču nema oznake koja bi mi pomogla da odredim o kojem se modelu radi). Bilo kako bilo, ja ne znam da pošaljem ni jednu escape sekvencu koja bi promijenila karakter tabelu u ma koju drugu. Pozdrav i hvala i oprostite. Igor [ DarkMan @ 14.07.2006. 17:26 ] @
Code: public enum MatrixPrinterCommandType { PrinterOperation_Beeper, PrinterOperation_SelectPrinter, PrinterOperation_DeselectPrinter, PrinterOperation_TurnCutSheetFeederControlOff, PrinterOperation_TurnCutSheetFeederControlOn, PrinterOperation_DisablePaperOutSensor, PrinterOperation_EnablePaperOutSensor, PrinterOperation_SelectUnidirectionalModeForOneLine, PrinterOperation_InitializePrinter, PrinterOperation_CancelUnidirectionalMode, PrinterOperation_SelectUnidirectionalMode, PrinterOperation_TurnHalfSpeedModeOff, PrinterOperation_TurnHalfSpeedModeOn, PrintingStyle_Pica16DoubleStrike, PrintingStyle_Elite32DoubleWide, PrintingStyle_Condensed64Italic, PrintingStyle_Emphasized128Underline, PrintingStyle_SelectNLQRomanFont, PrintingStyle_SelectNLQSansSerifFont, PrintingStyle_SelectDraftMode, PrintingStyle_SelectNLQMode, PrintSizeAndCharacterWidth_SelectDoubleWidthForOneLine, PrintSizeAndCharacterWidth_SelectCondensedMode, PrintSizeAndCharacterWidth_CancelCondensedMode, PrintSizeAndCharacterWidth_CancelOneLineDoubleWidthMode, PrintSizeAndCharacterWidth_DoubleWidthForOneLineESC, PrintSizeAndCharacterWidth_SelectCondensedModeESC, PrintSizeAndCharacterWidth_SelectEliteWidth12cpi, PrintSizeAndCharacterWidth_SelectPicaWidth10cpi, PrintSizeAndCharacterWidth_CancelDoubleWidthMode, PrintSizeAndCharacterWidth_SelectDoubleWidthMode, PrintEnhancement_CancelUnderlining, PrintEnhancement_SelectUnderlining, PrintEnhancement_SelectEmphasizedMode, PrintEnhancement_CancelEmphasizedMode, PrintEnhancement_SelectDoubleStrikeMode, PrintEnhancement_CancelDoubleStrikeMode, PrintEnhancement_SelectSuperscript, PrintEnhancement_SelectSubscript, PrintEnhancement_CancelSuperscriptSubscript, CharacterSets_SelectItalicMode, CharacterSets_CancelItalicMode, CharacterSets_EnablePrintingOfExtendedCharacters, CharacterSets_DisablePrintingOfExtendedCharacters, CharacterSets_International_USA, CharacterSets_International_France, CharacterSets_International_Germany, CharacterSets_International_UnitedKingdom, CharacterSets_International_DenmarkI, CharacterSets_International_Sweden, CharacterSets_International_Italy, CharacterSets_International_Spain, CharacterSets_International_Japan, CharacterSets_International_Norway, CharacterSets_International_DenmarkII, CharacterSets_International_SpainII, CharacterSets_International_LatinAmerica, CharacterSets_SelectItalicCharacterSet, CharacterSets_SelectEpsonCharacterSet, CharacterSets_Table_PC850_Multilingual, CharacterSets_Table_PC851_Greek, CharacterSets_Table_PC853_Turkish, CharacterSets_Table_PC855_Cyrillic, CharacterSets_Table_PC860_Portuguese, CharacterSets_Table_PC863_CanadianFrench, CharacterSets_Table_PC865_Norwegian, CharacterSets_Table_PC852_EasternEurope, CharacterSets_Table_PC857_Turkish, CharacterSets_Table_PC862_Hebrew, CharacterSets_Table_PC864_Arabic, CharacterSets_Table_PC866_Russian, } private class MatrixPrinterCommand { public MatrixPrinterCommandType commandType; public string command; public MatrixPrinterCommand(MatrixPrinterCommandType commandType, string command) { this.commandType = commandType; this.command = command.Replace(" ", ""); for(int i = 0; i < characterTable.Length; i++) this.command = this.command.Replace(characterTable[i], characterTableCode[i]); } private String[] characterTable = new String[] { "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB", "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US" }; private String[] characterTableCode = new String[] { "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", "\x09", "\x0A", "\x0B", "\x0C", "\x0D", "\x0E", "\x0F", "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", "\x18", "\x19", "\x1A", "\x1B", "\x1C", "\x1D", "\x1E", "\x1F", }; } private MatrixPrinterCommand[] commands = new MatrixPrinterCommand[] { new MatrixPrinterCommand(MatrixPrinterCommandType.PrinterOperation_Beeper, "BEL"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrinterOperation_SelectPrinter, "DC1"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrinterOperation_DeselectPrinter, "DC3"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrinterOperation_TurnCutSheetFeederControlOff, "ESC EM 0"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrinterOperation_TurnCutSheetFeederControlOn, "ESC EM 4"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrinterOperation_DisablePaperOutSensor, "ESC 8"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrinterOperation_EnablePaperOutSensor, "ESC 9"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrinterOperation_SelectUnidirectionalModeForOneLine, "ESC <"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrinterOperation_InitializePrinter, "ESC @"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrinterOperation_CancelUnidirectionalMode, "ESC U 0"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrinterOperation_SelectUnidirectionalMode, "ESC U 1"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrinterOperation_TurnHalfSpeedModeOff, "ESC s 0"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrinterOperation_TurnHalfSpeedModeOn, "ESC s 1"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrintingStyle_Pica16DoubleStrike, "ESC ! 0"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrintingStyle_Elite32DoubleWide, "ESC ! 1"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrintingStyle_Condensed64Italic, "ESC ! 4"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrintingStyle_Emphasized128Underline, "ESC ! 8"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrintingStyle_SelectNLQRomanFont, "ESC k 0"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrintingStyle_SelectNLQSansSerifFont, "ESC k 1"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrintingStyle_SelectDraftMode, "ESC x 0"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrintingStyle_SelectNLQMode, "ESC x 1"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrintSizeAndCharacterWidth_SelectDoubleWidthForOneLine, "SO"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrintSizeAndCharacterWidth_SelectCondensedMode, "SI"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrintSizeAndCharacterWidth_CancelCondensedMode, "DC2"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrintSizeAndCharacterWidth_CancelOneLineDoubleWidthMode, "DC4"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrintSizeAndCharacterWidth_DoubleWidthForOneLineESC, "ESC SO"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrintSizeAndCharacterWidth_SelectCondensedModeESC, "ESC SI"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrintSizeAndCharacterWidth_SelectEliteWidth12cpi, "ESC M"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrintSizeAndCharacterWidth_SelectPicaWidth10cpi, "ESC P"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrintSizeAndCharacterWidth_CancelDoubleWidthMode, "ESC W 0"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrintSizeAndCharacterWidth_SelectDoubleWidthMode, "ESC W 1"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrintEnhancement_CancelUnderlining, "ESC - 0"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrintEnhancement_SelectUnderlining, "ESC - 1"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrintEnhancement_SelectEmphasizedMode, "ESC E"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrintEnhancement_CancelEmphasizedMode, "ESC F"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrintEnhancement_SelectDoubleStrikeMode, "ESC G"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrintEnhancement_CancelDoubleStrikeMode, "ESC H"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrintEnhancement_SelectSuperscript, "ESC S 0"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrintEnhancement_SelectSubscript, "ESC S 1"), new MatrixPrinterCommand(MatrixPrinterCommandType.PrintEnhancement_CancelSuperscriptSubscript, "ESC T"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_SelectItalicMode, "ESC 4"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_CancelItalicMode, "ESC 5"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_EnablePrintingOfExtendedCharacters, "ESC 6"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_DisablePrintingOfExtendedCharacters, "ESC 7"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_International_USA, "ESC R \x00"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_International_France, "ESC R \x01"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_International_Germany, "ESC R \x02"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_International_UnitedKingdom, "ESC R \x03"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_International_DenmarkI, "ESC R \x04"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_International_Sweden, "ESC R \x05"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_International_Italy, "ESC R \x06"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_International_Spain, "ESC R \x07"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_International_Japan, "ESC R \x08"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_International_Norway, "ESC R \x09"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_International_DenmarkII, "ESC R \x0A"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_International_SpainII, "ESC R \x0B"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_International_LatinAmerica, "ESC R \x0C"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_SelectItalicCharacterSet, "ESC t NUL"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_SelectEpsonCharacterSet, "ESC t SOH"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_Table_PC850_Multilingual, "ESC ( t ETX NUL SOH \x03 NUL ESC t SOH"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_Table_PC851_Greek, "ESC ( t ETX NUL SOH \x04 NUL ESC t SOH"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_Table_PC853_Turkish, "ESC ( t ETX NUL SOH \x05 NUL ESC t SOH"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_Table_PC855_Cyrillic, "ESC ( t ETX NUL SOH \x06 NUL ESC t SOH"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_Table_PC860_Portuguese, "ESC ( t ETX NUL SOH \x07 NUL ESC t SOH"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_Table_PC863_CanadianFrench, "ESC ( t ETX NUL SOH \x08 NUL ESC t SOH"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_Table_PC865_Norwegian, "ESC ( t ETX NUL SOH \x09 NUL ESC t SOH"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_Table_PC852_EasternEurope, "ESC ( t ETX NUL SOH \x0A NUL ESC t SOH"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_Table_PC857_Turkish, "ESC ( t ETX NUL SOH \x0B NUL ESC t SOH"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_Table_PC862_Hebrew, "ESC ( t ETX NUL SOH \x0C NUL ESC t SOH"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_Table_PC864_Arabic, "ESC ( t ETX NUL SOH \x0D NUL ESC t SOH"), new MatrixPrinterCommand(MatrixPrinterCommandType.CharacterSets_Table_PC866_Russian, "ESC ( t ETX NUL SOH \x0E NUL ESC t SOH"), }; private static byte[] GetBytes(String text, Boolean ProcessLatinCharacters) { if(ProcessLatinCharacters) { text = text.Replace('Š', (char)230); text = text.Replace('š', (char)231); text = text.Replace('Č', (char)172); text = text.Replace('č', (char)159); text = text.Replace('Ć', (char)143); text = text.Replace('ć', (char)134); text = text.Replace('Ž', (char)189); text = text.Replace('ž', (char)190); text = text.Replace('Đ', (char)209); text = text.Replace('đ', (char)208); byte[] temp = System.Text.Encoding.Unicode.GetBytes(text); byte[] buffer = new byte[temp.Length / 2]; for(int i = 0, j = 0; i < temp.Length; i += 2, j++) buffer[j] = temp[i]; return buffer; } return System.Text.Encoding.ASCII.GetBytes(text); } public void SendPrinterCommand(MatrixPrinterCommandType commandType) { foreach(MatrixPrinterCommand command in commands) if(command.commandType == commandType) stream.Write(GetBytes(command.command, false)); } Code: SendPrinterCommand(MatrixPrinterCommandType.CharacterSets_EnablePrintingOfExtendedCharacters); SendPrinterCommand(MatrixPrinterCommandType.CharacterSets_Table_PC852_EasternEurope); stream.Write(GetBytes("test ČĆŠĐŽ čćšđć", true)); [ IgorMikovic @ 14.07.2006. 22:42 ] @
Šokiran sam opširnošću i kvalitetom odgovora.
Da si mi negdje blize, poslao bih "Najljepse zelje" i to onu od 300 g. Ovako - ne ostaje mi nista drugo do da se duboko poklonim i zahvalim. Hvala Vam. Igor [ acatheking @ 17.10.2007. 10:03 ] @
Naleteo sam na isti problem sa slanjem ESC komandi matricnom stampacu. Ne mogu da ga nateram da stampa nasa slov, ne pomaze dokumentacija.
Posto ne koristim .NET moze li mala molba da neko spakujei ove funkcije u DLL, jer radim web aplikaciju koja imam modul za slanje na stampu. Copyright (C) 2001-2025 by www.elitesecurity.org. All rights reserved.
|