Expand my Community achievements bar.

SOLVED

Dynamic PDF417 code for xfa form with binary encoding

Avatar

Level 1

Hi to all,

 

I purchased the sample fragment from here https://thelivecycle.blogspot.com/2016/03/dynamic-pdf417-code.html

The fragment is based on http://bkuzmic.github.io/pdf417-js/

 

I am using specific payment form to enter data. That data should be encoded into PDF417 barcode with following specification:
  1. The silence zone around the barcode must be at least two widths of the basic element.
  2. the width of the basic element is 0.254 mm
  3. the ratio of height and width of the basic element is 3:1
  4. error correction level is 4
  5. the barcode has 9 data columns
  6. the width of the barcode is 58 mm
  7. The height of the barcode depends on amount and type of data, but must not exceed 26 mm (with areas of silence).
  8. data encoding must be binary (Compact or Macro PDF417 are not used)

After the form is populated, form will be verified and if the form is valid, barcode will be generated.

The barcode is used by the payer to just scan it and the payment data are decoded and placed inside mobile bank app without typing in all data.

The form looks following:

Ivicaevis_0-1676299858275.png

Beside the fragment there is an additional renderBarcodeFunction which converts string into barcode and places it on the form.

I need help with adjusting that function, to get the output which can be decoded by mobile bank application.

 

In addition, when I use demo site http://bkuzmic.github.io/pdf417-js/ for generating barcode from same data and scanning it - mobile app recognizes it successfully.

I think, that custom renderBarcodeFunction must be adjusted in some way.

 

Is there anybody who can help me with that?

 

Kind regards,

Ivica

1 Accepted Solution

Avatar

Correct answer by
Level 10

The bacode hasn't been designed to be editable in all that way. You can controll it's width, silence zone, aspect ratio of the moduls, the error correction level and color. Everything else is dynamically generated depending on the input data, which hast to be a string. Binary data isn't supported. 

 

Try the following settings when calling the renderPDF417 function. 

/** Begin to rendern PDF417 code
*	@param sInput 		String:	String to encode
*	@param iECC			Integer: Error correctio level -1 (default automatic), 0 (low) bis 8 (high)
* 	@param fRatio		Float: Aspect ratio of the modules (pixel) (default 2.0)
*	@param oPDF417		Objekt:	XFA-Object, that represents the code
*	@param fReserve		Float:	Whitespace around the code
*	@param fSize		Float:	Width of the code
*	@param sUnit		String:	Measurement for whitespace and width (mm, cm, in or pt)
*	@param sColorDark	String:	RGB color of the dark pixels (default "0,0,0" = black)
**/
if (!this.isNull) {
	XFAUtils.renderPDF417 (this.rawValue, 4, 3, this.resolveNode("Barcode"), .254, 58, "mm", "0,0,0");
}

 

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

The bacode hasn't been designed to be editable in all that way. You can controll it's width, silence zone, aspect ratio of the moduls, the error correction level and color. Everything else is dynamically generated depending on the input data, which hast to be a string. Binary data isn't supported. 

 

Try the following settings when calling the renderPDF417 function. 

/** Begin to rendern PDF417 code
*	@param sInput 		String:	String to encode
*	@param iECC			Integer: Error correctio level -1 (default automatic), 0 (low) bis 8 (high)
* 	@param fRatio		Float: Aspect ratio of the modules (pixel) (default 2.0)
*	@param oPDF417		Objekt:	XFA-Object, that represents the code
*	@param fReserve		Float:	Whitespace around the code
*	@param fSize		Float:	Width of the code
*	@param sUnit		String:	Measurement for whitespace and width (mm, cm, in or pt)
*	@param sColorDark	String:	RGB color of the dark pixels (default "0,0,0" = black)
**/
if (!this.isNull) {
	XFAUtils.renderPDF417 (this.rawValue, 4, 3, this.resolveNode("Barcode"), .254, 58, "mm", "0,0,0");
}