Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

DynaPDF.InsertBarcode

Inserts a barcode to the current open page.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 10.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.InsertBarcode"; PDF; JSON )   More

Parameters

Parameter Description Example
PDF The PDF reference returned from DynaPDF.New. $pdf
JSON The JSON describing the barcode.

Result

Returns OK or error.

Description

Inserts a barcode to the current open page.

JSON may include:
ParameterDescriptionDefault
BarcodeTypeThe type of barcode that should be created. Pass name or number.
BgColorBackground colorNO_COLOR (transparent)
BorderWidthBorder width0
DataRequired: Data string.
DataTypeData type and escape flag. Pass data type as text or number.
DotSizeDotty mode only4.0/5.0
EciExtended Channel Interpretation mode0
FgColorRGB Foreground color
FSizeFactorFont size correction factor0.7
Option1Various, depends on barcode type.-1
Option2Various, depends on barcode type.0
Option3Various, depends on barcode type.0
OptionsOutput options. Pass value as text list of flags or number.
OrientationSupported values: 0, 90, -90, 180, -180, 270, -270.
PrimaryComposite codes only. Primary data message (max 127 bytes). Image based barcodes only.
ScaleImage based barcodes only.1.0
ShowTextShow human readable text?true
SpaceWidthWhitespace width in pixels0 (auto).
SymbHeightSymbol height50
TextOffsetYOffset to correct the y-coordinate of text0
PosXX-Coordinate of destination rectangle
PosYY-Coordinate of destination rectangle
WidthWidth of destination rectangle
HeightHeight of destination rectangle
HAlignHorizontal alignment
VAlignVertical alignment

NameCodeDescription
AustraliaPost 0x003FAustralia Post Standard Customer
AustraliaRedir 0x0044Australia Post Redirection
AustraliaReply 0x0042Australia Post Reply Paid
AustraliaRout 0x0043Australia Post Routing
Aztec 0x005CAztec Code
AztecRunes 0x0080Aztec Runes
C2Of5IATA 0x0004Code 2 of 5 IATA
C2Of5Industrial 0x0006Code 2 of 5 Industrial
C2Of5Interleaved 0x0003Interleaved 2 of 5
C2Of5Logic 0x0005Code 2 of 5 Data Logic
C2Of5Matrix 0x0002Standard Code 2 of 5
ChannelCode 0x008CChannel Code
Codabar 0x0012Codabar
CodablockF 0x004ACodablock-F
Code11 0x0001Code 11
Code128 0x0014Code 128 (automatic subset switching)
Code128B 0x003CCode 128 (Subset B)
Code16K 0x0017Code 16K
Code32 0x0081Code 32
Code39 0x0007Code 3 of 9 (Code 39)
Code49 0x0018Code 49
Code93 0x0019Code 93
CodeOne 0x008DCode One
DAFT 0x005DDAFT Code
DataBarOmniTrunc 0x001DGS1 DataBar-14 Omnidirectional and truncated / RSS14
DataBarExpStacked0x0051GS1 DataBar Expanded Stacked
DataBarExpanded 0x001FGS1 DataBar Expanded / RSS_EXP
DataBarLimited 0x001EGS1 DataBar Limited / RSS_LTD
DataBarStacked 0x004FGS1 DataBar-14 Stacked
DataBarStackedO 0x0050GS1 DataBar-14 Stacked Omnidirectional
DataMatrix 0x0047Data Matrix ECC200
DotCode 0x0073DotCode
DPD 0x0060DPD code
DPIdentCode 0x0016Deutsche Post Identcode
DPLeitcode 0x0015Deutsche Post Leitcode
EAN128 0x0010GS1-128 (UCC.EAN-128)
EAN128_CC 0x0083Composite Symbol with GS1-128 linear component
EAN14 0x0048EAN-14
EANX 0x000DEAN
EANX_CC 0x0082Composite Symbol with EAN linear component
EANXCheck 0x000EEAN + Check Digit
ExtCode39 0x0008Extended Code 3 of 9 (Code 39+)
FIM 0x0031FIM
Flattermarken 0x001CFlattermarken
HIBC_Aztec 0x0070HIBC Aztec Code
HIBC_CodablockF 0x006EHIBC Codablock-F
HIBC_Code128 0x0062HIBC Code 128
HIBC_Code39 0x0063HIBC Code 39
HIBC_DataMatrix 0x0066HIBC Data Matrix ECC200
HIBC_MicroPDF417 0x006CHIBC MicroPDF417
HIBC_PDF417 0x006AHIBC PDF417
HIBC_QR 0x0068HIBC QR Code
ISBNX 0x0045ISBN (EAN-13 with verification stage)
ITF14 0x0059ITF-14
JapanPost 0x004CJapanese Postal Code
KIX 0x005ADutch Post KIX Code
KoreaPost 0x004DKorea Post
LOGMARS 0x0032LOGMARS
Mailmark 0x0079Royal Mail 4-State Mailmark
Maxicode 0x0039Maxicode
MicroPDF417 0x0054Micro PDF417
MicroQR 0x0061Micro QR Code
MSIPlessey 0x0047MSI Plessey
NVE18 0x004BNVE-18
PDF417 0x0037PDF417
PDF417Truncated 0x0038PDF417 Truncated
PharmaOneTrack 0x0033Pharmacode One-Track
PharmaTwoTrack 0x0035Pharmacode Two-Track
PLANET 0x0052PLANET
Plessey 0x0056Plessey
PostNet 0x0028PostNet
PZN 0x0034PZN
QRCode 0x003AQR Code
RMQR 0x0091Rectangular Micro QR Code (rMQR)
RoyalMail4State 0x0046Royal Mail 4 State (RM4SCC)
RSS_EXP_CC 0x0086Composite Symbol with GS1 DataBar Extended component
RSS_EXPSTACK_CC 0x008BComposite Symbol with GS1 DataBar Expanded Stacked component
RSS_LTD_CC 0x0085Composite Symbol with GS1 DataBar Limited component
RSS14_CC 0x0084Composite Symbol with GS1 DataBar-14 linear component
RSS14Stacked_CC 0x0089Composite Symbol with GS1 DataBar-14 Stacked component
RSS14StackOMNI_CC0x008AComposite Symbol with GS1 DataBar-14 Stacked Omnidirectional component
Telepen 0x0020Telepen Alpha
TelepenNumeric 0x0057Telepen Numeric
Ultracode 0x0090Ultracode
UPCA 0x0022UPC A
UPCA_CC 0x0087Composite Symbol with UPC A linear component
UPCACheckDigit 0x0023UPC A + Check Digit
UPCE 0x0025UCP E
UPCE_CC 0x0088Composite Symbol with UPC E linear component
UPCECheckDigit 0x0026UPC E + Check Digit
UPNQR 0x008FUPNQR (Univerzalni Placilni Nalog QR)
USPSOneCode 0x0055USPS OneCode
VIN 0x0049Vehicle Identification Number (America)

NameValueDescription
Binary 0Binary data.
Unicode 1UTF-8.
GS1Mode 2Encodes GS1 data using FNC1 characters.
EscapeMode8Scan input data for escape sequences. This is a flag that can be combined with the other constants, e.g. pass EscapeMode and Unicode.

NameValueDescription
Default 0x00000000Use default settings.
NoASCII 0x00000001Consider non-ASCII characters when creating the barcode.
Bind 0x00000002Boundary bars above and below the symbol and between rows if stacking multiple symbols.
Box 0x00000004Add a box surrounding the symbol and whitespace.
ReaderInit 0x00000010Add a reader initialisation symbol to the data before encoding.
SmallText 0x00000020Use a smaller font for human readable text.
BoldText 0x00000040Embolden human readable text.
DottyMode 0x00000100Plot a matrix symbol using dots rather than squares.
GS1_GS_Separator0x00000200Use GS instead FNC1 as GS1 separator.
ImageOutput 0x01000000Draw the barcode as an image. Images are usually larger than vectors and require more processing time.
UseActiveFont 0x02000000Vector output only. If set, text is output with the active font. Helvetica is used otherwise.

See also InsertBarcode function in DynaPDF manual.

Examples

Insert QR-Code:

Set Variable [ $json; Value: MBS( "DynaPDF.GetDefaultBarcodeParameters" ) ]
Set Variable [ $json; Value: JSONSetElement ( $json ; "BarcodeType" ; "QRCode"; JSONString ) ]
Set Variable [ $json; Value: JSONSetElement ( $json ; "Data" ; "Hello World"; JSONString ) ]
Set Variable [ $json; Value: JSONSetElement ( $json ; "PosX" ; 300; JSONNumber ) ]
Set Variable [ $json; Value: JSONSetElement ( $json ; "PosY" ; 300; JSONNumber ) ]
Set Variable [ $json; Value: JSONSetElement ( $json ; "Width" ; 200; JSONNumber ) ]
Set Variable [ $json; Value: JSONSetElement ( $json ; "Height" ; 50; JSONNumber ) ]
Set Variable [ $r; Value: MBS( "DynaPDF.InsertBarcode"; $pdf; $json ) ]

Add QR Code to a page on bottom right:

# draw barcode
Set Variable [ $r ; Value: MBS("DynaPDF.EditPage"; $pdf; 1) ]
Set Variable [ $json ; Value: MBS( "DynaPDF.GetDefaultBarcodeParameters" ) ]
Set Variable [ $json ; Value: JSONSetElement ( $json ; "BarcodeType" ; "QRCode"; JSONString ) ]
Set Variable [ $json ; Value: JSONSetElement ( $json ; "Data" ; "Hello World"; JSONString ) ]
Set Variable [ $json ; Value: JSONSetElement ( $json ; "PosX" ; MBS("DynaPDF.GetPageWidth"; $pdf) - 80; JSONNumber ) ]
Set Variable [ $json ; Value: JSONSetElement ( $json ; "PosY" ; 20; JSONNumber ) ]
Set Variable [ $r ; Value: MBS( "DynaPDF.InsertBarcode"; $pdf; $json ) ]
Set Variable [ $r ; Value: MBS("DynaPDF.EndPage"; $pdf) ]

See also

Release notes

Example Databases

Blog Entries

This function checks for a license.

Created 18th September 2020, last changed 25th August 2022


DynaPDF.Initialize - DynaPDF.InsertBookmark