Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 8.1   8.2   8.3   8.4   8.5   9.0   9.1   9.2   9.3   9.4    Statistic  

Barcode.GenerateJSON

Generates a barcode.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Barcode 9.4 Yes Yes Yes Yes Yes
MBS( "Barcode.GenerateJSON"; JSON )   More

Parameters

Parameter Description Example value
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.

KeyValueExample
SymbologySymbol to use. Can be number or text name.QRCode
TextHuman readable text, which usually consists of input data plus one more check digit."Hello World"
TransparentTransparency mode: 0: black on white, 1: black on transparent background, 2: white on black, 3: white on transparent background0
RotationRotation angle to use. Multiply of 90°.0
ShowTextWhether to show text. Pass 0 to hide text.1
WhitespaceWidthWhitespace width.5
BorderWidthBorder width.5
OutputOptionsSet various output file options as number.0
ScaleScale factor for adjusting size of image. Usually 4 or bigger for printing in high resolution.4
Option1Symbol specific options.0
Option2Symbol specific options.0
Option3Symbol specific options.0
InputModeSet encoding of input data. Pass 0 for data, 1 for unicode.1
ECIExtended Channel Interpretation mode.3
DotSizeSize of dots used in dotty mode.1.25
PrimaryPrimary message data for more complex symbols. ""
ForeGroundColorForeground (ink) colour as RGB hexadecimal string. Must be 6 characters."ff0000"
BackGroundColorBackground (paper) colour as RGB hexadecimal string. Must be 6 charaters."0000ff"
OutputFileContains the name of the file to output a resulting barcode symbol to. Must end in .png, .gif, .eps, .pcx, .svg or .txt."C:\test.png"

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.

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.Destroy"; $img ) ]
Else
    Show Custom Dialog [ "Failed to create barcode" ; $img ]
End If

See also

Example Databases

Blog Entries

Created 5th September 2019, last changed 5th September 2019


Barcode.Generate   -   Barcode.GetInputMode

Feedback: Report problem or ask question.




Links
MBS Xojo Plugins