YOUSEFUL / FILEMAKER
YsflBarcode — function reference
Function prefix YsflBc_, 12 functions. Generation only (no scanning). Built on the zint
2.13.0 encoding library (BSD-3-Clause, vendored under shared/third_party/zint). Failures return
? message using the encoder's own wording; details through YsflBc_LastError / YsflBc_LastErrorText.
Symbologies
Names are case- and punctuation-insensitive (Code128, code-128, CODE 128 all work), and any
zint numeric id is accepted. YsflBc_Symbologies lists every one this build supports as NAME|id.
Common names: Code128, Code128AB, GS1-128, Code39, Code39Ext, Code93, Code11,
EAN13/EAN, EAN8, UPCA, UPCE, ITF14, ITF, Codabar, MSI, Telepen, Pharmacode,
Logmars, PZN, Code32, Postnet, Planet, EAN14, SSCC, DataBar, DataBarExpanded,
DataBarStacked, DataBarLimited, CodablockF, Code16K, Code49, QR/QRCode, MicroQR,
rMQR, UPNQR, DataMatrix, PDF417, MicroPDF417, Aztec, MaxiCode, DotCode, HanXin,
CodeOne, GridMatrix, Ultracode.
EAN add-ons use +: 5901234123457+12345. GS1 data uses bracketed AIs: [01]09501101530003[17]261231
(GS1-128 and DataBar assume GS1; add the gs1 option for Data Matrix, QR, Aztec, …).
Options
Space-separated key=value tokens and flags; may also be given one per line.
| option | meaning |
|---|---|
scale=N |
pixels per module (default 2; halves allowed, e.g. 2.5) |
xdim=<mm> dpi=N |
derive the scale from an X-dimension in mm at a print resolution (dpi default 300) |
height=N |
bar height in modules (linear symbologies) |
quiet=0|1 |
standard quiet zones (default 1); noquiet |
text=0|1 |
human-readable text (default 1); notext; bold, small |
fg=RRGGBB, bg=RRGGBB |
colours, # optional; 8 hex digits add alpha |
rotate=0|90|180|270 |
rotation |
ecc=… |
error correction: L/M/Q/H for QR, MicroQR, rMQR, Aztec, Han Xin, Grid Matrix; 0–8 for PDF417; numeric elsewhere |
size=N |
QR/rMQR version, Data Matrix size index, Aztec layers, MaxiCode mode (version, layers, mode are aliases) |
columns=N, rows=N |
PDF417 / MicroPDF417 / Codablock-F layout |
square, dmre |
Data Matrix: square symbols only / allow rectangular extensions |
gs1, unicode, binary, escape |
input mode (default unicode); escape enables \n, \xNN, … |
border=N, box=N |
bind bars above/below or a box around, N modules wide |
whitespace=N, vwhitespace=N |
extra quiet space in modules |
eci=N |
Extended Channel Interpretation |
name=<file> |
container file name (default barcode.png) |
Functions
| Function | Returns |
|---|---|
YsflBc_Generate ( symbology ; data ; {options} ) |
container with a PNG (FNAM, PNGf, SIZE streams) |
YsflBc_GenerateToFile ( symbology ; data ; path ; {options} ) |
0; format by extension: png, svg, eps, bmp, gif, tif, emf, pcx (non-PNG paths must be ASCII) |
YsflBc_GenerateSVG ( symbology ; data ; {options} ) |
SVG text (scalable, embeds the text font) |
YsflBc_Validate ( symbology ; data ; {options} ) |
"" when the data encodes, else the encoder's message (no ? prefix) |
YsflBc_CheckDigit ( symbology ; data ) |
the check character(s) the symbology appends (EAN-13/8, UPC-A/E, ITF-14, EAN-14, SSCC, Code 39/Logmars/Code 32 mod-43, Interleaved 2 of 5, Codabar, MSI, Code 11, Telepen); "" when the data already carries it |
YsflBc_ImageSize ( symbology ; data ; {options} ) |
width,height in pixels for the same options |
YsflBc_Symbologies |
NAME|id lines |
YsflBc_SetDefaults ( {options} ) |
0; options applied before every call's own options ("" resets); validated immediately |
YsflBc_Version |
YsflBarcode v.1.0.0 (zint 2.13.0) |
YsflBc_Register ( {option} ), YsflBc_LastError, YsflBc_LastErrorText |
as other Youseful plugins |
Examples
Set Field [ Labels::Barcode ; YsflBc_Generate ( "Code128" ; Items::SKU ; "scale=3 height=60" ) ]
Set Field [ Labels::QR ; YsflBc_Generate ( "QR" ; "https://example.com/i/" & Items::ID ; "ecc=M scale=4 name=qr.png" ) ]
Set Field [ Labels::GS1 ; YsflBc_Generate ( "GS1-128" ; "[01]" & Items::GTIN & "[10]" & Items::Lot ) ]
Set Variable [ $svg ; YsflBc_GenerateSVG ( "DataMatrix" ; Items::Serial ; "square" ) ]
If [ YsflBc_Validate ( "EAN13" ; Items::EAN ) ≠ "" ] # show the message
Set Field [ Items::EAN ; Items::EAN12 & YsflBc_CheckDigit ( "EAN13" ; Items::EAN12 ) ]Notes
- The PNG is black on white, RGB (RGBA when an alpha colour is used), with standard quiet zones included in the pixel size.
YsflBc_Generatereturns aPNGfcontainer; store it in a container field or useYsflCr_ContainerToBase64/YsflFi_WriteContainerfrom the other Youseful plugins to move it around.