Two pieces of information

1) ToolTips don't use embedded fonts - they use OS fonts.  
2) Text in ToolTips is either in PDDocEncoding (ISO Latin 1) _OR_ UTF16BE.

I would check that the UTF8->UTF16BE conversion is happening correctly.

Leonard


-----Original Message-----
From: Mike Musa [mailto:michael.m...@ccs-solutions.de] 
Sent: Tuesday, February 24, 2009 6:13 AM
To: itext-questions@lists.sourceforge.net
Subject: [iText-questions] UTF-8 compatible tooltips on annotations


Hi,

I'm using iText for Java to add annotations to existing pdf files via
PdfStamper. 
Everything works fine until someone tried to add chinese letters, coded via
UTF-8, as tooltip.
Acrobat Reader displays only some of them. Letters it can't display shows
the reader as square, followed by a question mark.
I can't figure out where the problem is based on. I saw pdf documents with
correct tooltips on annotations, displaying the chinese letters completly.
The chinese fonts (e.g. SimSun) have been integrated in the pdf file during
the initial creation process as embedded fonts.

Here's the code fragment that will add the annotation. If you worry about
some missing code or what's "def": I'm using groovy ;-)

pdfToolTipText is a utf-8 coded string.
_rect is a PdfRectangle.

def outstream = new FileOutputStream(pdfOutputFile);
def stamper = new PdfStamper(localReaderObject, outstream);
def localWriterObject = stamper.getWriter();
PdfFormField pushbutton = PdfFormField.createPushButton(localWriterObject);
pushbutton.setFieldName(pdfToolTipText);
pushbutton.setWidget(_rect, PdfAnnotation.HIGHLIGHT_PUSH);
pushbutton.setAction(PdfAction.gotoLocalPage(this._namedDestination,
false));
pushbutton.put(PdfName.TU, new PdfString(pdfToolTipText,
PdfObject.TEXT_UNICODE));
stamper.addAnnotation(pushbutton, 1);

Tooltip-ok image: http://i42.tinypic.com/20zsglg.jpg
Tooltip failed image: http://i41.tinypic.com/2iatv14.jpg

Thank you for your reply. If you miss some details, please tell me.

With regards,
Mike
-- 
View this message in context: 
http://www.nabble.com/UTF-8-compatible-tooltips-on-annotations-tp22179932p22179932.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
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

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
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

Reply via email to