c#簡體版列印指令注意

簡體版列印指令注意
System.Text.Encoding.GetEncoding(“gb2312”).GetBytes(“简体文字测试”);
不能使用
System.Text.Encoding.Default.GetBytes(“简体文字测试”);
會依據作業系統的encoding~~

this.serialPort1.PortName = textBox1.Text;
this.serialPort1.Open();
byte[] bData = System.Text.Encoding.GetEncoding("gb2312").GetBytes("简体文字测试");
this.serialPort1.Write(bData, 0, bData.Length);
byte[] CutPaper = new byte[] { 0x1d, 0x56, 0x42, 0x00 };
this.serialPort1.Write(CutPaper, 0, CutPaper.Length);

Delphi POS – 透過USB Printer打開錢櫃

[pascal]
procedure USBOpenCashDrawer(PrinterName: String);
var
// use winspool
Handle, hDeviceMode: THandle;
N: DWORD;
DocInfo1: TDocInfo1;
Device, Driver, Port: array [0 .. 255] of char;
ThePrinter: string;
code:ansistring;
begin
ThePrinter := PrinterName;
Code := chr(27) + chr(64)+ chr(27) + chr(112) + chr(0) + chr(50) + chr(200);

Printer.PrinterIndex := Printer.Printers.Indexof(ThePrinter);
Printer.GetPrinter(Device, Driver, Port, hDeviceMode);
PrinterName := Format(‘%s’, [Device]);
if not WinSpool.OpenPrinter(PChar(PrinterName), Handle, nil) then
begin
// ShowMessage(‘Error : ‘ + IntToStr(GetLastError));
Exit;
end;
with DocInfo1 do
begin
pDocName := ‘Test’;
pOutputFile := nil;
pDataType := ‘RAW’;
end;

WinSpool.StartDocPrinter(Handle, 1, @DocInfo1);
WinSpool.StartPagePrinter(Handle);
WinSpool.WritePrinter(Handle, PAnsiChar(Code), Length(Code), N);
WinSpool.EndPagePrinter(Handle);
WinSpool.EndDocPrinter(Handle);
WinSpool.ClosePrinter(Handle);

end;
[/pascal]

3D列印也能吃?係金a – Foodini

photo by Designboom
photo by Designboom

kickstarter上看到一個很妙的專案叫「foodini」,是由Natural Machines這個團隊所發想出來的點子。

最大的賣點是你可以把新鮮的食材打成”泥”狀,再透過機器印出來,不過如果是整塊的就不行了!像是漢堡、披蕯、餅乾這類就可以~但目前看來在製作過程中還需要人工介入,適合嘗鮮體驗的朋友。

Presentation is everything with kids... print different shapes to encourage kids to eat healthy foods.