Discussion:
[iText-questions] Barcodes
Steve Simpson (AVR IT Dept)
2006-02-10 10:37:06 UTC
Permalink
All,



I have a barcode that I print on an Invoice that runs horizontally from left
to right. I now want to rotate this barcode through 90 degrees clockwise so
that it will run down the right hand side of the page. As soon as I try to
rotate the barcode in iText I lose the barcode from the invoice. I've tried
using



imgShipBarCode.setRotation(90);

and

imgShipBarCode.setRotationDegrees(90);



Can you offer any advice on how to rotate this barcode?



Thanks


Steve



---------------------------------------------------------
Steve Simpson
Arriva Vehicle Rental



Tel : 0191 520 4029
Mob : 07917 268 934



For WebSphere support : <mailto:***@arrivarental.co.uk>
***@arrivarental.co.uk

Website : <http://www.arrivarental.co.uk>
www.arrivarental.co.uk





**************************************************
Legal Disclaimer - Arriva plc
The contents of this e-mail are confidential and may be privileged and protected by law and are intended solely for the use of the person to whom they are addressed.
If you are not the intended recipient of this message please notify the sender immediately, disclosure of its content to any other person is prohibited and may be unlawful.
Please note that any views expressed in this e-mail may be those of the originator and do not necessarily reflect those of this organisation.
Copyright in this e-mail and attachment(s) belongs to
Arriva plc.
Internet e-mail is not a secure communications medium.
Please note this lack of security when responding by e-mail. Accordingly, we give no warranties or assurances about the safety and content of this e-mail and its attachments.
Neither Arriva plc nor the sender accepts any responsibility for viruses and it is your responsibility to scan the e-mail and attachments.
Any liability arising from any third party acting on any information contained in this e-mail is hereby excluded.
**************************************************
Bruno Lowagie
2006-02-10 11:11:17 UTC
Permalink
Post by Steve Simpson (AVR IT Dept)
All,
I have a barcode that I print on an Invoice that runs horizontally
from left to right. I now want to rotate this barcode through 90
degrees clockwise so that it will run down the right hand side of the
page. As soon as I try to rotate the barcode in iText I lose the
barcode from the invoice. I've tried using
imgShipBarCode.setRotation(90);
and
imgShipBarCode.setRotationDegrees(90);
Can you offer any advice on how to rotate this barcode?
I think the barcode is in your invoice, but it's probably rotated 'off
the page'.
Is imgShipBarCode an instance of com.lowagie.text.Image?
Try changing the absolute position of the image.
And are you sure the scaledWidth and scaledHeight are > 0?
br,
Bruno
Steve Simpson (AVR IT Dept)
2006-02-10 11:19:14 UTC
Permalink
The Invoice is landscape.


Here's the example code;

//Data for the barcode : it is composed of 3 blocks whith AI 402, 90
and 421
// The blocks whith the type 402 and 90 are
of variable size so you must put a FNC1
// to delimitate the block
//String data = code402 + code90 + code421;

PdfContentByte cb =
writer.getDirectContent();

// String t402 =
c.getDeliveryLocation()+RA+c.getAccount()+Barcode128.FNC1;
//String t90 =
c.getDeliveryLocation()+RA+c.getAccount()+Barcode128.FNC1;
//String t421 = "000000";
//String data = t402+t90+t421;
PdfPTable pageTot = new PdfPTable(1);
pageTot.getDefaultCell().setPadding(0f);


pageTot.getDefaultCell().setBorder(Rectangle.NO_BORDER);

pageTot.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
pageTot.setWidthPercentage(100f);

String systemDate =
Integer.toString(c.getSystemDD())+Integer.toString(c.getSystemMM())+Integer.
toString(c.getSystemYY());

String t402 =
up.getUserCompany()+c.getVehicleOwningLocation()+RA+Barcode128.FNC1;
String t90 = systemDate+Barcode128.FNC1;
String t421 = "XX";
String data = t402+t90+t421;
System.out.println("Barcode data : "+data);
PdfPTable cell = new PdfPTable(1);

cell.getDefaultCell().setBorder(Rectangle.NO_BORDER);
cell.getDefaultCell().setPadding(0f);

PdfPCell info = new PdfPCell(new Phrase("
"));
info.setBorder(Rectangle.NO_BORDER);
pageTot.addCell(info);

Barcode128 shipBarCode = new Barcode128();
shipBarCode.setX(0.75f);
shipBarCode.setN(1.5f);
shipBarCode.setChecksumText(true);
shipBarCode.setGenerateChecksum(true);
shipBarCode.setSize(5f);

shipBarCode.setTextAlignment(Element.ALIGN_CENTER);
shipBarCode.setBaseline(5f);
shipBarCode.setCode(data);
shipBarCode.setBarHeight(10f);

Image imgShipBarCode =
shipBarCode.createImageWithBarcode(cb, Color.black, Color.black);
imgShipBarCode.setRotationDegrees(0);

PdfPCell shipment = new PdfPCell(new
Phrase(new Chunk(imgShipBarCode, 0, 0)));

shipment.setFixedHeight(shipBarCode.getBarcodeSize().height() + 16f);
shipment.setPaddingTop(5f);
shipment.setPaddingBottom(10f);
shipment.setBorder(PdfPCell.NO_BORDER);

shipment.setVerticalAlignment(Element.ALIGN_TOP);

shipment.setHorizontalAlignment(Element.ALIGN_CENTER);
cell.addCell(shipment);

pageTot.addCell(cell);
pageTot.setTotalWidth(1);
if (c.getPartSetup().equals("N"))
pageTot.writeSelectedRows(0, -1,
300, 300, writer.getDirectContent());
// pageTot.writeSelectedRows(0, -1, 500, 50,
writer.getDirectContent());



---------------------------------------------------------
Steve Simpson
Arriva Vehicle Rental

Tel : 0191 520 4029
Mob : 07917 268 934

For WebSphere support : ***@arrivarental.co.uk
Website : www.arrivarental.co.uk


-----Original Message-----
From: Bruno Lowagie [mailto:***@lowagie.com]
Sent: 10 February 2006 13:10
To: Steve Simpson (AVR IT Dept)
Cc: itext-***@lists.sourceforge.net
Subject: Re: [iText-questions] Barcodes
Post by Steve Simpson (AVR IT Dept)
All,
I have a barcode that I print on an Invoice that runs horizontally
from left to right. I now want to rotate this barcode through 90
degrees clockwise so that it will run down the right hand side of the
page. As soon as I try to rotate the barcode in iText I lose the
barcode from the invoice. I've tried using
imgShipBarCode.setRotation(90);
and
imgShipBarCode.setRotationDegrees(90);
Can you offer any advice on how to rotate this barcode?
I think the barcode is in your invoice, but it's probably rotated 'off
the page'.
Is imgShipBarCode an instance of com.lowagie.text.Image?
Try changing the absolute position of the image.
And are you sure the scaledWidth and scaledHeight are > 0?
br,
Bruno


**************************************************
Legal Disclaimer - Arriva plc
The contents of this e-mail are confidential and may be privileged and protected by law and are intended solely for the use of the person to whom they are addressed.
If you are not the intended recipient of this message please notify the sender immediately, disclosure of its content to any other person is prohibited and may be unlawful.
Please note that any views expressed in this e-mail may be those of the originator and do not necessarily reflect those of this organisation.
Copyright in this e-mail and attachment(s) belongs to
Arriva plc.
Internet e-mail is not a secure communications medium.
Please note this lack of security when responding by e-mail. Accordingly, we give no warranties or assurances about the safety and content of this e-mail and its attachments.
Neither Arriva plc nor the sender accepts any responsibility for viruses and it is your responsibility to scan the e-mail and attachments.
Any liability arising from any third party acting on any information contained in this e-mail is hereby excluded.
**************************************************
Bruno Lowagie
2006-02-10 11:29:05 UTC
Permalink
Post by Steve Simpson (AVR IT Dept)
imgShipBarCode.setRotationDegrees(0);
PdfPCell shipment = new PdfPCell(new Phrase(new Chunk(imgShipBarCode,
0, 0)));

This isn't the ideal way to add an Image to a PdfPCell.
Also the way you set the fixed height seems wrong.
I can't write the code in your place, but I'd use something like
new PdfPCell(imgShipBarCode, true)
or pass false as second parameter if you don't want the image to be resized.
Maybe the new method Paulo wrote to rotate the Cell content can help too
(but I didn't have the time to look at it yet).
br,
Bruno
Paulo Soares
2006-02-10 19:55:02 UTC
Permalink
Works for me. Post some code that can be run and we'll see...
Post by Steve Simpson (AVR IT Dept)
-----Original Message-----
Behalf Of Steve Simpson (AVR IT Dept)
Sent: Friday, February 10, 2006 12:37 PM
Subject: [iText-questions] Barcodes
Importance: High
All,
I have a barcode that I print on an Invoice that runs
horizontally from left to right. I now want to rotate this
barcode through 90 degrees clockwise so that it will run down
the right hand side of the page. As soon as I try to rotate
the barcode in iText I lose the barcode from the invoice.
I've tried using
imgShipBarCode.setRotation(90);
and
imgShipBarCode.setRotationDegrees(90);
Can you offer any advice on how to rotate this barcode?
Thanks
Steve
---------------------------------------------------------
Steve Simpson
Arriva Vehicle Rental
Tel : 0191 520 4029
Mob : 07917 268 934
Website : www.arrivarental.co.uk
<http://www.arrivarental.co.uk>
**************************************************
Legal Disclaimer - Arriva plc
The contents of this e-mail are confidential and may be
privileged and protected by law and are intended solely for
the use of the person to whom they are addressed.
If you are not the intended recipient of this message please
notify the sender immediately, disclosure of its content to
any other person is prohibited and may be unlawful.
Please note that any views expressed in this e-mail may be
those of the originator and do not necessarily reflect those
of this organisation.
Copyright in this e-mail and attachment(s) belongs to
Arriva plc.
Internet e-mail is not a secure communications medium.
Please note this lack of security when responding by e-mail.
Accordingly, we give no warranties or assurances about the
safety and content of this e-mail and its attachments.
Neither Arriva plc nor the sender accepts any responsibility
for viruses and it is your responsibility to scan the e-mail
and attachments.
Any liability arising from any third party acting on any
information contained in this e-mail is hereby excluded.
**************************************************
calosteward
2015-04-01 07:02:20 UTC
Permalink
Some bar code tool provide this selection.
Such as this .net bar code printing application
<http://www.keepdynamic.com/dotnet-barcode/> ,it has the rotate option:
<Loading Image...>




--
View this message in context: http://itext.2136553.n4.nabble.com/Barcodes-tp2140603p4660791.html
Sent from the iText mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
iText-questions mailing list
iText-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php
Loading...