P& A
Nov 21, 2014 03:13 AM
Active user
Rating:
2
Joined: Jan 14, 2013
Company:
Hi all! can i print 'qr' code on 1C ?
Timofey Bugaevsky
Nov 21, 2014 06:41 AM
Timofey Bugaevsky
Guest
Joined:
Company:
Hello, P& A. To print a QR code you need an add-in.
P& A
Nov 24, 2014 02:28 AM
Active user
Rating:
2
Joined: Jan 14, 2013
Company:
Hello, Timofey Bugaevsky! Thanks!
Timofey Bugaevsky
Nov 26, 2014 04:15 AM
Timofey Bugaevsky
Guest
Joined:
Company:
Hello, P& A. You can find the QR code generation add-in in attachments for this message, see qr.zip file. To use this add-in you need to attach it and call GenerateQRCode() method. I made an example for you. Please see the attached qrsample.cf file.
Code &AtClient
Procedure ExecutePrintQRCode(Command)
SpreadsheetDocument = PrintQRCode("More samples on 1C:Developer Network forum: http://1c-dn.com/forum/");
If SpreadsheetDocument <> Undefined Then
SpreadsheetDocument.Show(NStr("en = 'QR code sample'"));
EndIf;
EndProcedure
&AtServer
Function PrintQRCode(QRString)
SpreadsheetDocument = New SpreadsheetDocument;
Template = GetCommonTemplate("QRCodeSample");
Area = Template.GetArea("Output");
QRCodeData = QRCodeData(QRString, 0, 190);
If Not TypeOf(QRCodeData) = Type("BinaryData") Then
UserMessage = New UserMessage;
UserMessage.Text = NStr("en = 'Unable to generate QR code'");
UserMessage.Message();
Return Undefined;
EndIf;
QRCodePicture = New Picture(QRCodeData);
Area.Drawings.QRCode.Picture = QRCodePicture;
SpreadsheetDocument.Put(Area);
Return SpreadsheetDocument;
EndFunction
&AtServer
Function QRCodeData(QRString, CorrectionLevel, Size)
ErrorMessage = НСтр("en = 'Unable to attach the QR code generation add-in.'");
Try
If AttachAddIn("CommonTemplate.QRCodeAddIn", "QR") Then
QRCodeGenerator = New("AddIn.QR.QRCodeExtension");
Else
UserMessage = New UserMessage;
UserMessage.Text = ErrorMessage;
UserMessage.Message();
EndIf
Except
DetailErrorDescription = DetailErrorDescription(ErrorInfo());
UserMessage = New UserMessage;
UserMessage.Text = ErrorMessage + Chars.LF + DetailErrorDescription;
UserMessage.Message();
EndTry;
Try
PictureBinaryData = QRCodeGenerator.GenerateQRCode(QRString, CorrectionLevel, Size);
Except
UserMessage = New UserMessage;
UserMessage.Text = DetailErrorDescription(ErrorInfo());
UserMessage.Message();
EndTry;
Return PictureBinaryData;
EndFunction
P& A
Dec 01, 2014 03:11 AM
Active user
Rating:
2
Joined: Jan 14, 2013
Company:
Hello Timofey Bugaevsky! Thanks you for this example.
Edited: P& A
- Dec 01, 2014 04:08 AM
Alex Kas
Apr 26, 2016 05:24 AM
Just came
Rating:
0
Joined: Apr 26, 2016
Company:
Timofey Bugaevsky, hello. There is a problem with a Russian text when print QR code I have a linux server with 1C server installed on it and 1C clients on Windows So I print QR code, and there is an error when I try to read it
Timofey Bugaevsky
Apr 26, 2016 07:50 AM
Timofey Bugaevsky
Guest
Joined:
Company:
Hello, Alex Kas. Could you please give more details on your problem?
Alex Kas
Apr 27, 2016 01:05 AM
Just came
Rating:
0
Joined: Apr 26, 2016
Company:
Quote Timofey Bugaevsky wrote: Name
so I have a server ubuntu 14.04.4 LTS
1C 8.3.6.2449
windows 10 as a client
^это тест^Проверка кода^1234,234^ - this is the text that I try to put in QR-code
this is the result
Timofey Bugaevsky
Apr 27, 2016 08:37 AM
Timofey Bugaevsky
Guest
Joined:
Company:
Hello. Maybe you need to use another encoding for your text. Try UTF-8.
Alex Kas
Apr 28, 2016 01:13 AM
Just came
Rating:
0
Joined: Apr 26, 2016
Company:
I try to save a string with russian text in textdocument in utf-8, and then put text from the document in QRCodeData function. And this is don't solve the problem... What else can I try?
Timofey Bugaevsky
May 04, 2016 07:49 AM
Timofey Bugaevsky
Guest
Joined:
Company:
Hello, Alex Kas! I have updated the QR add-in. This should solve the problem on Linux. Please see the attachments.
Alex Kas
May 09, 2016 11:56 PM
Just came
Rating:
0
Joined: Apr 26, 2016
Company:
Timofey Bugaevsky, This version works fine. thx!
Subscribe