Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Barcode Generator

  1. #1
    Junior Member
    Join Date
    Aug 2012
    Posts
    8
    My Mood
    Cheeky
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Red face Barcode Generator

    Dear Forums,


    Hi guys im very new to this forum.......h r u guys....Hey Guys i want some information related to Barcode Generator do anyone know how to create a barcode using Java .....Any solution would be appreciable......Thanks in Advance.


    Regards......

    Venu


  2. #2
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,676
    Thanks
    25
    Thanked 329 Times in 305 Posts

    Default Re: Barcode Generator

    I don't personally know how to create Barcodes, but this website should give you all the libraries and documentation that you would ever want: TWiki . Javapedia . Barcode
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  3. #3
    Junior Member
    Join Date
    Aug 2012
    Posts
    8
    My Mood
    Cheeky
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Barcode Generator

    Dear aussiemcgr,

    Thanks for the reply...I have done the coding in .Net when it comes to Java i have issues like code not getting executed correctly i have given part of the code here coz i cant produce the entire code right.....please have a look at the below code...



     
     
    public class BarCodeVerifier {
    	int nAPMCCode = 0; 
    	int nDate = 0; 
    	int nMonth = 0; 
    	int nTime = 0; 
    	int nTrader = 0; 
    	int nLorry = 0; 
    	int nCommodity = 0; 
    	int nQuantity = 0; 
    	int nMinute = 0;
    	//String dt = DateFormat.getDateInstance().format(new Date()); // DateTime.Now.ToLongDateString();
     
     
     
    	public BarCodeVerifier() {
    	}
     
    	public int[] GetDecodedData(String strCoded) {
     
    		int[] nArr = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
    		// strip the last char...
    		char c = strCoded.toCharArray()[strCoded.length() - 1];
    		if (strCoded.length() > 17) {
    			String strMinuteCode = strCoded.substring(15, 17);
    			int nMunite = (int) (Base36Decode(strMinuteCode));
    			strCoded = new String(strCoded.substring(0, strCoded.length() - 3));
    			nArr[8] = nMunite;
    		} else {
    			strCoded = strCoded.substring(0, strCoded.length() - 1);
    			nArr[8] = 0;
    		}
    		// char c = strCoded.ToCharArray()[strCoded.Length-1];
    		// strCoded = strCoded.substring(0,strCoded.length()-1);
     
    		int nTime = (int) Base36Decode(String.valueOf(c));
    		int nTemp = (nTime < 15) ? (15 - nTime) : (15 - (nTime - 15));
    		strCoded = RotateString(strCoded, nTemp);
    		nArr[0] = (int) (Base36Decode(strCoded.substring(0, 2))); 
    		nArr[1] = (int) (Base36Decode(strCoded.substring(2, 3))); 
    		nArr[2] = (int) (Base36Decode(strCoded.substring(3, 4))); 
    		nArr[3] = nTime; // Time
    		nArr[4] = (int) (Base36Decode(strCoded.substring(4, 7))); 
    		nArr[5] = (int) (Base36Decode(strCoded.substring(7, 10))); 
    		nArr[6] = (int) (Base36Decode(strCoded.substring(10, 12))); 
    		// CODE
    		nArr[7] = (int) (Base36Decode(strCoded.substring(12, 15))); 
     
     
     
    		return nArr;
    	}
     
    	// Converts base36 string to int64 string .. All capitals
     
    	public static long Base36Decode(String input) {
    		/*
    		 * This function converts the input String characters into base36 values
    		 */
    		String base36Chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    		char[] arrInput = new char[input.length()];
    		arrInput=input.toCharArray();
    		for (int i = input.length() - 1, j = 0; i != -1; i--, j++) {
    			arrInput[j] = input.charAt(i);
    		}
    		long returnValue = 0, rv=0;;
    		int value=1;
    		for (int i = 0; i < arrInput.length; i++) {
     
    			int valueindex = base36Chars.indexOf(arrInput[i]);
    			if(i==0)
    			{
    				rv=valueindex;
    			}
    			else
    			{
    			for(int j=0;j<=i;j++)
     
    			{
    				   if(j==0)
    					{
    						value=1;
    					}
    					else
    					{
    					value*=36;
    					}
     
    			}
    			returnValue+= valueindex*value;
    			}
    		}
    		return rv+returnValue;
    	}
    	private String RotateString(String strRotate, int nTimes) {
    		/*
    		 * Function can Rotates the String
    		 */
    		char[] cTemp;
    		char cur, nxt;
    		int nLen = strRotate.length();
    		for (int nIndex = 0; nIndex < nTimes; nIndex++) {
    			cTemp = strRotate.toCharArray();
    			cur = cTemp[0];
    			nxt = cur;
    			for (int nTemp = 0; nTemp < nLen - 1; nTemp++) {
    				nxt = cTemp[nTemp + 1];
    				cTemp[nTemp + 1] = cur;
    				cur = nxt;
    			}
    			cTemp[0] = nxt;
    			strRotate = new String(cTemp);
    		}
     
    		return strRotate;
    	}
     
    }

    My code may not be correct...And my output is it should display me a barcode as of now and when i scan it,it should display me the details related to that barcode...As of now it should create me a barcode........Any Solution would be appreciable....Thanks in Advance....


    Regards,
    Last edited by StarRocks; August 24th, 2012 at 05:10 AM.

  4. #4
    Junior Member
    Join Date
    Aug 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Barcode Generator

    Quote Originally Posted by StarRocks View Post
    Dear Forums,


    Hi guys im very new to this forum.......h r u guys....Hey Guys i want some information related to Barcode Generator do anyone know how to create a barcode using Java .....Any solution would be appreciable......Thanks in Advance.


    Regards......

    Venu
    I have used Barcode4j (Welcome to Barcode4J). Works very well.

  5. #5
    Junior Member
    Join Date
    Aug 2012
    Posts
    8
    My Mood
    Cheeky
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Barcode Generator

    Dear paulvas,


    Thanks for the reply.....Will get back to you if i have any futher queries.......If you find any other solutions please forward me....Any solution would be appreciable......Thanks in Advance...


    Regards,

    Venu

Similar Threads

  1. Increase the barcode width in Java
    By astridcollins787 in forum JavaServer Pages: JSP & JSTL
    Replies: 6
    Last Post: December 7th, 2012, 03:37 AM
  2. Java Barcode Program with Oracle database
    By techsing14 in forum JavaServer Pages: JSP & JSTL
    Replies: 3
    Last Post: December 6th, 2012, 05:19 AM
  3. Using barcode to input data
    By cnjiru in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: August 7th, 2012, 07:10 AM
  4. How can we read barcode in pdf file?
    By suresh.bellala in forum Member Introductions
    Replies: 3
    Last Post: July 6th, 2012, 04:58 AM
  5. Replies: 0
    Last Post: January 25th, 2011, 01:24 AM