Java Class «ImplPZN» – Barcode «PZN»
- All Implemented Interfaces:
Cloneable
newInstance static methods in the Barcode class.
The PZN (Pharmazentralnummer) is a German barcode standard used to identify pharmaceutical products. It consists of 6 digits for the product identifier plus a check digit.
In the barcode symbol, the hyphen (-) is included by placing it in front of the number.
The human readable text line for the PZN barcode consists of the prefix 'PZN', followed by a space, then a hyphen, and then the 6-digit product identifier, followed by the check digit at the end. For example:
PZN -1234562PZN is not a standalone barcode type but uses the
Code 39 format to encode its
data.-
Method Summary
Modifier and TypeMethodDescriptionvoidsetContent(String content, boolean autoComplete, boolean appendOptionalChecksum) Sets the content to be encoded in the barcode.Methods inherited from class de.vwsoft.barcodelib4j.oned.Barcode
clone, draw, draw, draw, getAddOn, getContent, getFont, getRatio, getText, getTextOffset, isFontSizeAdjusted, isTextOnTop, isTextVisible, newInstance, newInstance, setAddOn, setCustomText, setFont, setFontSizeAdjusted, setRatio, setTextOffset, setTextOnTop, setTextVisible, supportsAddOn, supportsAutoCompletion, supportsCustomText, supportsTextOnTop
-
Method Details
-
setContent
public void setContent(String content, boolean autoComplete, boolean appendOptionalChecksum) throws BarcodeException Sets the content to be encoded in the barcode.If the
autoCompleteparameter istrueand the length of the content is 6, the method calculates the checksum and appends it to the content, ensuring a total length of 7. If the calculated checksum is 10, aBarcodeExceptionis thrown because this value is invalid.If
autoCompleteis false, the method validates that the content length is 7 and checks if the last digit matches the calculated checksum. If not, aBarcodeExceptionis thrown.- Overrides:
setContentin classImplCode39- Parameters:
content- the PZN to be encoded in the barcodeautoComplete- whether to automatically calculate and append a check digit if it is missingappendOptionalChecksum- has no function, as PZN uses a fixed check digit which is not optional- Throws:
BarcodeException- if the content is empty, contains invalid characters, is of incorrect length, has an invalid check digit, or if the calculated checksum is 10
-