cancel
Showing results for 
Search instead for 
Did you mean: 

Barcode Printing from EP --using barcode4J (Gurus kindly help me)

Former Member
0 Kudos

Dear Experts,

Barcode Printing from EP --using barcode4J

we want to print employee number as barcode in EP(version 6.4 SP 19).

we tested the barcode creation a standalone class, it works fine

Sample Code as follows

================================

Code128Bean bean = new Code128Bean();

final int dpi = 150;

//Configure the barcode generator

bean.setModuleWidth(UnitConv.in2mm(1.0f / dpi)); //makes the narrow bar

//width exactly one pixel

bean.setWideFactor(3);

bean.doQuietZone(false);

//Open output file

File outputFile = new File("out.jpg");

OutputStream out = new FileOutputStream(outputFile);

try {

//Set up the canvas provider for monochrome JPEG output

BitmapCanvasProvider canvas = new BitmapCanvasProvider(

out, "image/jpeg", dpi, BufferedImage.TYPE_BYTE_INDEXED, false);

//BarcodeServlet.

//Generate the barcode

bean.generateBarcode(canvas, "Z454544");

//Signal end of generation

canvas.finish();

} finally {

out.close();

}

<b>But the same code i put in wdDoModifyView() or wdDoInit() it throws class not found exception</b>. I have checked that barcode4j.jar and all relevant files are in classpath.

Any help will be rewarded.

Thanks

Aby.

Accepted Solutions (1)

Accepted Solutions (1)

former_member185029
Active Contributor
0 Kudos

Hi,

If u are not using JDI for development, put the jar file in lib folder of the webdynpro project (located in WebDynpro project workspace).

Else you will have to create library dc and expose the jar as a public part.

Ashutosh.

Former Member
0 Kudos

Dear Ashutosh,

Thanks for the suggestion,

I will get back to you after trying this out.

If someone can provide me with a more detailed answer

Or Best Practices (step by step).

<b><i>Since I am more of an ABAP background guy

I deeply appreciate your valuable help.</i></b>

thanks,

ABY

former_member185029
Active Contributor
0 Kudos

Hi,

If are not able to locate lib folder, go to Navigator perspective in NWDS and expand your project node. Under that you will find lib folder.

You can copy jar file from your system and directly paste it there.

Ashutosh

Former Member
0 Kudos

Re: Barcode Printing from EP --using barcode4J (Gurus kindly help me)

Posted: Aug 24, 2007 5:21 AM in response to: Ashutosh Moharir Reply E-mail this post

Dear Ashutosh,

<b> It is working now! .... 😄

Can someone provide me with a more detailed answer

Or Best Practices (step by step) ,that would be Great . </b>

I deeply appreciate your Quick & valuable advice;

and shall create a new posting if any further need arises

Many Thanks,

Aby Jacob

=========

Answers (3)

Answers (3)

former_member193726
Active Participant
0 Kudos

Hi Aby,

As per SAP practice, we used to create a seperate DC for the external/3rd party jar files and reuse it in our WebDynpro DC application.

To help you in doing the same, I have provided you the link below.

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/7b8180e5-0601-0010-0c94-9bccb92d...

Goto section 2.2.3.1 Defining Libraries Page No. 75

Regards,

Rekha Malavathu

Former Member
0 Kudos

Hi Rekha,

Unfortunately the link you have provided is not working.

Thanks & Regards,

ABY

former_member193726
Active Participant
0 Kudos

Hi Aby,

Can you please tell me whether you are using the JDI for your development or is that a WebDynpro project that you are creating in your NWDS?

Also please explain me how you are referencing the jar file to your project?

Regards,

Rekha Malavathu

former_member193726
Active Participant
0 Kudos

Hi Aby,

Are you referencing the .jar file as an external jar or by adding a variable which points to the jar file on the server?

Regards,

Rekha Malavathu

Former Member
0 Kudos

Hi Rekha,

Thanks for the quick response.

<b>Barcode4j.jar is an open source jar file</b>

(pls search for barcode4j in Google you wil get the website URL.

I have added this jar file to NWDS class path using project properties.

Regards, ABY