Skip to main content
Inspiring
December 14, 2020
Question

How to generate barcode for 5 digits in Illustrator script?

  • December 14, 2020
  • 2 replies
  • 4718 views

Hi Everyone,

 

I have EAN-13 script to generate barcode for 13 digit numbers. But I don't know, how to generate barcode for 5 digits. I wanted to create barcode script for 5 digits.

 

Please post your ideas that would be very helpful to me.

Thanks,

- John

This topic has been closed for replies.

2 replies

ceyhun_akgun
Legend
December 14, 2020

It's a common feature but I have to repeat it.
You cannot use barcodes wherever you want, however you want. It should be clear why, why, which barcode to use.

There are barcodes used for many purposes. Barcode codes are an international feature standard. There are programs that generate barcodes according to ISO standards.

In which product, material, communication channel you want to produce this barcode.

One of the largest free codes is the QUAR CODE.

 

I suggest you research the UPC-E Barcode standard. wikipedia.org 

 

 
Graphic Designer Educator / PrePress Consultant
Inspiring
December 15, 2020

OP might be referring to the supplementary EAN-5 code that sometimes appears after an EAN-13 on books.

 

en.wikipedia.org/wiki/EAN-5

 

For barcode generation I have in the past used the free open-source BWIPP (github.com/bwipp/postscriptbarcode/wiki) which supports an impressively wide range of 1D and 2D barcode types. Catch: it’s a PostScript library, so you have to write a tiny bit of PS code in order to use it.

 

(I also don’t think its barcodes are as pretty as, say, Esko’s. (But hey, they’re barcodes. If they scan, they scan.)

 

The BWIPP wiki documentation lists the currently supported barcode types, the data they accept, and the standard- and barcode-specific options that can be used, along with plenty of examples of use.

 

FWIW I typically top and tail the original barcode.ps file with:

%!PS-Adobe-3.1 EPSF-3.0
%%BoundingBox: 0 0 1440 1440

and:

gsave
SCALE SCALE scale
72 72 moveto
BARCODEDATA OPTIONS /BARCODETYPE /uk.co.terryburton.bwipp findresource exec
grestore
showpage

 replacing the SCALE, BARCODEDATA, OPTIONS, and BARCODETYPE placeholders with actual values, then resave it as an .eps file which AI can import via File > Place†. (The BoundingBox line is only there to convert the PS file into a valid EPS; just make it sufficiently large that it won’t crop the barcode at normal scales.)

 

Plenty other free/paid options too (some of which might even use BWIPP under the hood), although I agree OP should do some background reading first, if only so he can better express his requirements here.

 

--

 

† Assuming the syntax and arguments are all valid. (If anything’s invalid you just get a big fat nothing; neither AI nor BWIPP provide helpful information when PS errors occur.)

AD4003Author
Inspiring
December 15, 2020

Thank you all for sharing this info.

I have visited the url: en.wikipedia.org/wiki/EAN-5

I found the checksum value and structure of EAN.

 

And I have no idea to encoding barcode in illustrator using the below details.

Kindly help me to proceed further to implement the logic.

 

Thanks,

-John

 

 

Silly-V
Legend
December 14, 2020

I know a little about barcodes, but not enough to tell an exact solution from memory for EAN-13. However, excellent open-source work was performed by Kaja Gordeeva just on this exact topic, her scripts are located here: https://productivista.com/products/
On that same page is a convenient video to describe the EAN-13 script, too.

AD4003Author
Inspiring
December 14, 2020

Thanks for replying for my question. But I wanted to convert barcode using 5 digits only.

Silly-V
Legend
December 14, 2020

Oh sorry I missed that part where you said you already have a script.

I'm not sure how EAN-13 works, but does it have to be that kind of barcode specifically? If it doesn't have to be EAN-13 strictly, you may be able to easily use a code39 or code128 font to write a custom amount of characters.