0

Background: I'm trying to generate barcode sticker on Code128 with the help of this implementation. My generated sticker looks like below:

enter image description here

Then I need to attach that sticker on a fabric body by heat pressing. So my finished product will be like below:

enter image description here

Now the problem is, barcode bars get very congested while attaching to fabric body. I have red circled the problematic area.

Question: Is it possible to make the black barcode bars thinner? so that black bars can have more space in between them and do not get overlapped. Or any other suggestion for better readability of the barcode sticker.

autopilot
  • 352
  • 2
  • 4
  • 18
  • Where is your code – TheGeneral Feb 08 '18 at 06:24
  • Anyway, A) code project scares me, B) there is nugets that generate bar-codes and are better maintained C) `MakeBarcodeImage` takes a `barcodewith` The baseline width of the bars in the output. Usually, 1 or 2 is good. D) if this doesn't do what you want you are out of luck, E) you haven't shown a scrap of code and just expect us to read your mind – TheGeneral Feb 08 '18 at 06:31
  • **E) you haven't shown a scrap of code and just expect us to read your mind** this comment makes me laugh again and again. anyway, I don't expect that. and I'm generating barcode image using that codeproject implementation, so sharing same code again will make the question unnecessary large to read through. but if you want I can paste my code here. All I want is to know is it possible to make black barcode bars thinner using that implementation. – autopilot Feb 08 '18 at 07:04
  • Focus on the text, it is too fat as well. Standard cause is printing the content at monitor resolution and forcing the printer to scale up, turning each pixel into a big blob of ink. And inappropriate anti-aliasing, forcing the text renderer to interpolate from a black foreground to a black (or transparent) background. – Hans Passant Feb 08 '18 at 09:37
  • It is a major requirement to make the texts bolder, can't do anything in this regard. – autopilot Feb 08 '18 at 09:48

1 Answers1

-1

Your substrate is too plyable for your printer, so you are going to have problems, no matter what you do. But I recommend switching to Code 128C, since your barcodes are numeric and an even number of digits. I also recommend using software that lets you customize the width of the barcode without affecting the height.

<html>
<head>
<title>Vanilla JS Code 128C Barcodes</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
</head>
<body>
<p>MIL (Knitting) 174067</p>
<div id="result1"></div><br>
<p>MIL (Knitting) 143145</p>
<div id="result2"></div>
<script type="text/javascript">
// The MIT License (MIT)
// Copyright (c) 2017, Notionovus, LLC.

var arrayCode128Bin = [ '11011001100', '11001101100', '11001100110', '10010011000', '10010001100', '10001001100', '10011001000', '10011000100', '10001100100', '11001001000', '11001000100', '11000100100', '10110011100', '10011011100', '10011001110', '10111001100', '10011101100', '10011100110', '11001110010', '11001011100', '11001001110', '11011100100', '11001110100', '11101101110', '11101001100', '11100101100', '11100100110', '11101100100', '11100110100', '11100110010', '11011011000', '11011000110', '11000110110', '10100011000', '10001011000', '10001000110', '10110001000', '10001101000', '10001100010', '11010001000', '11000101000', '11000100010', '10110111000', '10110001110', '10001101110', '10111011000', '10111000110', '10001110110', '11101110110', '11010001110', '11000101110', '11011101000', '11011100010', '11011101110', '11101011000', '11101000110', '11100010110', '11101101000', '11101100010', '11100011010', '11101111010', '11001000010', '11110001010', '10100110000', '10100001100', '10010110000', '10010000110', '10000101100', '10000100110', '10110010000', '10110000100', '10011010000', '10011000010', '10000110100', '10000110010', '11000010010', '11001010000', '11110111010', '11000010100', '10001111010', '10100111100', '10010111100', '10010011110', '10111100100', '10011110100', '10011110010', '11110100100', '11110010100', '11110010010', '11011011110', '11011110110', '11110110110', '10101111000', '10100011110', '10001011110', '10111101000', '10111100010', '11110101000', '11110100010', '10111011110', '10111101110', '11101011110', '11110101110', '11010000100', '11010010000', '11010011100', '1100011101011', '11010111000'];
var array5bit_A = [ 'f//AAAAAAAAAAAAAAAAAAAA', 'f//AAAAAAAAAAAAAAAAAAAB', 'f//AAAAAAAAAAAAAAEAAAD/', 'f//AAAAAAAAAAAAAAEAAAAA', 'f//AAAAAAAAAQAAAP8AAAAA', 'f//AAAAAAAAAQAAAP8AAAAB', 'f//AAAAAAAAAQAAAAAAAAD/', 'f//AAAAAAAAAQAAAAAAAAAA', 'f//AAABAAAA/wAAAAAAAAAA', 'f//AAABAAAA/wAAAAAAAAAB', 'f//AAABAAAA/wAAAAEAAAD/', 'f//AAABAAAA/wAAAAEAAAAA', 'f//AAABAAAAAAAAAP8AAAAA', 'f//AAABAAAAAAAAAP8AAAAB', 'f//AAABAAAAAAAAAAAAAAD/', 'f//AAABAAAAAAAAAAAAAAAA', 'QD/AAD/AAAAAAAAAAAAAAAA', 'QD/AAD/AAAAAAAAAAAAAAAB', 'QD/AAD/AAAAAAAAAAEAAAD/', 'QD/AAD/AAAAAAAAAAEAAAAA', 'QD/AAD/AAAAAQAAAP8AAAAA', 'QD/AAD/AAAAAQAAAP8AAAAB', 'QD/AAD/AAAAAQAAAAAAAAD/', 'QD/AAD/AAAAAQAAAAAAAAAA', 'QD/AAAAAAAA/wAAAAAAAAAA', 'QD/AAAAAAAA/wAAAAAAAAAB', 'SL/AADeAAAA/gAAAAIAAAD+', 'QD/AAAAAAAA/wAAAAEAAAAA', 'QD/AAAAAAAAAAAAAP8AAAAA', 'QD/AAAAAAAAAAAAAP8AAAAB', 'QD/AAAAAAAAAAAAAAAAAAD/', 'QD/AAAAAAAAAAAAAAAAAAAA'];
var array5bit_B = [ 'US0CAuSD38g', 'UUYCA7QBErs', 'ajEDAm49ReY', 'UUoCA+juogg', 'bjEDAjQrOn0', 'bkoDA3iPVH4', 'ajUDAt82atY', 'UU4CA1nljTg', 'cjEDAghkmFU', 'ckoDA0TA9lY', 'izUEAhrxcbg', 'ck4DAxY8F10', 'bjUDAlvFFR8', 'bk4DAxdhexw', 'ajkDAr7LFAw', 'UVICAyQ+UJI', 'TTECAq7UnEM', 'TUoCA+Jw8kA', 'ZjUDAmZGozo', 'TU4CA7CME0s', 'ajUDAvnk9E4', 'ak4DA7VAmk0', 'ZjkDAtle3bI', 'TVICAxOyzrM', 'STUCAqHeHtM', 'SU4CA+16cNA', 'h6QEAZKdo54', 'SVICA62zYxM', 'RTkCAqx1lb4', 'RVICA/z3WM0', 'QT0CAkdoxRU', 'KFYBA46vJCA'];
var stringStart = '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAACCAQAAADLaIVbAAAANUlEQVQIHQEqANX/A';
var stringMid = 'AAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAA';
var stringEnd = 'AAAAASUVORK5CYII=" style="width:';

function genBarcode(inputString, intWidth, intHeight) {
var arraySeq = [], i, intChunks, resultString;
var intRawmod = inputString.length % 5;
  for (i = 0; i < 5 - intRawmod; i += 1) {
    inputString += "0";
  }
  intChunks = inputString.length / 5;
  for (i = 0; i < intChunks; i += 1) {
    arraySeq[i] = parseInt(inputString.substr(i * 5, 5), 2);
  }
  resultString = "";
  for (i = 0; i < arraySeq.length; i += 1) {
    resultString += stringStart + array5bit_A[arraySeq[i]] + stringMid + array5bit_B[arraySeq[i]] + stringEnd + intWidth + 'px;height:' + intHeight + 'px;">';
  }
  return resultString;
}

function funcCode128C(strText) {
var j, intWeight, intWtProd = 0;
var strRaw = "";
var arrayData = [];
  arrayData[0] = 105;
  intWtProd = 105;
  for (j = 0; j < strText.length / 2; j += 1) {
    arrayData[j + 1] = strText[(j*2)] + strText[(j*2) + 1];
    intWeight = j + 1;
    intWtProd += intWeight * arrayData[j + 1];
  }
  arrayData[j + 1] = intWtProd % 103;
  arrayData[j + 2] = 106;
  for (j = 0; j < arrayData.length; j += 1) {
    strRaw += arrayCode128Bin[arrayData[j]];
  }
  return(strRaw);
}
// Change the text (no ctrl chars), width ( > 3.8), and height ( < page height) to experiment
document.getElementById("result1").innerHTML = genBarcode(funcCode128C("174067"), 18, 70);
document.getElementById("result2").innerHTML = genBarcode(funcCode128C("143145"), 18, 70);
</script>
</body>
</html>

This is an example using Code 128C for the two numbers you use. Because you can fit all 6 numbers into three Code 128C characters, the barcode is more dense and can be expanded horizontally without consuming more real estate on your label.

Brian Anderson
  • 1,661
  • 1
  • 17
  • 27