QR Code in HMG
Moderator: Rathinagiri
QR Code in HMG
Alguien sabe si podemos hacer lo que hace esta pagina, en HMG ???
---------------------------------------------------------------------------------
Anyone know if we can do what this page does, in HMG ??
http://www.quickmark.com.tw/en/qrcode-d ... ?qrEncrypt
http://www.quickmark.com.tw/en/qrcode-d ... sp?qrVCard
---------------------------------------------------------------------------------
Anyone know if we can do what this page does, in HMG ??
http://www.quickmark.com.tw/en/qrcode-d ... ?qrEncrypt
http://www.quickmark.com.tw/en/qrcode-d ... sp?qrVCard
Andrés González López
Desde Guadalajara, Jalisco. México.
Desde Guadalajara, Jalisco. México.
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: QR Code in HMG
In HMG, we can create QR Code easily. What does that page do?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: QR Code in HMG
Crea codigo QR encriptado que al leerlo te pide una contraseñaRathinagiri wrote: ↑Sat May 27, 2017 4:38 am In HMG, we can create QR Code easily. What does that page do?
ó llenar una agenda con solo leer el codigo
-------------------------------------------------------------------------------------
Create encrypted QR code that, when read, prompts you for a password
Or fill an agenda with just read the code ...
De aqui se puede descargar un programa que lee codigos QR con la camara web
-----------------------------------------------------------------------------------------------
From here you can download a program that reads QR codes with the web camera
Andrés González López
Desde Guadalajara, Jalisco. México.
Desde Guadalajara, Jalisco. México.
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: QR Code in HMG
In which application?
In my Android device when I read with barcode application it shows some jungled characters.
In my Android device when I read with barcode application it shows some jungled characters.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: QR Code in HMG
Rathinagiri wrote: ↑Sat May 27, 2017 5:07 am In which application?
In my Android device when I read with barcode application it shows some jungled characters.
La idea es poder crear y leer codigos QR encriptados con HMG
-----------------------------------------------------------------------------
The idea is to create and read QR codes encrypted with HMG
- Attachments
-
- quickmark.jpg (107.29 KiB) Viewed 321464 times
Andrés González López
Desde Guadalajara, Jalisco. México.
Desde Guadalajara, Jalisco. México.
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: QR Code in HMG
IMHO, QR Code is an encoding system. You can encode any text including encrypted data.
Encryption as such is another complicated process consisting of not only the password and also the encryption algorithm like RSA. And to complicate the things further there can be a situation of private and public key pair where data encrypted with private/public key and decrypted with public/private key.
So, if we know the algorithm and key we can encrypt the data and encode it finally into QR Code.
Encryption as such is another complicated process consisting of not only the password and also the encryption algorithm like RSA. And to complicate the things further there can be a situation of private and public key pair where data encrypted with private/public key and decrypted with public/private key.
So, if we know the algorithm and key we can encrypt the data and encode it finally into QR Code.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: QR Code in HMG
Muchas gracias por la info Rathi !Rathinagiri wrote: ↑Sat May 27, 2017 5:27 am IMHO, QR Code is an encoding system. You can encode any text including encrypted data.
Encryption as such is another complicated process consisting of not only the password and also the encryption algorithm like RSA. And to complicate the things further there can be a situation of private and public key pair where data encrypted with private/public key and decrypted with public/private key.
So, if we know the algorithm and key we can encrypt the data and encode it finally into QR Code.
------------------------------------------
Many thanks for the info Rathi!
Andrés González López
Desde Guadalajara, Jalisco. México.
Desde Guadalajara, Jalisco. México.
Re: QR Code in HMG
Hola, aquí de nuevo con algunas dudas sobre códigos QR.
Generé un código de un tamaño adecuado, pero no logro que salga "completo" y no se puede leer.
Generé el mismo dato en una página online y no parecen estar igual pero al leerlo si despliega la
información correcta.
(Editado)
Ya anteriormente lo había hecho y revisando mi código, veo que hice un truco para poder leerlo,
solo cerrando el marco de la derecha, pero otra duda es:
Que pasa con esa parte que no se generó ?
por lo que veo no es necesaria ya que la lectura es correcta.
Quizá estoy haciendo algo mal ó es algún bug ?
*---------------------------------------------------------------------------------------------------------------------------
Hello, here again with some doubts about QR codes.
I generated a code of the right size, but I can't get it Out "full" and you can't read it.
I generated the same data on an online page and do not seem to be the same but when you read it unfold the
Correct information.
(Edited)
Previously I had done and revising my code, I see that I did a trick to read it,
Just closing the frame on the right, but another question is:
What about that part that wasn't generated?
From what I see is not necessary as the reading is correct.
Maybe I'm doing something wrong or is it a bug?
Generé un código de un tamaño adecuado, pero no logro que salga "completo" y no se puede leer.
Generé el mismo dato en una página online y no parecen estar igual pero al leerlo si despliega la
información correcta.
(Editado)
Ya anteriormente lo había hecho y revisando mi código, veo que hice un truco para poder leerlo,
solo cerrando el marco de la derecha, pero otra duda es:
Que pasa con esa parte que no se generó ?
por lo que veo no es necesaria ya que la lectura es correcta.
Quizá estoy haciendo algo mal ó es algún bug ?
*---------------------------------------------------------------------------------------------------------------------------
Hello, here again with some doubts about QR codes.
I generated a code of the right size, but I can't get it Out "full" and you can't read it.
I generated the same data on an online page and do not seem to be the same but when you read it unfold the
Correct information.
(Edited)
Previously I had done and revising my code, I see that I did a trick to read it,
Just closing the frame on the right, but another question is:
What about that part that wasn't generated?
From what I see is not necessary as the reading is correct.
Maybe I'm doing something wrong or is it a bug?
Code: Select all
HMG_CreateBarCode( "RFC-Emisor|RFC-Receptor|12345.00|20172106-3164-5644-225876345685|", ;
"QRCODE", 7, 100, .F., System.TempFolder+"CB_QRCODE.jpg", BLACK, WHITE, .t., .f., .f. )
Andrés González López
Desde Guadalajara, Jalisco. México.
Desde Guadalajara, Jalisco. México.
Re: QR Code in HMG
Hello Andrés.
I think this is a bug. My procedure for generating QRCODE codes directly in PDF and also based on hb_zebra library generates your QR code correctly.
In my spare time I will try to look at the sources in h_HMG_Zebra.Prg
I think this is a bug. My procedure for generating QRCODE codes directly in PDF and also based on hb_zebra library generates your QR code correctly.
In my spare time I will try to look at the sources in h_HMG_Zebra.Prg
Code: Select all
#include "hmg.ch"
Function Main()
SELECT HPDFDOC "sample.pdf" PAPERLENGTH 300 PAPERWIDTH 300 LOG
SET HPDFDOC ENCODING TO "WinAnsiEncoding"
START HPDFDOC
START HPDFPAGE
@10, 10 HPDFPRINT "QRCODE"
HPDFDrawBarcode(10, 50, "RFC-Emisor|RFC-Receptor|12345.00|20172106-3164-5644-225876345685|", "QRCODE", 4)
END HPDFPAGE
END HPDFDOC
Execute File 'sample.pdf'
Return Nil
*******************************
PROCEDURE HPDFDrawBarcode( nRow, nCol, cCode, cType, nLineWidth, nLineHeight, lShowDigits, lCheckSum, lWide2_5, lWide3 )
Local hZebra, cTxt, nFlags, nSizeWidth, nTextWidth
Local hPdf := _HMG_SYSDATA[ 150 ][ 1 ]
Local hPage := _HMG_SYSDATA[ 150 ][ 7 ]
Local nWidth := _HMG_SYSDATA[ 150 ][ 4 ]
Local nHeight := _HMG_SYSDATA[ 150 ][ 5 ]
Local nxPos := _HMG_HPDF_MM2Pixel( nCol )
Local nyPos := nHeight - _HMG_HPDF_MM2Pixel( nRow )
Local cFont := "Helvetica"
Local nFontSize := 9
Local nTextHeight := 0
DEFAULT nLineWidth := 1
DEFAULT nLineHeight := 18
DEFAULT lCheckSum := .F.
DEFAULT lWide2_5 := .F.
DEFAULT lWide3 := .F.
DEFAULT lShowDigits := .F.
nFlags := 0
IF lChecksum
nFlags := nFlags + HB_ZEBRA_FLAG_CHECKSUM
ENDIF
IF lWide2_5
nFlags := nFlags + HB_ZEBRA_FLAG_WIDE2_5
ENDIF
IF lWide3
nFlags := nFlags + HB_ZEBRA_FLAG_WIDE3
ENDIF
IF nFlags == 0
nFlags := Nil
ENDIF
SWITCH cType
CASE "EAN13" ; hZebra := hb_zebra_create_ean13( cCode, nFlags ) ; EXIT
CASE "EAN8" ; hZebra := hb_zebra_create_ean8( cCode, nFlags ) ; EXIT
CASE "UPCA" ; hZebra := hb_zebra_create_upca( cCode, nFlags ) ; EXIT
CASE "UPCE" ; hZebra := hb_zebra_create_upce( cCode, nFlags ) ; EXIT
CASE "CODE39" ; hZebra := hb_zebra_create_code39( cCode, nFlags ) ; EXIT
CASE "ITF" ; hZebra := hb_zebra_create_itf( cCode, nFlags ) ; EXIT
CASE "MSI" ; hZebra := hb_zebra_create_msi( cCode, nFlags ) ; EXIT
CASE "CODABAR" ; hZebra := hb_zebra_create_codabar( cCode, nFlags ) ; EXIT
CASE "CODE93" ; hZebra := hb_zebra_create_code93( cCode, nFlags ) ; EXIT
CASE "CODE11" ; hZebra := hb_zebra_create_code11( cCode, nFlags ) ; EXIT
CASE "CODE128" ; hZebra := hb_zebra_create_code128( cCode, nFlags ) ; EXIT
CASE "PDF417" ; hZebra := hb_zebra_create_pdf417( cCode, nFlags ); nLineHeight := nLineWidth * 3 ; lShowDigits := .f. ; EXIT
CASE "DATAMATRIX" ; hZebra := hb_zebra_create_datamatrix( cCode, nFlags ); nLineHeight := nLineWidth ; lShowDigits := .f. ; EXIT
CASE "QRCODE" ; hZebra := hb_zebra_create_qrcode( cCode, nFlags ); nLineHeight := nLineWidth ; lShowDigits := .f. ; EXIT
ENDSWITCH
IF hZebra != NIL
IF hb_zebra_geterror( hZebra ) == 0
IF lShowDigits
cTxt := ALLTRIM(hb_zebra_getcode( hZebra ))
nSizeWidth := HMG_Zebra_GetWidth (hZebra, nLineWidth, nLineHeight, NIL)
nSizeHeight := HMG_Zebra_GetHeight (hZebra, nLineWidth, nLineHeight, NIL)
HPDF_Page_SetFontAndSize( hPage, HPDF_GetFont( hPdf, cFont, NIL ), nFontSize )
nTextWidth := HPDF_Page_TextWidth( hPage, cTxt )
nTextHeight:= nFontSize - 1
HPDF_Page_BeginText( hPage )
HPDF_Page_TextOut( hPage, (nxPos + ( nSizeWidth / 2 )) - ( nTextWidth / 2 ), nyPos - nSizeHeight, cTxt )
HPDF_Page_EndText( hPage )
ENDIF
hb_zebra_draw_hpdf( hZebra, hPage, nxPos, nyPos, nLineWidth, -(nLineHeight-nTextHeight))
ELSE
MsgInfo ("Type "+ cType + CRLF +"Code "+ cCode+ CRLF+ "Error "+LTrim(hb_valtostr(hb_zebra_geterror(hZebra))))
ENDIF
hb_zebra_destroy( hZebra )
ELSE
MsgStop("Invalid barcode type !", cType)
ENDIF
RETURN
***************************************
STATIC FUNCTION hb_zebra_draw_hpdf( hZebra, hPage, ... )
IF hb_zebra_geterror( hZebra ) != 0
RETURN HB_ZEBRA_ERROR_INVALIDZEBRA
ENDIF
hb_zebra_draw( hZebra, {| x, y, w, h | HPDF_Page_Rectangle( hPage, x, y, w, h ) }, ... )
HPDF_Page_Fill( hPage )
RETURN 0
******************************************************
*-----------------------------------------------------------------------------------------------*
FUNCTION HMG_Zebra_GetWidth (hZebra, nLineWidth, nLineHeight, iFlags)
*-----------------------------------------------------------------------------------------------*
LOCAL x1:= 0, y1 := 0, nBarWidth := 0, nBarHeight := 0
// always --> nBarHeight = nLineHeight
IF hb_zebra_GetError( hZebra ) != 0
RETURN HB_ZEBRA_ERROR_INVALIDZEBRA
ENDIF
// hb_zebra_draw ( hZebra, bCodeBlock, dX, dY, dWidth, dHeight, iFlags )
hb_zebra_draw ( hZebra, {| x, y, w, h | nBarWidth:=MAX(x+w-x1, nBarWidth), nBarHeight:=MAX(y+h-y1, nBarHeight) }, x1, y1, nLineWidth, nLineHeight, iFlags )
RETURN nBarWidth
*-----------------------------------------------------------------------------------------------*
FUNCTION HMG_Zebra_GetHeight (hZebra, nLineWidth, nLineHeight, iFlags)
*-----------------------------------------------------------------------------------------------*
LOCAL x1:= 0, y1 := 0, nBarWidth := 0, nBarHeight := 0
// always --> nBarHeight = nLineHeight
IF hb_zebra_GetError( hZebra ) != 0
RETURN HB_ZEBRA_ERROR_INVALIDZEBRA
ENDIF
// hb_zebra_draw ( hZebra, bCodeBlock, dX, dY, dWidth, dHeight, iFlags )
hb_zebra_draw ( hZebra, {| x, y, w, h | nBarWidth:=MAX(x+w-x1, nBarWidth), nBarHeight:=MAX(y+h-y1, nBarHeight) }, x1, y1, nLineWidth, nLineHeight, iFlags )
RETURN nBarHeight
Last edited by edk on Sun Nov 26, 2017 9:14 pm, edited 1 time in total.
Re: QR Code in HMG
I found a bug in h_HMG_Zebra.Prg
You must change at FUNCTION HMG_Zebra_GetWidth and FUNCTION HMG_Zebra_GetHeight:
to
Then rebuild hmg.
You must change at FUNCTION HMG_Zebra_GetWidth and FUNCTION HMG_Zebra_GetHeight:
Code: Select all
hb_zebra_draw ( hZebra, {| x, y, w, h | nBarWidth:=x+w-x1, nBarHeight:=y+h-y1 }, x1, y1, nLineWidth, nLineHeight, iFlags )
Code: Select all
hb_zebra_draw ( hZebra, {| x, y, w, h | nBarWidth:=MAX(x+w-x1, nBarWidth), nBarHeight:=MAX(y+h-y1, nBarHeight) }, x1, y1, nLineWidth, nLineHeight, iFlags )