ImageTools
GenerateBarcode
generate barcode image encoding string or ByteArray
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
GenerateBarcode( data, opts )
data
-
string or ByteArray; the data to be encoded
opts
(optional) one or more options as specified below
errorcorrection : posint or one of low, medium, quartile, or high
Specifies the error correction level in the generated barcode. The default is high.
preferredheight : posint or auto
If a preferred height is specified, an integer scaling factor is applied to the generated image such that its height is as close to preferredheight as possible. By default, no scaling factor is applied.
version : posint or posint..posint
Specifies a version number between 1 and 40 supported in the QR Code Model 2 standard to use in the generated barcode.
If a range is specified, a version within this range is automatically selected.
The default behavior is to automatically select a version between 1 and 40.
The GenerateBarcode(data,opts) command generates a barcode image of the string or ByteArray data as an Image.
Generate a simple barcode encoding text. The resulting image is scaled up for easier viewing.
with⁡ImageTools:
img≔GenerateBarcode⁡Hello, world!
Embed⁡Scale⁡img,4,method=nearest
Generate a URL-encoded barcode.
urlimg≔GenerateBarcode⁡http://www.maplesoft.com
Embed⁡Scale⁡urlimg,4,method=nearest
Embed mathematical data in a ByteArray and generate a barcode from it.
expr≔3⁢sin⁡2⁢x+π2+4⁢cos⁡3⁢x+π4+2
expr≔3⁢cos⁡2⁢x+4⁢cos⁡3⁢x+π4+2
encoded_expr≔convert⁡expr,ByteArray,format=dotm
encoded_expr≔
exprimg≔GenerateBarcode⁡encoded_expr
Embed⁡GenerateBarcode⁡encoded_expr,preferredheight=100
The ImageTools[GenerateBarcode] command was introduced in Maple 2022.
For more information on Maple 2022 changes, see Updates in Maple 2022.
See Also
StringTools[ToByteArray]
Download Help Document