New User? Sign Up  |  Sign In  |  Help
Barcode support and
tutorials from IDAutomation
and the community.
Click for the BBB Business Review of this Computers Hardware, Software & Services in Tampa FL
Resolved Questions

How do I control image horizontal size with the JavaBean (being used in Oracle Reports)

I am evaluating the JavaBean image creator for encoding documents in Oracle Reports.

I am tasked to create a 2.5-inch width by .5" height CODE128 barcode image (the bars alone, not including human-readable).

The setBarHeight() method works for height but does not seem to have a width counterpart

The setImageSize()method fails at x dimensions larger than 189, which is not wide enough.

I am certain I am missing something important, but so far have not been able to stumble over it.

TIA
HankF

Operating System: Windows XP

09-21-12     12 year(s) ago    

  Report Abuse

 

Tim

Best Answer

HankF,

the setImageSize() would be the right method to use, however, the XDimension should not be set so high.
This is the width of the narrow bars in centimeters, and should not be much bigger than .09.
Anything above that would probably be unreadable.

Posted 12 year(s) ago

(0)
(0)
  Report Abuse
 
Find Interesting
 
Email to Others
 
Bookmark
 
Subscribe to Answer Alert
No comments yet.     Be the first to comment.
Other Answers (6)
Sorry for the delay Hank,
I have been trying to recreate the error but I can not get it to crash even when setting the width to 500, a barcode image is always returned. This property should really only be used in a servelet environment because all this does is affect the canvas size and not the barcode itself.
You can see this behavior if you use the display the barcode formula floating on a blank paper, instead of a table.

If you need to increase the width it is recommended to only increase the XDimensionCM property. I was able to get the barcode to be 2.5 inches by setting the x dimension to 0.09.

Posted 12 year(s) ago

(0)
(0)
   Report Abuse
Any prospects for an early resolution on this?

Thanks
HankF

Posted 12 year(s) ago

(0)
(0)
   Report Abuse
Thank you for the code. I am updating the Java source as we speak, I will step through the source using this code as a test and see what I can find.

Posted 12 year(s) ago

(0)
(0)
   Report Abuse
Here is the procedure from the Oracle Report, which means it is in PL/SQL.

function CF_SHIPPING_ADVISE_ID_BCFormul return Char is
myfilename varchar2(250);
barcodeData VarChar2(80) := :SC_shipping_advise_ID;

/*name of temp file*/
ImageFile VarChar2(250);
/*object containing barcode properties*/
BarcodeObject ORA_JAVA.JOBJECT;
/*object that creates jpeg of barcode based on BarcodeObject*/
BarcodeEncoderObject ORA_JAVA.JOBJECT;

begin

-- implementation of IDAutomation linearbarcode.jar
imageFile := srw.create_temporary_filename();
/*Create the barcode object*/
BarcodeObject := Barcode.new();
/*Set the symbology*/
Barcode.setSymbologyID(BarcodeObject, Barcode.CODE128);

/*set the data to encode*/
Barcode.setDataToEncode(BarcodeObject, barcodeData);

/* Manually size the image */
Barcode.setAutoSize(BarcodeObject, FALSE);

/* Set the bar height to 2 cm */
-- Barcode.setBarHeightCM(BarcodeObject,2.0);

/* Set the small bar width to 12 cm */
Barcode.setXDimensionCM(BarcodeObject,.052);

/* set IMAGE SIZE directly */
Barcode.setImageSize(BarcodeObject, 189, 80);

/* Suppress Human-Readable */
Barcode.setShowText(BarcodeObject, FALSE);

/*Create the jpeg*/
BarcodeEncoderObject := BarcodeEncoder.new(BarcodeObject, 'JPEG',ImageFile);

/*Create the gif*/
-- BarcodeEncoderObject := BarcodeEncoder.new(BarcodeObject, 'GIF',ImageFile);

/*If, for some reason, the barcode is not created, return null
otherwise, return the name of the barcode image jpeg that was
created */
if ORA_JAVA.IS_NULL(BarcodeEncoderObject) then
return(NULL);
else
return(ImageFile);
end if;
END;

The setup is otherwise as prescribed for the report control for display. You can test this with any string that fits the following pattern:

YYYYSSDDDD where

YYYY is a year, eg: 2011
SS is a two-character string, eg: WM
DDDD is a four-digit "number" string, eg: 1234

The string I have been testing with is: 2012WM2925, but any and all variations on this theme are potential values for the barcodedata property. Note that this code is currently creating a JPEG image, but I have been testing both JPEG and GIF. There has been no difference in results.

The above procedure will create a barcode, but changing only the width parameter in the call to setImageSize( 190, 80) will cause it to fail to create an image. At least, that is what I assume it fails on since I get an error from the report that this function failed to return a value.

Thanks for your efforts.
HankF

Posted 12 year(s) ago

(0)
(0)
   Report Abuse
HankF,

Can you post the code you are using to create the image? I would like to run some tests on my end.
I assume that the data being encoded is from a database field, in which case can you also post some data strings?

Posted 12 year(s) ago

(0)
(0)
   Report Abuse
Thank you for the response, but according to the Java Class Properties documentation, the setImageSize() method "Sets the size in pixels of the barcode image. If the size is set manually, autoSize will be set to false." What you describe sounds more like the setXDimensionCM method, which I have also experimented with, and discovered exactly what you describe with respect to that method. Indeed, integer values do not work out well.

I have established, at least by experimentation, that setImageSize does in fact control the size of the image, but there appears to be that upper limit on the width that does not seem reasonable. If it is, in fact, the upper limit on the size (width in pixels) of a barcode I can create with this product, we will have to look elsewhere as it will not meet our requirements.

The setImageSize() method does not include any information on what the limits of the parameters should be, but it does not seem reasonable that such a low limit would be correct. I don't want to eliminate this product due to this limitation without knowing that what I am seeing here is the expected result.

Thanks
Hankf

Posted 12 year(s) ago

(0)
(0)
   Report Abuse
Email this question link to friends
You must enter an email address, if name is entered or vice-versa for each friend.
Friend #1 -
Friend #2 -
Friend #3 -
Friend #4 -
Friend #5 -
  Your comment on this question
  |         |  
bold  italic  underline  strike       big  small       superscript  subscript 
  Allows to add a link. Added links would only be converted to actual clickable link, when the domain of the link is white-listed by administrator.
Caption :
Link URL :
(Must starts with "http://")
Add  |   Cancel
  Allow to insert an image. Must be among the following file types - *.jpg, *.gif, *.png & *.bmp.
Image Url :   Upload New
(Image url must always starts with " http:// ")
Width : pixels
(Must not be greater than 450px. Enter 0px for no resize)
Add  |   Cancel
  Allow to insert YouTube video. Insert the video embed code.
Embed Code :
Add  |   Cancel
Up to 5000 Characters are allowed. Current Count: 0
  Your comment on this answer
  |         |  
bold  italic  underline  strike       big  small       superscript  subscript 
  Allow you to add a link. Added links would only be converted to actual clickable link, when the domain of the link is white-listed by administrator.
Caption :
Link URL :
(Must start with "http://" or "https://")
Add  |   Cancel
  Allow to insert an image. Must be among the following file types - *.jpg, *.gif, *.png & *.bmp.
Image Url :   Upload New
(Image url must always start with "http://" or "https://")
Width : pixels
(Must not be greater than 450px. Enter 0px for no resize)
Add  |   Cancel
  Allow to insert YouTube video. Insert the video embed code.
Embed Code :
Add  |   Cancel
Up to 5000 characters are allowed. Current Count: 0

You may answer and comment on any thread according to the Terms and Conditions.

 © Copyright 2021 IDAutomation.com, Inc., All Rights Reserved. Legal Notices.

 Barcode Fonts | Components | Scanners | Support | Contact Us
Training Videos on YouTube Join us on Google Plus Join us on LinkedIn Follow us on Twitter Like us on Facebook