

at3s
Members-
Content Count
46 -
Joined
-
Last visited
Community Reputation
1 NeutralTechnical Information
-
Delphi-Version
Delphi 10.4 Sydney
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
TBitmap to TBytes for ESC/POS Thermal Printer
at3s replied to at3s's topic in RTL and Delphi Object Pascal
You're awesome! You've fixed my problem. Thanks a lot. -
TBitmap to TBytes for ESC/POS Thermal Printer
at3s replied to at3s's topic in RTL and Delphi Object Pascal
As you can see in my sample, I don't send a string to the POS printer but rather TBytes. Probably a string type of AValue parameter of SendString procedure twice confusing you. Sure, it AValue is not properly populated, SendString procedure shall send something weird. But I got an image as output on printer, but it's just cutting by horizontal lines. And this Lazarus implementation of Nicholas Piasecki's code doesn't work for me as well. -
TBitmap to TBytes for ESC/POS Thermal Printer
at3s replied to at3s's topic in RTL and Delphi Object Pascal
I used a lot of specification for ESC\POS printer. Actually I tried to make my code working in RawBT application (something like virtual ESC\POS printer) and now I'm trying to use GOOJPRT PT-210 device. I did not find a specification for this model of printer. but I require more general solution to be able to print a receipt from my Android application. -
TBitmap to TBytes for ESC/POS Thermal Printer
at3s replied to at3s's topic in RTL and Delphi Object Pascal
Actually Delphi code above should do exactly what Nicholas Piasecki did in his article using C#. Can you please send me in PM your procedure of saving TBitmap to PCX format? -
Could not load SSL library on the 64 bit Release version from Play Store
at3s replied to Alex40's topic in Cross-platform
Probably I have similar issue - application is freezing on splash screen in devices with the 64-bit system. I'm using libssl.so v 1.0.2r. The path is defined in an application in this way: IdOpenSSLSetLibPath(TPath.Combine(TPath.GetDocumentsPath, 'lib/arm64')); And file deployes in .\assets\internal\lib\arm64 folder. Where can I find that "SERVICENAME.template.java" file? It seems, I have not it. -
What is a way in Delphi FMX application to apply changes in SQLite database. F.e., there is an application v 1.0 in PlayMarked with the SQLite database v 0.1. New version 1.1 of an application comes with the database v 0.2 where was added new table, removed one field etc. How Delphi do (or not do and you did it instead) those migration work? When I was developing an application in Xamarin, there was a tool and it generated a "migration" script based on changes in DB classes, then Entity framework did all hard work.
-
TBitmap to TBytes for ESC/POS Thermal Printer
at3s replied to at3s's topic in RTL and Delphi Object Pascal
Here is my code. It's mostly the same as is in the sources here or here. And I'm getting the same result with the horizontal blank lines as here. uses System , System.SysUtils , System.UITypes , FMX.Graphics ; type TRgbTriple = packed record // do not change the order of the fields, do not add any fields Blue: Byte; Green: Byte; Red: Byte; end; // --------------------------- procedure TThermalPrinter.SendString(AValue: String); var SND: TBytes; begin SND := TEncoding.ASCII.GetBytes(AValue); LSockect.SendData(SND); // send data to the printer end; procedure TThermalPrinter.DoSetLineSpacing(AValue : integer); begin if (AValue = 0) then begin SendString(#$1B#$32{, false}); //Resetset to default end else begin SendString(#$1B#$33 + AnsiChar(AValue){, false}); end; end; procedure TThermalPrinter.DoPrintBitmap(const ABitmap : TBitmap; const BitsPerSlice : Byte); const Threshhold = 127; type TBitArray = array of boolean; TRGBTripleArray = ARRAY[Word] of TRGBTriple; pRGBTripleArray = ^TRGBTripleArray; // Use a PByteArray for pf8bit color. var BMPData: TBitmapData; vCol : integer; vRow : integer; vIndex : integer; vSliceIndex : integer; vBytePos : integer; vBitPos : integer; vOffset : integer; vLuminance : integer; vLine: pRGBTripleArray; vPixel: TAlphaColor; vDots: TBitArray; vSlice : Byte; vBit : Byte; vTmpBit: Byte; vVal: boolean; vTempStr : string; begin if not Assigned(ABitmap) then exit; ABitmap.Map(TMapAccess.Read, BMPData); try SetLength(vDots, (ABitmap.Height * ABitmap.Width)); vIndex := 0; for vRow := 0 to ABitmap.Height-1 do begin for vCol := 0 to ABitmap.Width-1 do begin vPixel := BMPData.GetPixel(vCol, vRow); vLuminance := Trunc((TAlphaColorRec(vPixel).R * 0.3) + (TAlphaColorRec(vPixel).G * 0.59) + (TAlphaColorRec(vPixel).B * 0.11)); vDots[vIndex] := (vLuminance < 127); Inc(vIndex); end; end; DoSetLineSpacing(24); SendString(' '); vOffset := 0; while (vOffset < ABitmap.Height) do begin SendString(#$1B'*'#33 + AnsiChar(Lo(ABitmap.Width)) + AnsiChar(Hi(ABitmap.Width)){, false}); vTempStr := ''; for vCol := 0 to ABitmap.Width-1 do begin for vSliceIndex := 0 to 2 do begin // Remember, 24 dots = 24 bits = 3 bytes. vSlice := 0; for vBit := 0 to 7 do begin vBytePos := (((vOffset div 8) + vSliceIndex) * 8) + vBit; vBitPos := (vBytePos * ABitmap.Width) + vCol; vVal := false; if (vBitPos < Length(vDots)) then begin vVal := vDots[vBitPos]; end; if vVal then vTmpBit := 1 else vTmpBit := 0; vSlice := vSlice or (vTmpBit shl (7 - vBit)); end; vTempStr := vTempStr + AnsiChar(vSlice); end; end; Inc(vOffset, 24); SendString(vTempStr + #13#10); end; DoSetLineSpacing(0); SendString(' '); finally vDots := nil; ABitmap.Unmap(BMPData); end; end; -
Actually I'm looking for a function which could convert TBitmap to TBytes for printing in ESC/POS Thermal Printer. I'm trying to make working a code from here, but also got an effect as on the author picture - white lines and not correct text on an image as well. Has someone a working code?
-
Yes, ShowShareSheetAction is a good option.
-
Thanks. It sounds interesting. It seems I did not describe my topic clear. I'm interesting rather in a way how to send a PDF file from Android\iOS device to the printer connected to this device.
-
What is the best approach to do this? I know, that there is not a simple solution in the FireMonkey for Android\iOS.
-
Problem with TDirectory.GetDirectories(TPath.GetSharedPicturesPath, '*') in Android 10
at3s replied to at3s's topic in Cross-platform
I'm agree with you. But I have not any special in my project setup settings. Any newly created FMX project shall have mostly the same AndroidManifest.template.xml file. So the topic's issue shall be there as well. -
Problem with TDirectory.GetDirectories(TPath.GetSharedPicturesPath, '*') in Android 10
at3s replied to at3s's topic in Cross-platform
Here is solution: [RSP-30935] Android 10 delphi 10.4 camera and gallery doesn't work - Embarcadero Technologies When I added android:requestLegacyExternalStorage="true" into 'AndroidManifest.template.xml', application started to be working so fine in Android 10. Now I'm interesting what shall be in Android 11... -
Problem with TDirectory.GetDirectories(TPath.GetSharedPicturesPath, '*') in Android 10
at3s replied to at3s's topic in Cross-platform
Based on topic "Runtime permissions in Android (new in Delphi 10.3)", do you think I have to grant ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION permissions as well? Otherwise I do not see any differnces I already define in an application.