Hello,
starting from the ClimbTheTree demo I'd like to modify that code in
order to deal with different encodings. I have the following problem
(Example):
- The font used is in MacROmanEncoding
- In the content stream there is the following line
(der RŸckgriff auf dieses ÈArbeitsvšlkerrechtÇ sehr selten, was
insbesondere)Tj
- but getStringValue() delivers the following
der R?ckgriff auf dieses ÈArbeitsv?lkerrechtÇ sehr selten, was insbesondere
- the german Umlauts are not coded as they were in the content stream,
thus a CharsetDecoder doesn't decode them proberly and gives me:
der R?ckgriff auf dieses »Arbeitsv?lkerrecht« sehr selten, was insbesondere
- the french double quote characters were decoded properly, the umlauts not.
Code snippet:
byte[] contentstream = PdfReader.getStreamBytes(content);
list.println(new String(contentstream));
PRTokeniser tokenizer = new PRTokeniser(contentstream);
while (tokenizer.nextToken()) {
if (tokenizer.getTokenType() == PRTokeniser.TK_STRING) {
String text = tokenizer.getStringValue();
list.println(text);
ByteBuffer bbuf = ByteBuffer.wrap(text.getBytes());
CharBuffer cbuf = decoder.decode(bbuf);
list.println(cbuf.toString());
}
}
Could the code be modified to let the Tokeniser deliver the expected
results, or does it maybe deliver the correct results but I do not
handle them correctly?
Or would I have to parse the contentstream by myself?
Best regards,
Christian Kirchhoff
*Editura Gesellschaft für Verlagsdienstleistungen mbH*
Tempelhofer Damm 2 · 12101 Berlin
www.editura.de
AG Berlin-Charlottenburg · HR B 81823 · USt.Id. DE217180548
Geschäftsführer: Ralf Szymanski
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php
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/