Generate EPC-QR-Code in FileMaker
One of our clients asked for how to create payment QR-Codes in FileMaker and we just made him a new example for this. You may prepare the data, but then you can use MBS Plugin to create the barcode and put it as picture in a container and print it on your invoice. Or you use DynaPDF to draw it as vector graphics to keep it sharp.
Here is the main script with the full calculation to assemble the text for the barcode:
# EPC-QR-Code generation
#
Go to Layout [ “Tabelle” ; Animation: None ]
# Sample data for QR-Code. May need adjustment to final standard
Set Variable [ $text ; Value: // Service Tag
"BCD" & ¶ &
// Version (001 oder 002)
Right( Tabelle::Version ; 4 ) & ¶ &
// Character set: 1 = UTF-8
"1" & ¶ &
// Identification: SEPA Credit Transfer
"SCT" & ¶ &
// BIC of receiver. optional for EEA
Tabelle::BIC & ¶ &
// Name of receiver
Left(Tabelle::Name; 70) & ¶ &
// IBAN of receiver
Tabelle::IBAN & ¶ &
// Amount. We replace comma with dot for German amounts
"EUR" & Substitute(Tabelle::Amount; ","; ".") & ¶ &
// Zweck, 4 letter code, optional
Left(Tabelle::Intention; 4) & ¶ &
// Reference 35-Character-Code, see ISO 11649 RF Creditor Reference
Left(Tabelle::Reference1; 35) & ¶ &
// Reference
Left(Tabelle::Reference2; 140) & ¶ &
// Note to user
Tabelle::Note ]
#
# Barcode options. We use high level as we draw over barcode.
Set Variable [ $o ; Value: MBS("Barcode.SetOptions"; 4) // ECC Level with values from 1 = low, 2 = middle, 3 = better, 4 high. ]
Set Field [ Tabelle::Code ; TextFormatRemove ( $text ) ]
#
# CRLF line endings needed
Set Variable [ $text ; Value: MBS( "Text.ReplaceNewline"; $text; 3 ) ]
# We render barcode at 4x size for better drawing later
Set Variable [ $img ; Value: MBS("Barcode.Generate";"QRCODE"; $text; 0; 0; 0; 4; 0; 1; "UTF-8") ]
If [ MBS("IsError") = 0 ]
# Save to field
Set Field [ Tabelle::Barcode ; MBS( "GMImage.WriteToPNGContainer"; $img; "barcode.png" ) ]
#
# Clean up
Set Variable [ $r ; Value: MBS( "GMImage.Destroy"; $img) ]
End If
Feel free to try the example database with next plugin pre-release and let us know if you find some issue.
If we have changes to the script, we'll keep the example database updated for you. Please do not hesitate to contact us with your questions.