How can I display the image in its original size?
Here's the method to create the Table:
protected Table initHeader()
{
// Header information
String milestoneNameX = manager.getMilestoneName(data.getDataContainer().getTemplate().getMilestone().getMilestoneId().intValue()).getMilestoneNamex().toString( ) ;
String milestoneAddition = data.getDataContainer().getMilestoneAddition().getMilestoneAddition().toString();
String customer = data.getDataContainer().getProject().getCustomer().getCustomerName().toString();
String projectTitle = data.getDataContainer().getProject().getProjectTitle();
StringBuffer project = new StringBuffer("Project (");
project.append(data.getDataContainer().getProject().get ProjectId())
.append(") \n")
.append(projectTitle);
//Header for every Page :
Table headTable = null;
try {
headTable = new Table(3);
} catch (BadElementException e) {
// Only thrown if a table with less than 1 column shall be created.
}
headTable.setWidth(100f);
headTable.setPadding(3);
headTable.setBorderWidth(0);
floa t[] widths = {25f, 50f, 25f};
try {
headTable.setWidths(widths);
} catch (BadElementException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
< span style="font-family: Courier;"> int headTableFontsize = 9;
Font headerFont = FontFactory.getFont(FontFactory.HELVETICA, headTableFontsize, Font.BOLD);
Paragraph msNamePhrase = new Paragraph("Milestone " + milestoneNameX + " " + milestoneAddition, headerFont);
Paragraph customerPhrase = new Paragraph("Customer " + customer, headerFont);
//headerFont = FontFactory.getFont(FontFactory.HELVETICA, headTableFontsize, Font.BOLD, Color.RED);
Chunk projectChunk = new Chunk(project.toString(), headerFont);
Paragraph projectPhrase = new Paragraph(projectChunk);
Paragraph[] headerPhrases = new Paragraph[]{msNamePhrase, customerPhrase, projectPhrase};
Cell cell = null;
try {
//////////// Traffic light /////////////
// 1=green,2=yellow, 3=red,4=grey
GifImage traffic;
switch (manager.getTrafficLightColor(dataContainer,dataID))
{
case 1:
traffic = new GifImage(realPath + "/static/images/traffic_light_green-neu.gif");
break;
case 2:
traffic = new GifImage(realPath + "/static/images/traffic_light_yellow-neu.gif");
break;
case 3:
traffic = new GifImage(realPath + "/static/images/traffic_light_red-neu.gif");
break;
default:
traffic = new GifImage(realPath + "/static/images/traffic_light_grey-neu.gif");
break;
}
Image image = traffic.getImage(1); // 1 == frame
image.setAlignment(Image.ALIGN_LEFT);
//document.add(image);
cell = new Cell(image);
cell.set
cell.add(msNamePhrase);
cell.setBorderWidth(1);
cell.setVerticalAlignment(Cell.ALIGN_MIDDLE);
cell.setHorizontalAlignment(Cell.ALIGN_CENTER);
headTable.addCell(cell);
} catch (BadElementException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
&n bsp; // TODO Auto-generated catch block
// Gifs couldn't be found.
e.printStackTrace();
}
try {
cell = new Cell(customerPhrase);
cell.setBorderWidth(1);
cell.setVerticalAlignment(Cell.ALIGN_MIDDLE);
cell.setHorizontalAlignment(Cell.ALIGN_CENTER);
headTable.addCell(cell);
} catch (BadElementException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
cell = new Cell(projectPhrase);
cell.setBorderWidth(1);
cell.setVerticalAlignment(Cell.ALIGN_MIDDLE);
cell.setHorizontalAlignment(Cell.ALIGN_CENTER);
headTable.addCell(cell);
} catch (BadElementException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return headTable;
}//end initHeader
and here's the code to convert the Table to a PdfPTable.
Table t = initHeader();
t.setConvert2pdfptable(true);
PdfPTable p = t.createPdfPTable();
When I simply do this:
document.add(image);
the image is displayed in its original (small) size.
So, how can I achieve that the image is not upscaled?
Thank you,
Dirk
--
GMX DSL-Flatrate 0,- Euro* - Überall, wo DSL verfügbar ist!
NEU: Jetzt bis zu 16.000 kBit/s! http://www.gmx.net/de/go/dsl
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions