Jump to content

at3s

Members
  • Content Count

    46
  • Joined

  • Last visited

Community Reputation

1 Neutral

Technical Information

  • Delphi-Version
    Delphi 10.4 Sydney

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. You're awesome! You've fixed my problem. Thanks a lot.
  2. 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.
  3. 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.
  4. 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?
  5. 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.
  6. at3s

    SQLite migration tool in FMX application

    Thanks, FDBatchMove seems like a good start point.
  7. 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.
  8. 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;
  9. 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?
  10. Yes, ShowShareSheetAction is a good option.
  11. 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.
  12. What is the best approach to do this? I know, that there is not a simple solution in the FireMonkey for Android\iOS.
  13. 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.
  14. 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...
  15. 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.
×