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

Barcode.DrawBarcode

Draws a barcode into a PDF page.

Component Version macOS Windows Linux Server iOS SDK
Barcode 3.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Barcode.DrawBarcode"; PDF; symbology; Text; x; y { ; width; height; Encoding } )   More

Parameters

Parameter Description Example Flags
PDF The PDF reference returned from DynaPDF.New. $pdf
symbology The symbology to use. "EANX"
Text The text to encode in the barcode. "12345"
x The x coordinate. 100
y The y coordinate. 100
width The desired width of the barcode in points. Zero gives the auto size. 0 Optional
height The desired height of the barcode in points. Zero gives the auto size. 0 Optional
Encoding The text encoding for text parameter.
Default is UTF-8.
Possible encoding names: ANSI, ISO-8859-1, Latin1, Mac, Native, UTF-8, DOS, Hex, Base64 or Windows. More listed in the FAQ.
UTF8 Optional

Result

Returns OK or error.

Description

Draws a barcode into a PDF page.
The plugin uses zint library internally, so we include the zint manual in documentation.

Possible symbologies: CODE11, C25MATRIX, C25INTER, C25IATA, C25LOGIC, C25IND, CODE39, EXCODE39, 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..

For the size, be aware that some types like UPC codes have fixed size depending on content.
Please use DynaPDF.SetPageCoords to set the coordinate system to TopDown before drawing barcodes.

See also Barcode.SetOptions for further options.
Deprecated. For newer development, please switch to DynaPDF.InsertBarcode function.

Examples

Create PDF with a barcode on it:

If [ MBS("DynaPDF.IsInitialized") ≠ 1 ]
    Perform Script [ Specified: From list ; “<unknown>” ; Parameter: ]
End If
#
Set Variable [ $PDF ; Value: MBS("DynaPDF.New") ]
Set Variable [ $r ; Value: MBS( "DynaPDF.AppendPage"; $PDF ) ]
#
Set Variable [ $r ; Value: MBS( "Barcode.DrawBarcode"; $PDF; "QRCODE"; "Hello World"; 10; 20 ; 100; 100; "UTF8" ) ]
Set Field [ Examples::Barcode ; MBS( "DynaPDF.Save"; $PDF ) ]
Set Variable [ $r ; Value: MBS( "DynaPDF.Release"; $PDF ) ]

See also

Example Databases

Blog Entries

This function checks for a license.

Created 18th August 2014, last changed 13th January 2021


Barcode.Detect - Barcode.EANChecksum