Hi All

I use iText to generate dynamically the PDF which works good. I did generate
some PDFs with the barcodes on it. 

I am trying to scale the barcode to different pre-defined Standard scale
sizes as follows: 

Scale           Area   Width   Height

SC0 (81.8%)  0.27   30.50 x 21.48         
SC1 (90%)    0.297 33.56 x 23.34         
SC2 (100%)   0.33   37.29 x 25.93         
SC3 (110%)   0.363 41.02 x 28.52         
SC4 (120%)   0.396 44.75 x 31.12         
SC5 (135%)   0.445 50.34 x 35.01         
SC6 (150%)   0.495 55.94 x 38.90         
SC7 (165%)   0.544 61.53 x 42.78         
SC8 (185%)   0.610 68.99 x 47.97         
SC9 (200%)   0.66   74.58 x 51.86         

I assume this must be a simple task to scale a barcode and I found the
method to set the width and height BarcodeEAN.setX() and
BarcodeEAN.setBarHeight() but unfortunately it is not working how I expect
to be. The code is as follows:

       BarcodeEAN codeEAN = new BarcodeEAN();
      float width = 30.50f;
      float height = 21.48f;
      float convertedWidthInInches = 1.200785f;

      //float convertedHeightInInches =0.8456676f;
      codeEAN.setX(convertedWidth);
      codeEAN.setBarHeight(height);
      codeEAN.setCode(appendedString); //this is to set code for barcode 

      Image image = codeEAN.createImageWithBarcode(_pdfWriter
                  .getDirectContent(), null, null);

      return image;

When I change the width and height in the above code, for example the 100%
scale(37.29f x 25.93f) is slightly bigger than the 200%scale(74.58f x
51.86f). To put simple, there is no difference at all :-(!

I looked into the API of BarcodeEAN but there is not so much of information 

Anyone know where I am wrong? Thank you in advance.

Kind Regards
Kris
-- 
View this message in context: 
http://www.nabble.com/Scaling-the-Barcode-created-using-the-BarcodeEAN-tp18112364p18112364.html
Sent from the iText - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar

Reply via email to