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

How to generate barcode for 5 digits in Illustrator script?

Participant ,
Dec 14, 2020 Dec 14, 2020

Copy link to clipboard

Copied

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

TOPICS
Scripting

Views

2.4K

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
Valorous Hero ,
Dec 14, 2020 Dec 14, 2020

Copy link to clipboard

Copied

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.

Votes

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
Participant ,
Dec 14, 2020 Dec 14, 2020

Copy link to clipboard

Copied

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

Votes

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
Valorous Hero ,
Dec 14, 2020 Dec 14, 2020

Copy link to clipboard

Copied

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.

Votes

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
Enthusiast ,
Dec 14, 2020 Dec 14, 2020

Copy link to clipboard

Copied

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 

 

Ekran Resmi 2020-12-14 22.22.17.png

 
Graphic Designer Educator / PrePress Consultant

Votes

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
Engaged ,
Dec 14, 2020 Dec 14, 2020

Copy link to clipboard

Copied

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.)

Votes

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
Participant ,
Dec 15, 2020 Dec 15, 2020

Copy link to clipboard

Copied

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.

Screenshot 2020-12-15 at 6.44.01 PM.png

Kindly help me to proceed further to implement the logic.

 

Thanks,

-John

 

 

Votes

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
Engaged ,
Dec 15, 2020 Dec 15, 2020

Copy link to clipboard

Copied

Rather than asking how to generate a “5-digit barcode”, it would be better to explain what you’re creating it for and show some sample artwork

 

For instance, if you’re making book covers then I’m guessing you want an EAN-13 with supplementary EAN-5 code. (The BWIPP library has an option for producing those, as will more advanced barcode generation apps.)

 

Or, if you want to encode arbitrary numbers for some other purpose, there’s a variety of barcode types to choose from depending on what they’re being used for (e.g. shipping/equipment labels) and how they’ll be read (point of sale, warehouse scanner, smartphone camera, etc).

Votes

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
Participant ,
Dec 16, 2020 Dec 16, 2020

Copy link to clipboard

Copied

I don't want EAN-13 with supplementary EAN-5 code. If I given 5 digits (45454) in the input dialog box, the barcode will generate like below in illustrator document.

Screenshot 2020-12-16 at 1.35.53 PM.png

This one I need to implement in the .jsx script. I am trying to implement the logic from https://en.wikipedia.org/wiki/EAN-5 this URL. But I don't know how to encoding the number thru script.

Screenshot 2020-12-15 at 6.44.01 PM.png

I am appreciating your efforts on this.

 

Thanks,

-John.

Votes

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
Engaged ,
Dec 16, 2020 Dec 16, 2020

Copy link to clipboard

Copied

That is not an EAN-5. This is an EAN-5, generated with BWIPP:

Screenshot 2020-12-16 at 09.18.56.png

(45454) (includetext) /ean5 /uk.co.terryburton.bwipp findresource exec

 

And, as I say, EAN-5 is only used as an adjunct to EAN-13; it’s not found on its own.

 

Yours might be a Code 39 or some other variable-length type, but I am not going to guess. If you can’t tell us what barcode type it is or what you’re using it for, we cannot advise you. The last thing you ever want to do is to produce an incorrect barcode. That could get you in a lot of trouble. Global product recalls happen for less.

 

I strongly recommend 1. you read up on common barcode standards and symbologies so you understand what you’re dealing with, and 2. you ask whoever you’re producing these barcodes for to tell you what type of barcode they require, and then ask them for whatever additional information (scale, guards, BWR, font, etc) you need to produce the barcode artwork. Then you can go find the appropriate tool to generate it.

Votes

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
Participant ,
Dec 16, 2020 Dec 16, 2020

Copy link to clipboard

Copied

I am honestly new to barcode generate. I am unaware of this one. I need to convert from 5 digit color bar (CMYKR) to barcode generate for the product.

The end user run the script and type the 5 digit number and then automatically place the barcode for that number in Illustrator Artboard.

 

Votes

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
Engaged ,
Dec 16, 2020 Dec 16, 2020

Copy link to clipboard

Copied

LATEST

So go ask your customer which barcode format they need. It’s ridiculous for them to ask you to produce “5-digit barcodes” but not tell you “EAN-13” or “UPC-12” or “Code-39” or “Code-128” or “Pharmacode” or whatever. Because all those different barcode formats will encode those 5 digits in very different ways. There’s a huge range of barcode formats, all used for different jobs, countries, and markets, and if you don’t know precisely which type of barcode to produce then you’ll most likely produce the wrong sort. Which, if you’re lucky, their barcode readers will reject as “unreadable”; but at worst might read as a completely different number—and then you’re really in trouble.

 

Honestly, generating barcodes is one of those jobs that if you don’t get nightmares about What Might Go Wrong, you really shouldn’t be doing it. Because you don’t understand it well enough to know if you’re doing it right.

 

Here’s a link to the BWIPP site that lists all the different barcode formats that the BWIPP library supports:

 

github.com/bwipp/postscriptbarcode/wiki/Symbologies-Reference

 

BWIPP supports a wide range of barcode formats, both common and rare, so it’s very likely the format your customer needs is somewhere on that list, but they need to tell you which one it is, not leave you to guess.

 

Votes

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