Hello,
I have problem to center the image. It keeps alligning the image on the left
side. Below are portion of the codes. Any help would be appreciated.
try {
switch (pageNum) {
case 1:
textllx = 10;
textlly = 292;
texturx = 385;
textury = 312;
text2llx = 10;
text2lly = 312;
text2urx = 385;
if (extendTxt == 0)
{
text2ury = 360;
//picx = 100;
picx = 10;
//Nurul: End of change
picy = 363;
}
else
{
text2ury = 512;
}
break;
case 2:
textllx = 400;
textlly = 292;
texturx = 775;
textury = 312;
text2llx = 400;
text2lly = 312;
text2urx = 775;
if (extendTxt == 0)
{
text2ury = 360;
//picx = 488;
picx = 397;
//Nurul: End of change
picy = 363;
}
else
{
text2ury = 512;
}
break;
case 3:
textllx = 10;
textlly = 61;
texturx = 385;
textury = 81;
text2llx = 10;
text2lly = 80;
text2urx = 385;
if (extendTxt == 0)
{
text2ury = 130;
//picx = 100;
picx = 10;
picy = 131;
}
else
{
text2ury = 282;
}
break;
case 4:
textllx = 400;
textlly = 61;
texturx = 775;
textury = 81;
text2llx = 400;
text2lly = 80;
text2urx = 775;
if (extendTxt == 0)
{
text2ury = 130;
//picx = 488;
picx = 397;
picy = 131;
}
else
{
text2ury = 282;
}
break;
}
BaseFont bf = BaseFont.createFont(BaseFont.COURIER,
BaseFont.CP1252,
BaseFont.NOT_EMBEDDED);
Font font = new Font(bf, 8, Font.NORMAL);
Font font2 = new Font(bf, 8, Font.NORMAL);
if (txt_color == 1)
{
font.setColor(Color.BLUE);
}
font2.setColor(Color.BLUE);
Phrase testText = new Phrase(0, dirText2, font2);
ColumnText ct = new ColumnText(cb);
ct.setSimpleColumn(testText, textllx, textlly, texturx, textury, 10,
Element.ALIGN_LEFT);
ct.go();
Phrase testText2 = new Phrase(0, dirText, font);
ColumnText ct2 = new ColumnText(cb);
ct2.setSimpleColumn(testText2, text2llx, text2lly, text2urx,
text2ury, 10, Element.ALIGN_LEFT);
ct2.go();
if (extendTxt == 0)
{
Image jpg = Image.getInstance(imgFile);
jpg.setAbsolutePosition(picx, picy);
jpg.scaleToFit(379, 148);
jpg.setAlignment(Image.MIDDLE);
//Nurul: End of change
underCB.addImage(jpg);
}
--
View this message in context:
http://www.nabble.com/Image.MIDDLE-fails-tp24585436p24585436.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/