at3s
Members-
Content Count
68 -
Joined
-
Last visited
Everything posted by at3s
-
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; -
What is the best approach to do this? I know, that there is not a simple solution in the FireMonkey for Android\iOS.
-
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.
-
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. -
Problem with TDirectory.GetDirectories(TPath.GetSharedPicturesPath, '*') in Android 10
at3s replied to at3s's topic in Cross-platform
It makes sense. But TPath.GetSharedPicturesPath returns /storage/emulated/0/Pictures/ I need to be able to show pictures from device in my form. -
Problem with TDirectory.GetDirectories(TPath.GetSharedPicturesPath, '*') in Android 10
at3s replied to at3s's topic in Cross-platform
Yes, it's checked. TDirectory.GetDirectories anyway returns an empty list for /storage/emulated/0/ -
I'd like to realize a multiselection in Popup Ctrl+<Mouse click>. I've owerwrite a TPopupList.WndProc in recreated PopupList object and defined mouse and keyboard hooks on popup. So I able to mark an item as selected (checked) in popup by pressing space button, but I'm not able to make it working with the Ctrl+<Mouse click> - popup always closes. Keyboard hook: function PopupMenuKeyboardHookProc(Code: Integer; wParam : WPARAM; lParam : LPARAM): Longint; stdcall; begin try if (Code = HC_ACTION) and (wParam = WM_KEYUP) then begin if PKBDLLHOOKSTRUCT(lParam)^.vkCode = VK_SPACE then begin if Assigned(PopupList) then begin PostMessage(PopupList.Window, WM_POPUP_SPACE_KEY_MINE, wParam, lParam); wParam := WM_NULL; lParam := 0; end; end; end; finally Result := 0; end; end; I tries to process WM_LBUTTONDOWN and WM_LBUTTONUP messages, but without success, popup anyway receives WM_MENUSELECT message with the (Msg.MenuFlag = $FFFF)and(Msg.Menu = 0)), so it closes. end; How to catch it?
-
Is it possible to multiselect in Popup using Ctrl+<Mouse click> ?
at3s replied to at3s's topic in VCL
Thank you, it sounds reasonable. -
Error while building an Android application in Delphi 10.4 Sydney
at3s replied to at3s's topic in FMX
Thank you, this solution works. -
Error while building an Android application in Delphi 10.4 Sydney
at3s replied to at3s's topic in FMX
I'm sorry, but where I have to change it? -
Error while building an Android application in Delphi 10.4 Sydney
at3s replied to at3s's topic in FMX
Exactly! I'm using this unit. But I do not see any newer versions of this unit on github. -
Error while building an Android application in Delphi 10.4 Sydney
at3s replied to at3s's topic in FMX
Thanks, but your propositions did not help: I've created a hard link D:\SDKs\SDK-25 and D:\NDKs\NDK-21, but I still get the same error. Any idea? -
I tried in Delphi to make working a C++ sample (Character spacing in RichEdit control) but spacing does not change (doc.Selection.Font.Spacing). I guess, Font.Spacing is deprecated but not sure. Did someone something similar or can confirm it's not possible?
-
Exactly. I even tried to copy and load different MsftEdit.dll versions in Windows 7, but without success.
-
It seems so. Does JvRichEdit's Spacing work fine in all Windows versions (Win7 x32, Win XP f.e.)?