The ONLY THING between BT and ET should be the matrix and the text - move the 
font calls outside the BT/ET block

-----Original Message-----
From: alrts [mailto:edition-b...@swissonline.ch] 
Sent: Monday, August 30, 2010 8:16 AM
To: itext-questions@lists.sourceforge.net
Subject: Re: [iText-questions] Error: Unbalanced begin/end text operators 
sinceiText 5


Paolo, 

the code is huge and difficult to supply. In the meantime, I could generate
the same error at the ContentByte level. Here it is obvious that something
strange is going on:

document = new Document();
document.Open();
writer = PdfWriter.GetInstance(document, pdfFile);
cb = writer.DirectContent;
cb.BeginText();
bf = BaseFont.CreateFont(fontfile, BaseFont.WINANSI, true);
cb.SetFontAndSize(bf, fontSize);
cb.SetTextMatrix(a, b, c, d, e, f);  //values for a,b,c,d,e,f : 45, 450,
550, 479, 0, 1
cb.ShowText(contentString);  //value for contentString = "Astrological
Portrait"
cb.EndText();
document.NewPage();

The font I use is Century Gothic True Type (GOTHIC.ttf), the contentString
is two words only. I switched back to 3.1.1 and get no error. I compared the
two objects cb and document and they seem the same for both 3.1.1 and 5.0.4
versions. It is strange but in both versions I cannot actually find the cb
content within the document object.  Anyway I'm getting the same error when
using iTextSharp 5.0.4:

Error: Unbalanced begin/end text operators

(By the way, when I use this code instead of the ColumnText code above with
3.1.1 I'm getting huge letters!)

Please help!

-- 
View this message in context: 
http://itext-general.2136553.n4.nabble.com/Error-Unbalanced-begin-end-text-operators-since-iText-5-tp2399694p2400002.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
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/

------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
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