Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
LCL
»
[SOLVED] QRCode component
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
compiler messages suggest...
by
n7800
[
Today
at 02:05:13 am]
Common File Dialogs Have ...
by
msintle
[
Today
at 01:03:26 am]
[Solved] pointer to out o...
by
440bx
[
Today
at 12:51:22 am]
storing string
by
ASerge
[December 04, 2024, 11:06:57 pm]
Benchmarks
by
alpine
[December 04, 2024, 10:24:55 pm]
Bright color
by
wp
[December 04, 2024, 10:24:04 pm]
Show Form at Top
by
n7800
[December 04, 2024, 10:16:21 pm]
Arrow keys in FV
by
HotShoe
[December 04, 2024, 10:04:56 pm]
"Active $IFDEF code" is r...
by
MarkMLl
[December 04, 2024, 09:49:15 pm]
NSHapticFeedbackPerformer
by
msintle
[December 04, 2024, 09:47:25 pm]
[SOLVED] Howto use a DEFI...
by
MarkMLl
[December 04, 2024, 09:43:08 pm]
Use tts0, This example is...
by
coradi
[December 04, 2024, 09:37:12 pm]
Library for XSLT 2.0 Tran...
by
ebizz
[December 04, 2024, 06:54:35 pm]
How to know when dragging...
by
Aistis
[December 04, 2024, 06:41:46 pm]
Problem with Hints
by
Handoko
[December 04, 2024, 04:37:21 pm]
Breakpoint dosn't work
by
Martin_fr
[December 04, 2024, 03:55:08 pm]
SetLength fall
by
LemonParty
[December 04, 2024, 03:29:35 pm]
Feature Request for TMapV...
by
EkkehardDomning
[December 04, 2024, 03:23:27 pm]
TLazSerial : serial port ...
by
tetrastes
[December 04, 2024, 02:15:26 pm]
The Silver Coder on YouTu...
by
silvercoder70
[December 04, 2024, 11:45:36 am]
Type Library Viewer, Impo...
by
korba812
[December 04, 2024, 11:39:38 am]
Developing a Kernel Modul...
by
MarkMLl
[December 04, 2024, 11:21:12 am]
C operators and shift
by
Thaddy
[December 04, 2024, 10:45:03 am]
ZDataset.Locate + loParti...
by
tintinux
[December 04, 2024, 09:14:48 am]
Storing line colors
by
Khrys
[December 04, 2024, 07:51:29 am]
« previous
next »
Print
Pages: [
1
]
2
Author
Topic: [SOLVED] QRCode component (Read 2469 times)
Pe3s
Hero Member
Posts: 573
[SOLVED] QRCode component
«
on:
September 23, 2023, 07:42:30 am »
Hello forum members, I have a question: are there any other components than LazBarcodes with more options?
«
Last Edit: September 24, 2023, 11:59:56 am by Pe3s
»
Logged
wp
Hero Member
Posts: 12458
Re: QRCode component
«
Reply #1 on:
September 23, 2023, 11:48:17 am »
Be more specific. What in particular is missing?
Logged
Pe3s
Hero Member
Posts: 573
Re: QRCode component
«
Reply #2 on:
September 23, 2023, 01:18:45 pm »
@wp, I can't make a business card in LazBarcode unless I don't know how to do it
Logged
wp
Hero Member
Posts: 12458
Re: QRCode component
«
Reply #3 on:
September 23, 2023, 05:04:05 pm »
You mean you want to add a QRcode to a business card file for printing? You better use the barcode component in LazReport, because it saves you some steps.
But the effort to do this without LazReport is not so big. Just some scaling to correct for the differences in resolutions. As for the barcode, there is a method PaintToCanvas which allows you to draw the barcode directly on the canvas of the printer.
See attached demo which prints a business card in multiple copies from the screen to a sheet of paper.
Logged
Pe3s
Hero Member
Posts: 573
Re: QRCode component
«
Reply #4 on:
September 23, 2023, 05:08:24 pm »
@wp, I meant a business card in the form of a qrcode
- First name Last Name
-address
-Phone number
Logged
wp
Hero Member
Posts: 12458
Re: QRCode component
«
Reply #5 on:
September 23, 2023, 05:24:59 pm »
That's what's in the sample project. The QRCode on the business code contains the information in the other fields. Just assign the text to the text property of the barcode:
Code: Pascal
[Select]
[+]
[-]
procedure
TForm1
.
FormCreate
(
Sender
:
TObject
)
;
begin
BarcodeQR1
.
Text
:
=
'Donald Duck'
+
LineEnding
+
'1234 Main Street, Duck Town'
+
LineEnding
+
'phone: +12 / 34 56 78 90'
+
LineEnding
+
'mail: donald.duck@duckmail.org'
;
end
;
Logged
Pe3s
Hero Member
Posts: 573
Re: QRCode component
«
Reply #6 on:
September 23, 2023, 07:32:14 pm »
Is it possible to set the Contact mode so that, for example, the phone can save contacts?
Logged
wp
Hero Member
Posts: 12458
Re: QRCode component
«
Reply #7 on:
September 23, 2023, 11:14:33 pm »
I don't know what you mean. LazBarcode is just for displaying barcodes...
Logged
Fibonacci
Hero Member
Posts: 600
Internal Error Hunter
Re: QRCode component
«
Reply #8 on:
September 23, 2023, 11:51:07 pm »
For low level QR code you can look here: (@wp helped me with this)
https://forum.lazarus.freepascal.org/index.php/topic,64635
What you are looking for is just vCard. QRCode contains just text/binary data, vCard format looks like this:
Code: Pascal
[Select]
[+]
[-]
BEGIN
:
VCARD
VERSION
:
4.0
FN
:
Simon Perreault
N
:
Perreault
;
Simon
;;;
ing
.
jr
,
M
.
Sc
.
BDAY
:
--
0203
GENDER
:
M
EMAIL
;
TYPE
=
work
:
simon
.
perreault
@
viagenie
.
ca
END
:
VCARD
So I passed this vCard to QRCode generator like this:
Code: Pascal
[Select]
[+]
[-]
TEXT_STRING
:
=
''
+
'BEGIN:VCARD'
+
LineEnding
+
'VERSION:4.0'
+
LineEnding
+
'FN:Simon Perreault'
+
LineEnding
+
'N:Perreault;Simon;;;ing. jr,M.Sc.'
+
LineEnding
+
'BDAY:--0203'
+
LineEnding
+
'GENDER:M'
+
LineEnding
+
'EMAIL;TYPE=work:simon.perreault@viagenie.ca'
+
LineEnding
+
'END:VCARD'
+
LineEnding
;
And the result you can see in the attachment
More info about vCard format:
https://en.wikipedia.org/wiki/VCard
BTW. You can still scan the QR in the attachment, despite not the best quality and small size, and it works
«
Last Edit: September 24, 2023, 12:06:59 am by Fibonacci
»
Logged
Pe3s
Hero Member
Posts: 573
Re: QRCode component
«
Reply #9 on:
September 24, 2023, 11:59:42 am »
@wp, @Fibonacci, Thank you for your help, big beer
Logged
Pe3s
Hero Member
Posts: 573
Re: [SOLVED] QRCode component
«
Reply #10 on:
September 25, 2023, 09:43:39 pm »
One more question why vcard does not show the memo contents in the next lines, only in the first one.
Code: Pascal
[Select]
[+]
[-]
procedure
TForm1
.
Button1Click
(
Sender
:
TObject
)
;
begin
BarcodeQR1
.
Text
:
=
''
+
'BEGIN:VCARD'
+
LineEnding
+
'VERSION:3.0'
+
LineEnding
+
'N:'
+
Edit1
.
Text
+
LineEnding
+
'ORG:'
+
Edit2
.
Text
+
LineEnding
+
'ADR:'
+
Edit3
.
Text
+
LineEnding
+
'TEL:'
+
Edit4
.
Text
+
LineEnding
+
'EMAIL:'
+
Edit5
.
Text
+
LineEnding
+
'NOTE:'
+
Memo1
.
Lines
.
Text
+
LineEnding
+
'END:VCARD'
;
end
;
Logged
Fibonacci
Hero Member
Posts: 600
Internal Error Hunter
Re: [SOLVED] QRCode component
«
Reply #11 on:
September 25, 2023, 09:50:58 pm »
Sorry I'm on the phone now so I can't test, but, put another memo on your form and set it's text property to text property of this qrcode component, then you will see what vCard you generated. It's probably invalid.
Logged
Pe3s
Hero Member
Posts: 573
Re: [SOLVED] QRCode component
«
Reply #12 on:
September 25, 2023, 10:01:08 pm »
qrcode only generates the first line in the memo, if we add subsequent lines to the memo it does not
Logged
wp
Hero Member
Posts: 12458
Re: [SOLVED] QRCode component
«
Reply #13 on:
September 25, 2023, 10:55:30 pm »
Quote from: Pe3s on September 25, 2023, 10:01:08 pm
qrcode only generates the first line in the memo, if we add subsequent lines to the memo it does not
IIRC you must replace the lineendings in the memo by '\n'
Code: Pascal
[Select]
[+]
[-]
procedure
TForm1
.
Button1Click
(
Sender
:
TObject
)
;
begin
BarcodeQR1
.
Text
:
=
''
+
'BEGIN:VCARD'
+
LineEnding
+
'VERSION:3.0'
+
LineEnding
+
'N:'
+
Edit1
.
Text
+
LineEnding
+
'ORG:'
+
Edit2
.
Text
+
LineEnding
+
'ADR:'
+
Edit3
.
Text
+
LineEnding
+
'TEL:'
+
Edit4
.
Text
+
LineEnding
+
'EMAIL:'
+
Edit5
.
Text
+
LineEnding
+
'NOTE:'
+
StringReplace
(
Memo1
.
Lines
.
Text
,
LineEnding
,
'\n'
,
[
rfReplaceAll
]
)
+
LineEnding
+
'END:VCARD'
;
end
;
Logged
Fibonacci
Hero Member
Posts: 600
Internal Error Hunter
Re: [SOLVED] QRCode component
«
Reply #14 on:
September 26, 2023, 10:18:23 am »
Yes, I was trying to force him to see it himself
Each line in the vCard must begin with a known keyword, field type
Code: C
[Select]
[+]
[-]
BEGIN
:
VCARD
VERSION
:
3.0
NOTE
:
Line
1
\nLine
2
\nLine
3
END
:
VCARD
He probably had something like this:
Code: C
[Select]
[+]
[-]
BEGIN
:
VCARD
VERSION
:
3.0
NOTE
:
Line
1
Line
2
# invalid
Line
3
# invalid
END
:
VCARD
Logged
Print
Pages: [
1
]
2
« previous
next »
Lazarus
»
Forum
»
Programming
»
LCL
»
[SOLVED] QRCode component
TinyPortal
© 2005-2018