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 <psoa...@glintt.com> wrote:

>  Scale the image before putting it in the Chunk.
>
> Paulo
>
>  ------------------------------
> *From:* Philipp Bouillon [philipp.bouil...@gmail.com]
> *Sent:* Tuesday, March 23, 2010 10:56 AM
> *To:* itext-questions@lists.sourceforge.net
> *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 <
> philipp.bouil...@gmail.com> 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&#174; 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
> iText-questions@lists.sourceforge.net
> 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/
>

Attachment: Sales1_63.pdf
Description: Adobe PDF document

<<attachment: plus.png>>

------------------------------------------------------------------------------
Download Intel&#174; 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
iText-questions@lists.sourceforge.net
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/

Reply via email to