Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Barcode.GenerateJSON
Generates a barcode.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Barcode | 9.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example |
---|---|---|
JSON | The JSON block with all options. | { "symbology": "QRCode", "Text": "Hello World", "Scale": 4 } |
Result
Returns GMImage reference or error.
Description
Generates a barcode.All parameters come as values in JSON block and most are optional.
Key | Value | Example |
Symbology | Symbol to use. Can be number or text name. | QRCode |
Height | Barcode height in X-dimensions (ignored for fixed-width barcodes) | 50 |
Scale | Scale factor when printing barcode, i.e. adjusts X-dimension. Default 1. Usually 4 or bigger for printing in high resolution. | 1 |
WhitespaceWidth | Width in X-dimensions of whitespace to left & right of barcode. | 5 |
WhitespaceHeight | Height in X-dimensions of whitespace above & below the barcode. | 5 |
BorderWidth | Size of border in X-dimensions. | 5 |
OutputOptions | Set various output file options as number. | 32+4 |
ForeGroundColor | Foreground as RGB/RGBA hexadecimal string, 6 or 8 characters. | "ff0000" |
BackGroundColor | Background as RGB/RGBA hexadecimal string, 6 or 8 characters. | "0000ff" |
Primary | Primary message data (MaxiCode, Composite) "" | |
Option1 | Symbol specific options. | 0 |
Option2 | Symbol specific options. | 0 |
Option3 | Symbol specific options. | 0 |
ShowText | Show (1) or hide (0) Human Readable Text. Default 1. | 1 |
InputMode | Encoding of input data. Pass 0 for data, 1 for unicode. | 1 |
ECI | Extended Channel Interpretation mode. | 3 |
DotSize | Size of dots used in dotty mode. | 1.25 |
GuardDescent | Height in X-dimensions that EAN/UPC guard bars descend. Default 5. | 5 |
Text | Human readable text, which usually consists of input data plus one more check digit. | "Hello World" |
Transparent | Transparency mode: 0: black on white, 1: black on transparent background, 2: white on black, 3: white on transparent background | 0 |
Rotation | Rotation angle to use. Multiply of 90°. | 0 |
Possible symbologies: CODE11, C25MATRIX, C25INTER, C25IATA, C25LOGIC, C25IND, CODE39, EXCODE39, EAN8, EANX, EAN128, CODABAR, CODE128, DPLEIT, DPIDENT, CODE16K, CODE49, CODE93, FLAT, RSS14, RSSLTD, RSSEXP, TELEPEN, UPCA, UPCE, POSTNET, MSIPLESSEY, FIM, LOGMARS, PHARMA, PZN, PHARMA_TWO, PDF417, PDF417TRUNC, MAXICODE, QRCODE, CODE128B, AUSPOST, AUSREPLY, AUSROUTE, AUSREDIRECT, ISBNX, RM4SCC, DATAMATRIX, EAN14, CODABLOCKF, NVE18, JAPANPOST, KOREAPOST, RSS14STACK, RSS14STACKOMNI, RSSEXPSTACK, PLANET, MICROPDF417, ONECODE, PLESSEY, TELEPEN_NUM, ITF14, KIX, AZTEC, DAFT, MICROQR, HIBC128, HIBC39, HIBCDM, HIBCQR, HIBCPDF, HIBCMICPDF, HIBCBLOCKF, HIBCAZTEC, AZRUNE, CODE32, EANXCC, EAN128CC, RSS14CC, RSSLTDCC, RSSEXPCC, UPCACC, UPCECC, RSS14STACKCC, RSS14OMNICC, RSSEXPSTACKCC, CHANNEL, CODEONE, GRIDMATRIX, EANXCHK, UPCACHK, UPCECHK, DOTCODE, HANXIN, VIN, MAILMARK, UPNQR and ULTRA..
Please use EANX for EAN-2, EAN-5, EAN-8 and EAN-13. You may need to leave away the check digit for some barcodes. EAN-13 can be created with 12 or 13 digits, but for EAN-8, only pas 7 digits.
This function returns an image reference for our GMImage functions. There you can either work on the image or simply store it in a container. On the end please free the image with GMImage.Release function.
For the size, be aware that some types like UPC codes have fixed size depending on content.
For MicroQR barcodes, you can use ECC Level 1 to 3, where 1 is default.
Length is limited to only 35 characters minus space for ECC.
Output options can be a combination of various flags:
Name | Value | Description |
None | 0 | No options set. |
Bind | 2 | Boundary bars above and below the symbol and between rows if stacking multiple symbols. |
Box | 4 | Add a box surrounding the symbol and whitespace. |
StdOut | 8 | Output to stdout. |
ReaderInit | 16 | Include reader initialize sequence in barcode. |
SmallText | 32 | Use small text. |
BoldText | 64 | Use bold text. |
CMYKColors | 128 | Use CMYK colors for Postscript output. |
DottyMode | 256 | Raster in dotty mode. |
GS1_GS_Separator | 512 | Use GS Separator for DataMatrix. |
CodeName | Numeric Value | Description |
CODE11 | 1 | Code 11 |
C25STANDARD | 2 | Standard Code 2 of 5 (Matrix) |
C25MATRIX | 2 | Legacy |
C25INTER | 3 | 2 of 5 Interleaved |
C25IATA | 4 | 2 of 5 IATA |
C25LOGIC | 6 | 2 of 5 Data Logic |
C25IND | 7 | 2 of 5 Industrial |
CODE39 | 8 | Code 3 of 9 (Code 39) |
EXCODE39 | 9 | Extended Code 3 of 9 (Code 39+) |
EANX | 13 | EAN (European Article Number) |
EANX_CHK | 14 | EAN + Check Digit |
GS1_128 | 16 | GS1-128 (UCC.EAN-128) |
EAN128 | 16 | Code 128 (automatic subset switching) |
CODABAR | 18 | Codabar |
CODE128 | 20 | Code 128 |
DPLEIT | 21 | Deutsche Post Leitcode |
DPIDENT | 22 | Deutsche Post Identcode |
CODE16K | 23 | Code 16k |
CODE49 | 24 | Code 49 |
CODE93 | 25 | Code 93 |
FLAT | 28 | Flattermarken |
DBAR_OMN | 29 | GS1 DataBar Omnidirectional |
RSS14 | 29 | GS1 DataBar-14 |
DBAR_LTD | 30 | GS1 DataBar Limited |
RSS_LTD | 30 | GS1 DataBar Limited |
DBAR_EXP | 31 | GS1 DataBar Expanded |
RSS_EXP | 31 | Legacy |
TELEPEN | 32 | Telepen Alpha |
UPCA | 34 | UPC-A |
UPCA_CHK | 35 | UPC-A + Check Digit |
UPCE | 37 | UPC-E |
UPCE_CHK | 38 | UPC-E + Check Digit |
POSTNET | 40 | USPS (U.S. Postal Service) POSTNET |
MSI_PLESSEY | 47 | MSI Plessey |
FIM | 49 | Facing Identification Mark |
LOGMARS | 50 | LOGMARS |
PHARMA | 51 | Pharmacode One-Track |
PZN | 52 | Pharmazentralnummer |
PHARMA_TWO | 53 | Pharmacode Two-Track |
CEPNET | 54 | Brazilian CEPNet Postal Code |
PDF417 | 55 | PDF417 |
PDF417COMP | 56 | Compact PDF417 (Truncated PDF417) |
PDF417TRUNC | 56 | PDF417 Truncated |
MAXICODE | 57 | MaxiCode |
QRCODE | 58 | QR Code |
CODE128B | 60 | Code 128 (Subset B) |
AUSPOST | 63 | Australia Post Standard Customer |
AUSREPLY | 66 | Australia Post Reply Paid |
AUSROUTE | 67 | Australia Post Routing |
AUSREDIRECT | 68 | Australia Post Redirection |
ISBNX | 69 | ISBN (EAN-13 with verification stage) |
RM4SCC | 70 | Royal Mail 4-State Customer Code (RM4SCC) |
DATAMATRIX | 71 | Data Matrix (ECC200) |
EAN14 | 72 | EAN-14 |
VIN | 73 | Vehicle Identification Number |
CODABLOCKF | 74 | Codablock-F |
NVE18 | 75 | NVE-18 (SSCC-18) |
JAPANPOST | 76 | Japanese Postal Code |
KOREAPOST | 77 | Korea Post |
DBAR_STK | 79 | GS1 DataBar Stacked |
RSS14STACK | 79 | GS1 DataBar-14 Stacked |
DBAR_OMNSTK | 80 | GS1 DataBar Stacked Omnidirectional |
RSS14STACK_OMNI | 80 | GS1 DataBar-14 Stacked Omnidirectional |
DBAR_EXPSTK | 81 | GS1 DataBar Expanded Stacked |
RSS_EXPSTACK | 81 | GS1 DataBar Expanded Stacked |
PLANET | 82 | USPS PLANET |
MICROPDF417 | 84 | MicroPDF417 |
USPS_IMAIL | 85 | USPS Intelligent Mail (OneCode) |
ONECODE | 85 | USPS OneCode |
PLESSEY | 86 | UK Plessey |
TELEPEN_NUM | 87 | Telepen Numeric |
ITF14 | 89 | ITF-14 |
KIX | 90 | Dutch Post KIX Code |
AZTEC | 92 | Aztec Code |
DAFT | 93 | DAFT Code |
DPD | 96 | DPD Code |
MICROQR | 97 | Micro QR Code |
HIBC_128 | 98 | HIBC (Health Industry Barcode) Code 128 |
HIBC_39 | 99 | HIBC Code 39 |
HIBC_DM | 102 | HIBC Data Matrix |
HIBC_QR | 104 | HIBC QR Code |
HIBC_PDF | 106 | HIBC PDF417 |
HIBC_MICPDF | 108 | HIBC MicroPDF417 |
HIBC_BLOCKF | 110 | HIBC Codablock-F |
HIBC_AZTEC | 112 | HIBC Aztec Code |
DOTCODE | 115 | DotCode |
HANXIN | 116 | Han Xin (Chinese Sensible) Code |
MAILMARK | 121 | Royal Mail 4-State Mailmark |
AZRUNE | 128 | Aztec Runes |
CODE32 | 129 | Code 32 |
EANX_CC | 130 | Composite Symbol with EAN linear component |
GS1_128_CC | 131 | GS1-128 Composite |
EAN128_CC | 131 | Composite Symbol with GS1-128 linear component |
DBAR_OMN_CC | 132 | GS1 DataBar Omnidirectional Composite |
RSS14_CC | 132 | Composite Symbol with GS1 DataBar-14 linear component |
DBAR_LTD_CC | 133 | GS1 DataBar Limited Composite |
RSS_LTD_CC | 133 | Composite Symbol with GS1 DataBar Limited component |
DBAR_EXP_CC | 134 | GS1 DataBar Expanded Composite |
RSS_EXP_CC | 134 | Composite Symbol with GS1 DataBar Extended component |
UPCA_CC | 135 | Composite Symbol with UPC A linear component |
UPCE_CC | 136 | Composite Symbol with UPC E linear component |
DBAR_STK_CC | 137 | GS1 DataBar Stacked Composite |
RSS14STACK_CC | 137 | Composite Symbol with GS1 DataBar-14 Stacked component |
DBAR_OMNSTK_CC | 138 | GS1 DataBar Stacked Omnidirectional Composite |
RSS14_OMNI_CC | 138 | Composite Symbol with GS1 DataBar-14 Stacked Omnidirectional component |
DBAR_EXPSTK_CC | 139 | GS1 DataBar Expanded Stacked Composite |
RSS_EXPSTACK_CC | 139 | Composite Symbol with GS1 DataBar Expanded Stacked component |
CHANNEL | 140 | Channel Code |
CODEONE | 141 | Code One |
GRIDMATRIX | 142 | Grid Matrix |
UPNQR | 143 | UPNQR (Univerzalnega Plačilnega Naloga QR) |
ULTRA | 144 | Ultracode |
RMQR | 145 | Rectangular Micro QR Code (rMQR) |
BC412 | 146 | IBM BC412 (SEMI T1-95) |
BackGroundColor can be 00000000 to turn background into a transparent black.
Examples
Create barcode based on JSON:
Set Field [ Barcode Generation JSON::Image ; "" ]
Set Variable [ $img ; Value: MBS("Barcode.GenerateJSON"; Barcode Generation JSON::JSON) ]
If [ MBS("IsError") = 0 ]
Set Field [ Barcode Generation JSON::Image ; MBS( "GMImage.WriteToPNGContainer"; $img; "barcode.png") ]
Set Variable [ $r ; Value: MBS( "GMImage.Release"; $img ) ]
Else
Show Custom Dialog [ "Failed to create barcode" ; $img ]
End If
Create barcode file:
Set Variable [ $path ; Value: "/Users/cs/test.png" ]
Set Variable [ $img ; Value: MBS( "Barcode.GenerateJSON"; "{\"Symbology\": \"QRCode\", \"Text\": \"Hello World\", \"Scale\": 4, \"BorderWidth\": 4}") ]
If [ MBS("IsError") = 0 ]
Set Variable [ $r ; Value: MBS( "GMImage.WriteToFile"; $img; $path ) ]
Set Variable [ $r ; Value: MBS( "GMImage.Release"; $img ) ]
End If
See also
- Barcode.Generate
- Barcode.SetOptions
- GMImage.Release
- GMImage.WriteToFile
- GMImage.WriteToPNGContainer
- IsError
Release notes
- Version 14.5
- Changed Barcode.Generate, Barcode.GenerateJSON and Barcode.WriteFile to use 4 as default scale.
- Version 13.1
- Fixed problem in Barcode.Generate and Barcode.GenerateJSON functions, where a warning from the zint library would be treated as an error.
- Version 13.0
- Added WhitespaceHeight, GuardDescent and WarnLevel options for Barcode.GenerateJSON functions.
- Version 12.5
- Fixed crash if text is missing in JSON for Barcode.GenerateJSON function.
- Version 9.4
- Added Barcode.GenerateJSON function.
Example Databases
Blog Entries
- MBS FileMaker Plugin, version 14.5pr3
- MBS Plugin Advent calendar: 1 - Barcodes
- MBS FileMaker Plugin, version 13.1pr4
- MBS FileMaker Plugin, version 12.6pr1
- MBS FileMaker Plugin, version 12.5pr2
- Create Barcodes on Server from FileMaker Go
- Neue Funktionen des MBS FileMaker Plugin 9.4
- Neues MBS FileMaker Plugin 9.4
- MBS FileMaker Plugin 9.4 - More than 5900 Functions In One Plugin
- MBS FileMaker Plugin, version 9.4pr6
This function checks for a license.
Created 5th September 2019, last changed 28th June 2023