Andreas Ebbert-Karroum wrote:
> Good Morning,
> 
> Am 12.07.2010 19:53, schrieb 1T3XT info:
>> Certainly! Thanks for the patch.
>> I'll try having a look at it tomorrow.
>>    
> 
> Ok, will you let me know, if you found it useful?

This solves a problem caused by extra information that is added after 
the final "end" in the begin/end sequences in a ToUnicode stream?
If so, then the patch is useful, I've added it to the SVN repository,
and added an acknowledgment in the Log Message:

Revision: 4539
           http://itext.svn.sourceforge.net/itext/?rev=4539&view=rev
Author:   blowagie
Date:     2010-07-13 12:02:39 +0000 (Tue, 13 Jul 2010)

Log Message:
-----------
Adding an extra check for begin/end sequences when parsing a ToUnicode 
stream.
Suggestion by Andreas Ebbert-Karroum (mailing list July 12, 2010).
This solves a bug he reported.

Modified Paths:
--------------
     trunk/src/core/com/itextpdf/text/pdf/DocumentFont.java

Modified: trunk/src/core/com/itextpdf/text/pdf/DocumentFont.java
===================================================================
--- trunk/src/core/com/itextpdf/text/pdf/DocumentFont.java      2010-07-13 
11:44:24 UTC (rev 4538)
+++ trunk/src/core/com/itextpdf/text/pdf/DocumentFont.java      2010-07-13 
12:02:39 UTC (rev 4539)
@@ -210,9 +210,18 @@
              PdfContentParser ps = new PdfContentParser(new 
PRTokeniser(touni));
              PdfObject ob = null;
              PdfObject last = null;
-            while ((ob = ps.readPRObject()) != null) {
+            boolean notFound = true;
+            int nestLevel = 0;
+            while ((notFound || nestLevel > 0) && (ob = 
ps.readPRObject()) != null) {
                  if (ob.type() == PdfContentParser.COMMAND_TYPE) {
-                    if (ob.toString().equals("beginbfchar")) {
+                       if (ob.toString().equals("begin")) {
+                               notFound = false;
+                               nestLevel++;
+                       }
+                       else if (ob.toString().equals("end")) {
+                               nestLevel--;
+                       }
+                       else if (ob.toString().equals("beginbfchar")) {
                          int n = ((PdfNumber)last).intValue();
                          for (int k = 0; k < n; ++k) {
                              String cid = 
decodeString((PdfString)ps.readPRObject());


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
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