Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Code 39 Barcode - Automatically add required "*" digits

New Here ,
Jun 23, 2022 Jun 23, 2022

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
1.3K
Translate
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
Community Expert ,
Jun 23, 2022 Jun 23, 2022

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 + "*" : "";

Translate
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
Community Expert ,
Jun 23, 2022 Jun 23, 2022

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

Translate
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
Community Expert ,
Jun 23, 2022 Jun 23, 2022
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.

Translate
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