We have a PDF form where you fill out product options then it converts those options into a single text field "Lot Number" then finally a field, "Lot Number Barcode", takes the lot number and converts it to a barcode. For some reason this is not working. I know almost nothing about barcode integration but I am a programmer and just looking for some guidance on this topic.
The "Lot Number Barcode" field uses under properties Calculate->Custom Calculation Script this code. So like I said above it's taking the "Lot Number" field and converting to a string which I believe then the font uses to generate the correct barcode or that is the idea.
event.value = this.getField("Lot No").valueAsString;
Here is a link to the actual PDF I was given from the client:
https://ufile.io/ihh87
This is what I have found out on this topic but obviously still missing pieces to the puzzle and hope someone can give me the exact steps needed to get this working in Acrobat Pro.
- I need an embeddable CODE 128 font? I found this font set but costs $159 is there a free version that I could use and have it still work? https://www.idautomation.com/barcode-fonts/code-128/
- Javascript - I need to add custom Javascript code to the Actions properties of the "Lot Number Barcode" text field but I don't know which code needs to be implemented and looking for a resource on this to better explain the process.
- Font height and font size - If I get the previous 2 steps working I still need to be concerned with setting the PDF text field to an exact font size and height otherwise the barcode scanner could error out. Is this true? Currently the PDF text field font size is set to "Auto"
Code 128 is a relatively complex barcode, and can not be represented by replacing the string to be displaced with a font. Therefore, you will need some logic to assemble the correct string to display. I am not aware of anything available publicly which would do that calculation; you'd be on your own or have to find someone helping.
In order to create that logic, you'd have to understand how Code 128 works; this information should be freely available.
Concerning the font licence, you might compare its cost with the other solutions: try to work with the free font floating around, or create your own font, or use graphics (for example in an annotation, which can be calculated using Acrobat JavaScript). At the end of the day, even that rather expensive font may be the most economic solution.
As you already have studied the specification for Code 128, you will also have seen the requirements to print it. You will have to make your adjustments with the field, and most likely have to set a fixed font size. This will, however, depend on the scaling happening when printing the page.