Where's the beginText()/endText() and what's under.fill() doing
there?
Paulo
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of SALERNI ACHILLE
Sent: Wednesday, May 24, 2006 12:12 PM
To: [email protected]
Subject: [iText-questions] Illegal operation 'Tm' outside a text object using DirectUnderContentI need to put in each page of my Pdf a text as background, using getUnderContent, I read in archive that Illegal operation 'Tm' outside a text object is generated by a wrong position in code but I don't understand where I have to put it, because I don't have direct call to beginText and endText() . This error is generated just if i try to write in underContent...............
Document document = new Document();try{PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(namePdf));Phrase p = null;document.open();Font courier8 = new Font(Font.COURIER, 8);
Font courier8b = new Font(Font.COURIER, 8);
courier8b.setStyle(Font.BOLD);
bf= BaseFont.createFont("c:\\windows\\fonts\\arialuni.ttf", BaseFont.IDENTITY_H, true);
Chunk c = new Chunk(riga_norm, courier8);//riga_norm is a string
Chunk cb = new Chunk(riga_bold, courier8b);//riga_bold is a stringp = new Phrase(10, "");
p.add(cb);
p.add(c);
if (newPage){document.newPage();/////////////////////////////////////////////////////////////////////part that produce the error
PdfContentByte under = writer.getDirectContentUnder();
under.setColorFill(new Color(220, 220, 220));
under.setFontAndSize(bf, 36);
under.showTextAligned(Element.ALIGN_LEFT, "TEXT", 50, 50, 55);
under.fill();
////////////////////////////////////////////////////////////////////}
else
document.add(new Paragraph(p));}
} catch (DocumentException de) {
System.err.println(de.getMessage());
} catch (IOException ioe) {
System.err.println(ioe.getMessage());
}
document.close();.......................Best regardsAchille Salerni
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.
