From: Tim Jones [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 16, 2004 6:03 PM
To: Paulo Soares
Subject: RE: [iText-questions] transparent png image not showingI am using the itext-1.02b.jar file. However if I use an older version ... not sure exactly which one(Jan 2003) I get a Colortype 6 not supported. Could this be a problem? The image is basically black text on white background. I have attached.thnxTim
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Paulo Soares
Sent: Tuesday, November 16, 2004 11:48 AM
To: Tim Jones; [EMAIL PROTECTED]
Subject: RE: [iText-questions] transparent png image not showingWhat iText version are you using?
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Jones
Sent: Tuesday, November 16, 2004 4:28 PM
To: [EMAIL PROTECTED]
Subject: [iText-questions] transparent png image not showing
I am having a problem inserting a transparent png image into my pdf file. I am basically adding the image using PdfContentByte but it never seems to appear. I can insert a jpeg that is not transparent ok but it covers the existing content even if I set the image transparency. I am able to stamp the image on a pdf properly using adobe professional so I know the image is ok but I am not sure what the proper way to add the transparent image ... have not seen anything on the list.
Tim
this is basically what I am doing
PdfWriter pdfwriter = PdfWriter.getInstance(document, new FileOutputStream(args[2]));
Watermark watermark = new Watermark(Image.getInstance("prelim2.jpg"), 0.0F, 320F);
Image image = Image.getInstance("Image5.png");
//image.setTransparency(new int[] {255, 255});
//document.add(watermark);
document.open();
PdfContentByte pdfcontentbyte = pdfwriter.getDirectContent();
for(int j = 0; j < i;)
{
document.newPage();
j++;
com.lowagie.text.pdf.PdfImportedPage pdfimportedpage = pdfwriter.getImportedPage(pdfreader1, 1);
com.lowagie.text.pdf.PdfImportedPage pdfimportedpage1 = pdfwriter.getImportedPage(pdfreader, j);
int k = pdfreader.getPageRotation(j);
int l = pdfreader1.getPageRotation(1);
System.out.println("rotation: " + k);
if(k == 90)
pdfcontentbyte.addTemplate(pdfimportedpage1, 0.6F, -f2, f2, 0.6F, 0.0F, f1 - 20F);
else
pdfcontentbyte.addTemplate(pdfimportedpage1, 1.0F, 0.0F, 0.0F, 1.0F, 0.0F, -10F);
//pdfcontentbyte.addTemplate(pdfimportedpage, 0.0F, -25F);
//pdfcontentbyte.setRGBColorStroke(0x00, 0x00, 0xFF);
// pdfcontentbyte.rectangle(50, 250, 100, 375);
//pdfcontentbyte.stroke();
//pdfcontentbyte.addTemplate(pdfimportedpage, 0.0F, -25.0F);
image.setAbsolutePosition(0,0);
//image.setTransparency(new int[] {255, 255});
pdfcontentbyte.addImage(image);
//document.add(image);
//Chunk chunk1 = new Chunk("This text is underlined", FontFactory.getFont(FontFactory.HELVETICA, 12, Font.UNDERLINE));//document.add(chunk1);
//document.add(new Annotation("annotation", "This is a post-it note", 50f, 250f, 500f, 600f));
}
Title: transparent png image not showing
The problem is that the image is very big. If you
apply a Image.scalePercent(30) it shows up.
