Sorry if this is a duplicate....

 

 

I must be missing something then.  The text in my template does not wrap
to the next line if it is too long.  It simply cuts off at the end of
the template.  Also, I must not be using the rotation correctly.  

All that prints is "THIS IS A lot l", the rest is cut off.  Also, it is
rotated more than 90 degrees, its about 12 degrees past straight up and
down.

Here is my test code...

 

Document document = new Document();

                        try {

                                    // step 2:

                                    // we create a writer that listens
to the document

                                    // and directs a PDF-stream to a
file

                                    PdfWriter writer =
PdfWriter.getInstance(document,

                                                            new
FileOutputStream("C:\\LL\\Test.pdf"));

 

                                    // step 3: we open the document

                                    document.open();

                                     PdfTemplate template =
writer.getDirectContent().createTemplate(20, 20);

                                     BaseFont bf =
BaseFont.createFont("Helvetica", "winansi", false);

                                     String text = "THIS IS A lot load
of text that will hopefully wrap... 1234567890.  Oh my god there is TONS
OF THIS STUFF!!!! Where is it all comming from?!";

                                     float size = 16;

                                     float width =
bf.getWidthPoint(text, size);

                                     template.beginText();

                                     //template.setRGBColorFillF(1, 1,
1);

                                     template.setFontAndSize(bf, size);

                                     //template.setTextMatrix(2, 2, 2,
2,2, 2);

                                     template.setTextMatrix(0,0);

                                     

                                     template.showText(text);

                                     

                                     template.endText();

                                     template.setWidth(100);

                                     template.setHeight(100);

                                     

                                     // make an Image object from the
template

                                     Image img =
Image.getInstance(template);

                                     

                                     img.setRotation(90);

                                     document.add(img);

                        } catch (DocumentException de) {

                                    System.err.println(de.getMessage());

                        } catch (IOException ioe) {

 
System.err.println(ioe.getMessage());

                        }

 

                        // step 5: we close the document

                        document.close();

 

 

any ideas?

 


This electronic transmission may contain PRIVILEGED AND CONFIDENTIAL 
information intended only for the addressee(s).  If you are not the intended 
recipient, or the employee or agent responsible for delivery to the intended 
recipient(s), please note that any review, dissemination, use, distribution or 
copying is strictly prohibited.  If you receive this in error, please notify 
the sender immediately, destroy any paper copies and delete it from any 
computer.  Thank you.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to