That's a resolution problem and has nothing to do with iText. iText never
changes the picture, the scaling is done by instructing the reader to display
the picture at some size, the same picture that you provided. Use a bigger
(more pixels) picture, use another reader, switch off aliasing in the reader or
something else.
Paulo
________________________________
From: Philipp Bouillon [[email protected]]
Sent: Tuesday, March 23, 2010 1:29 PM
To: Post all your questions about iText here
Subject: Re: [iText-questions] PdfPCell with image + text
Hm, ok, so I now scale the image:
URL url = getClass().getResource("plus.png");
Phrase ph = null;
try {
Image image = Image.getInstance(url);
image.scaleAbsolute(6, 6);
ph = new Phrase(new Chunk(image, 0, 0));
ph.add(new Chunk(" " + h, FONT_CELL_H));
} catch (Exception e) {
ph = new Phrase(h, FONT_CELL_H);
}
c = new PdfPCell(ph);
and the resulting pdf document looks awful when viewed on screen at 100%
(attached).
When printed, the result is a little better, but still not good: Sometimes the
"+" has a thicker right border, sometimes a thicker left border. Why is that?
Thanks,
Philipp
On Tue, Mar 23, 2010 at 1:55 PM, Paulo Soares
<[email protected]<mailto:[email protected]>> wrote:
Scale the image before putting it in the Chunk.
Paulo
________________________________
From: Philipp Bouillon
[[email protected]<mailto:[email protected]>]
Sent: Tuesday, March 23, 2010 10:56 AM
To:
[email protected]<mailto:[email protected]>
Subject: Re: [iText-questions] PdfPCell with image + text
Ok, I've got a somewhat better result using this
URL url = getClass().getResource("plus.png");
Phrase ph = null;
try {
Image image = Image.getInstance(url);
ph = new Phrase(new Chunk(image, 0, 0));
ph.add(new Chunk("SomeText", FONT_CELL_H));
} catch (Exception e) {
ph = new Phrase("SomeText", FONT_CELL_H);
}
PdfPCell c = new PdfPCell(ph);
but now, the image is scaled, I think. At least it looks too big in the
resulting pdf file. Is there anything I can do about that?
Thanks,
Philipp
On Tue, Mar 23, 2010 at 10:22 AM, Philipp Bouillon
<[email protected]<mailto:[email protected]>> wrote:
Hi all,
I am creating a PdfPCell with an image and some text like this:
PdfPCell c = new
PdfPCell(Image.getInstance(getClass().getResource("plus.gif")), false);
c.addElement(new Phrase("SomeText", new
Font(Font.FontFamily.HELVETICA, 8, Font.BOLD)));
Now, in the output, the text is shown -- the image is not.
Am I doing something wrong?
Thanks for your help.
Philipp
P.s.: Yes, the image exists...
________________________________
Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter
informação confidencial ou legalmente protegida. A incorrecta transmissão desta
mensagem não significa a perca de confidencialidade. Se esta mensagem for
recebida por engano, por favor envie-a de volta para o remetente e apague-a do
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de
usar, revelar ou distribuir qualquer parte desta mensagem.
Disclaimer:
This message is destined exclusively to the intended receiver. It may contain
confidential or legally protected information. The incorrect transmission of
this message does not mean the loss of its confidentiality. If this message is
received by mistake, please send it back to the sender and delete it from your
system immediately. It is forbidden to any person who is not the intended
receiver to use, distribute or copy any part of this message.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
iText-questions mailing list
[email protected]<mailto:[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/
Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter
informação confidencial ou legalmente protegida. A incorrecta transmissão desta
mensagem não significa a perca de confidencialidade. Se esta mensagem for
recebida por engano, por favor envie-a de volta para o remetente e apague-a do
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de
usar, revelar ou distribuir qualquer parte desta mensagem.
Disclaimer:
This message is destined exclusively to the intended receiver. It may contain
confidential or legally protected information. The incorrect transmission of
this message does not mean the loss of its confidentiality. If this message is
received by mistake, please send it back to the sender and delete it from your
system immediately. It is forbidden to any person who is not the intended
receiver to use, distribute or copy any part of this message.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
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/