Code 39 Barcode - Automatically add required "*" digits

New Here ,
Jun 23, 2022 Jun 23, 2022

Copy link to clipboard

Copied

Hello, 

 

I need to create a code 39 barcode on a PDF document. It will be pulling data from a number field we manually enter data into. Let's call that field "ID".

 

I have the barcode font installed - however I can't figure out how to automatically append the data source number and wrape it with the * required in front and behind of the number in the barcode field "BARCODE". 

 

So, ultimately I wish to type 123 into ID field and have barcode field pull this and wrap it to read *123* so it will scan correctly. 

TOPICS
Create PDFs , JavaScript , PDF forms

Views

46

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 23, 2022 Jun 23, 2022

Copy link to clipboard

Copied

You can use this calculation script where "Barcode" is name of field

// Get the value of the field
var v = getField("Barcode").valueAsString;
// Add leading/trailing asterisks if not blank
event.value = v ? "*" + v + "*" : "";

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 23, 2022 Jun 23, 2022

Copy link to clipboard

Copied

My mistake, Code 39 is a 1d barcode. Not subject to the same rules as the 2d barcode field.  

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 23, 2022 Jun 23, 2022

Copy link to clipboard

Copied

LATEST

Code 39 barcode does not require a check sum or correction digit, but does require a start and end code, which is the asterik in most 39 barcode fonts.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines