DynaPDF Manual - Page 532

Previous Page 531   Index   Next Page 533

Function Reference
Page 532 of 839
Vector vs. Image Barcodes
All barcode types, with exception of Ultracode, can be created as vector graphic (default) or as an
image. Vector based barcodes offer the highest output quality but it is not always recommended to
use this format. For example, image based barcodes can easily be extracted and analyzed with a
barcode reader. This is not possible with vector based barcodes.
An image based barcode will be created if the flag bcoImageOutput is set. If BgColor is set to white or
NO_COLOR (default) and if the barcode type is not Ultracode, a 1 bit image will be created and
compressed with flate if the resulting binary size is less than 500 bytes. If the image is larger, JBIG2
compression will be used. The resulting image is often smaller as the vector version of the same
barcode.
Output resolution
Image based barcodes are not necessarily resolution dependent. This is due to the fact that most
barcodes consist of rectangles only. This special kind of image data can be scaled with almost no loss
of quality.
However, the output resolution plays a rule if a barcode contains non-rectangular areas like dots,
circles, or text. DotCode and Maxicode are examples, as well as all barcodes with human readable
text.
The current implementation of the barcode library is not able to scale text with the surrounding
barcode. Therefore, it is recommended to draw the barcode as vector graphic if the text quality is not
high enough. At time of publication it is not possible to draw the text portions independent of an
image based barcode as it is the case in vector mode.
DotCode and Maxicode are the only barcodes which should be rendered in a higher resolution to
increase the image quality.
The resolution can be increased with the member Scale. As the name suggests, Scale is just a scaling
factor. Because a barcode has always a distinct size that is resolution independent, it is not possible
to render a barcode in an arbitrary resolution, the scaling capabilities are limited.
Scale must be between 0.1 though 30.0 although values greater than 10 make probably no sense.
Background and foreground colors
If BgColor is set to NO_COLOR (default) the barcode is drawn transparent. In image mode the
barcode is rendered as an image mask. In vector mode, no background rectangle is drawn in the size
of the barcode.
The foregound and background color must be specified in DeviceRGB. RGB values can be created
with the macro PDF_RGB() or with common functions like rgb() which are available in most
programming languages. Other color spaces are not yet supported for barcodes.
 

Previous topic: Output position and orientation

Next topic: Human readable text, Outer border, Scaling details