1. Latest News
  2. Submit Press Release
  1. PR Home
  2. Latest News
  3. Feeds
  4. Alerts
  5. Submit Free Press Release
  6. Journalist Account
  7. PRNewswire Distribution

Generate & Recognize Barcodes from PDF Documents in Java Applications

Aspose.BarCode is a Java based visual component for generation & recognition of 1D & 2D barcodes to support Java and web applications. It supports 29+ barcode symbologies like MSI, QR, OneCode, Australia Post, Aztec, Code128, Code11and EAN128 etc

PRLog - Feb. 8, 2012 - LANE COVE, Australia -- This article shows how we can use Aspose.Pdf for Java to recognize barcodes from PDF documents.  First, we will use Aspose.BarCode for Java and generate a barcode image. We will save this image to a file on disk. Then, we will use Aspose.Pdf for Java to create Adobe PDF document and insert this barcode in that document. For the recognition part, we will first extract images from the PDF document using Aspose.Pdf.Kit for Java. Once images are extracted, we will pass these images to Aspose.BarCode for Java for barcode recognition.

Below is the complete java program to generate and recognize barcodes from Adobe PDF documents:

import com.aspose.barcode.*;
import com.aspose.barcoderecognition.BarCodeReadType;
import com.aspose.barcoderecognition.BarCodeReader;
import com.aspose.pdf.elements.Pdf;
import com.aspose.pdf.elements.Section;
import com.aspose.pdf.kit.License;
import com.aspose.pdf.kit.PdfExtractor;
import java.awt.Toolkit;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;

public class RecognitionFromPdf
   public static void main(String[] args)
           // set license
           License licPdfKit = new License();
           FileInputStream stream = new FileInputStream("AsposeLicense.lic");

           com.aspose.barcode.License licBarCode = new com.aspose.barcode.License();

           String strPdfDoc = " output1.pdf";
           String strBarCodeImage = "";

           // generate barcode and add to pdf file
           BarCodeBuilder builder = new BarCodeBuilder();
           String strBarCodeImageSave = " img.jpg";
           //Instantiate a Pdf object by calling its empty constructor
           Pdf pdf1 = new Pdf();
           //Create a section in the Pdf object
           Section sec1 = pdf1.getSections().add();
           //Create an image object in the section
           com.aspose.pdf.elements.Image img1 = new com.aspose.pdf.elements.Image(sec1);
           //Add image object into the Paragraphs collection of the section
           //Set the path of image file
           img1.getImageInfo().setTitle("JPEG image");
           //Save the Pdf
           FileOutputStream out = new FileOutputStream(new File(strPdfDoc));

           //Instantiate PdfExtractor object
           PdfExtractor extractor = new PdfExtractor();

           //Bind the input PDF document to extractor

           //Extract images from the input PDF document
           String suffix = ".jpg";
           int imageCount = 1;
           while (extractor.hasNextImage()) {
               System.out.println("Extracting image " + imageCount);
               strBarCodeImage = "tmpbarcode" + imageCount + suffix;

               // recognize barcode from image
               BarCodeReader reader = new BarCodeReader(strBarCodeImage,BarCodeReadType.getCode39Standard());
               while (reader.read())
                   System.out.println("codetext: " + reader.getCodeText());
       catch(Exception ex)

More about Aspose.BarCode for Java

- Homepage of Aspose.BarCode for Java: http://www.aspose.com/categories/java-components/aspose.b...

- Read more technical tips by Aspose.BarCode for Java: http://docs.aspose.com/display/barcodejava/Technical+Arti...

-  Download Aspose.BarCode for Java: http://www.aspose.com/community/files/72/java-components/...

Contact Information
Aspose Pty Ltd
Suite 163, 79 Longueville Road
Lane Cove, NSW, 2066
Phone: 888.277.6734
Fax: 866.810.9465

# # #

Hello everyone,
I am part of Aspose.com "The .NET and Java component publisher!". It is my pleasure to be part of this beautiful world. If I could bring any positive change to this community will be a great honour fo rme.

Thanks to you all.

--- End ---

Click to Share

Contact Email:
***@aspose.com Email Verified
Location:Lane Cove - New South Wales - Australia
Industry:Computers, Technology, Software
Tags:java, barcode, recognize barcodes from PDF documents, generate a barcode image, create Adobe PDF document, insert barcod
Verified Account Email Address
Verified Account Phone Number

Disclaimer:   Issuers of the press releases are solely responsible for the content of their press releases. PRLog can't be held liable for the content posted by others.   Report Abuse

Latest Press Releases By “


Trending News...

  1. SiteMap
  2. Privacy Policy
  3. Terms of Service
  4. Copyright Notice
  5. About
  6. Advertise
Like PRLog?
Click to Share