Look at the javadoc of ColumnText.showTextAligned() and spot the
differences to your code:

public static void showTextAligned(PdfContentByte canvas,
                                   int alignment,
                                   Phrase phrase,
                                   float x,
                                   float y,
                                   float rotation)Shows a line of text.
Only the first line is written. 

Parameters:
canvas - where the text is to be written to
alignment - the alignment
phrase - the Phrase with the text
x - the x reference position
y - the y reference position
rotation - the rotation to be applied in degrees counterclockwise 

> -----Original Message-----
> From: Benjamin Podszun [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, July 07, 2005 12:12 PM
> To: Paulo Soares
> Cc: [email protected]
> Subject: Re: [iText-questions] document.add(image) displays 
> fine, ColumnText.showTextAligned(new Phrase(new Chunk(Image, 
> 0, 0)), x, y, Element.ALIGN_UNDEFINED) doesn't
> 
> Paulo Soares wrote:
> > You have the tranformation:
> > 
> > 0.99985 -0.01745 0.01745 0.99985 100 300 cm 
> > 
> > before the images.
> 
> Thanks for checking that.. But: Where?
> 
> Code that created the pdf below..
> 
> public static void main(String[] args)
>       {
>               Document document = new Document(PageSize.A4, 
> 36, 36, 36, 36);
>               try
>               {
>                       // step2
>                       PdfWriter writer = 
> PdfWriter.getInstance(document, new 
> FileOutputStream("CellWidths.pdf"));
>                       document.open();
>                       
>                       BaseFont bf = 
> BaseFont.createFont(BaseFont.COURIER, BaseFont.CP1252, 
> BaseFont.NOT_EMBEDDED);
>        Font font = new Font(bf, 11, Font.NORMAL);
> 
>        PdfContentByte cb = writer.getDirectContent();
>        
> cb.setTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_INVISIBLE);
>        Chunk chunk1 = new Chunk("this is a phrase");
>        //chunk1.setHorizontalScaling(0.5f);
>        Phrase phrase1 = new Phrase(chunk1);
>        Image tiff = Image.getInstance("iText.tif");
>        document.add(tiff);
>        Phrase phrase2 = new Phrase(new Chunk(tiff, 0f, 0f));
>        ColumnText.showTextAligned(cb, 0, phrase1, 100f, 300f, 
> Element.ALIGN_UNDEFINED);
>        ColumnText.showTextAligned(cb, 0, phrase2, 0f, 0f, 
> Element.ALIGN_UNDEFINED);
>        ColumnText.showTextAligned(cb, 0, phrase2, 50f, 100f, 
> Element.ALIGN_UNDEFINED);
>        ColumnText.showTextAligned(cb, 0, phrase2, 50f, 200f, 
> Element.ALIGN_UNDEFINED);
>               }
>               catch (Exception de)
>               {
>                       de.printStackTrace();
>               }
>               // step5
>               document.close();
>       }
> 
> 


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to