Re: [iText-questions] '' not expected at file pointer 558

2010-07-13 Thread Andreas Ebbert-Karroum
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?

Thanks,
Andreas

--
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/


Re: [iText-questions] '' not expected at file pointer 558

2010-07-13 Thread Bruno Lowagie
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=4539view=rev
Author:   blowagie
Date: 2010-07-13 12:02:39 + (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/


Re: [iText-questions] '' not expected at file pointer 558

2010-07-13 Thread Andreas Ebbert-Karroum
Hi,

Am 13.07.2010 14:08, schrieb Bruno Lowagie:
 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:

Great, thanks.

Continuous improvement ... one little step after the other :)

Andreas

--
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/


Re: [iText-questions] '' not expected at file pointer 558

2010-07-12 Thread Andreas Ebbert-Karroum
Hi,

so far I have not received a reply to my question. If I can provide you 
with more detail or background, what do you still need to know? Or has 
the question already been answered somewhere? I'm also willing to patch 
iText myself, when I get a rough hint how and where.

We're currently blocked with our automated acceptance tests, since we 
cannot process the generated PDFs.

Thanks,
Andreas

Am 08.07.2010 18:18, schrieb Andreas Ebbert-Karroum:
 Hi,

 I'd like to discuss the problem again, that was mentioned in those 
 posts on the mailing list:

 http://itext-general.2136553.n4.nabble.com/Inline-image-parsing-issue-td2260626.html
  

 http://itext-general.2136553.n4.nabble.com/Re-not-expected-at-file-pointer-23512-td2172514.html
  


 When I try to parse a PDF that opens nicely in Acrobat Reader, I'm 
 getting an exception InvalidPdfException: '' not expected at file 
 pointer 558  (see further down for full stack strace).

 What can I do about it? Can I fix the PDF in some way? how? Can I 
 patch the itext-5.0.2 sources somehow? Although it seems that this is 
 a known problem, I couldn't find a bug a request for enhancement in 
 the tracker on sourceforge. Shall I create one?

 Thanks for your help,

 Andreas Ebbert-Karroum,

 Full stacktrace:

 ExceptionConverter: com.itextpdf.text.exceptions.InvalidPdfException: 
 '' not expected at file pointer 558
 at com.itextpdf.text.pdf.PRTokeniser.throwError(PRTokeniser.java:197)
 at com.itextpdf.text.pdf.PRTokeniser.nextToken(PRTokeniser.java:332)
 at 
 com.itextpdf.text.pdf.PdfContentParser.nextValidToken(PdfContentParser.java:194)
  

 at 
 com.itextpdf.text.pdf.PdfContentParser.readPRObject(PdfContentParser.java:164)
  

 at 
 com.itextpdf.text.pdf.DocumentFont.fillMetrics(DocumentFont.java:209)
 at 
 com.itextpdf.text.pdf.DocumentFont.processType0(DocumentFont.java:165)
 at com.itextpdf.text.pdf.DocumentFont.init(DocumentFont.java:146)
 at 
 com.itextpdf.text.pdf.CMapAwareDocumentFont.init(CMapAwareDocumentFont.java:79)
  

 at 
 com.itextpdf.text.pdf.parser.PdfContentStreamProcessor$SetTextFont.invoke(PdfContentStreamProcessor.java:591)
  

 at 
 com.itextpdf.text.pdf.parser.PdfContentStreamProcessor.invokeOperator(PdfContentStreamProcessor.java:226)
  

 at 
 com.itextpdf.text.pdf.parser.PdfContentStreamProcessor.processContent(PdfContentStreamProcessor.java:380)
  

 at 
 com.itextpdf.text.pdf.parser.PdfReaderContentParser.processContent(PdfReaderContentParser.java:41)
  

 at 
 com.itextpdf.text.pdf.parser.PdfTextExtractor.getTextFromPage(PdfTextExtractor.java:73)
  

 at 
 com.itextpdf.text.pdf.parser.PdfTextExtractor.getTextFromPage(PdfTextExtractor.java:88)
  




--
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/


Re: [iText-questions] '' not expected at file pointer 558

2010-07-12 Thread 1T3XT info
Andreas Ebbert-Karroum wrote:
 Hi,
 
 so far I have not received a reply to my question. If I can provide you 
 with more detail or background, what do you still need to know? Or has 
 the question already been answered somewhere? I'm also willing to patch 
 iText myself, when I get a rough hint how and where.
 
 We're currently blocked with our automated acceptance tests, since we 
 cannot process the generated PDFs.

Is this about inline images?
Is this about a font dictionary that can't be parsed?
Is this about the SNAPSHOT version (5.0.3) or about iText 5.0.2?
What PDF file is giving the problem?

Note that the PDF parsing functionality is very new,
and there are already multiple changes in the SVN repository
that may or may not have solved the problem.

--
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/


Re: [iText-questions] '' not expected at file pointer 558

2010-07-12 Thread Andreas Ebbert-Karroum
Hi,

Am 12.07.2010 09:16, schrieb 1T3XT info:
 Is this about inline images?

Maybe? I'm getting the error message as I posted in the stack trace. How 
can I analyze from that, what particular part is causing that error?
 Is this about a font dictionary that can't be parsed?

How can I tell?
 Is this about the SNAPSHOT version (5.0.3) or about iText 5.0.2?

I'm using

dependency
groupIdcom.itextpdf/groupId
artifactIditextpdf/artifactId
version5.0.2/version
/dependency

Happy to try the snapshot. I'm currently checking out the subversion 
trunk. Is the snapshot also deployed to some repository?
 What PDF file is giving the problem?


I'm sending it to you in a private E-Mail.

Thanks for taking a look!

Andreas Ebbert-Karroum

--
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/


Re: [iText-questions] '' not expected at file pointer 558

2010-07-12 Thread 1T3XT info
Andreas Ebbert-Karroum wrote:
 Maybe?

You'll have to check.

 I'm getting the error message as I posted in the stack trace. How 
 can I analyze from that, what particular part is causing that error?
  How can I tell?

Look inside the PDF document.

 Happy to try the snapshot. I'm currently checking out the subversion 
 trunk. Is the snapshot also deployed to some repository?

No, the version in SVN changes on a regular basis.
It's a working version that can be broken from time to time;
although we try to avoid this: a continuous integration tools
informs us about problems every time we commit something.

 I'm sending it to you in a private E-Mail.

I'm sorry:
1. I don't have access to that mailbox right now
(I'm answering through the news group)
2. We only look at private PDFs if they are sent by customers.

--
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/


Re: [iText-questions] '' not expected at file pointer 558

2010-07-12 Thread Andreas Ebbert-Karroum
Hi,

Am 12.07.2010 09:47, schrieb 1T3XT info:
 Andreas Ebbert-Karroum wrote:

 Maybe?
  
 You'll have to check.


I'd love to :) I already installed a trial version of Adobe Acrobat Pro. 
There's a content tool in Acrobat which allowed me to delete some parts 
of the document, which were images (although they were displayed as 
text, which could be selected...). After I removed them, the error is 
gone. Now ... I'm new to the specs of a PDF, but I think this is what 
you refer to as an inline image, but I'm not 100% sure. That's why I 
said: maybe.

 I'm getting the error message as I posted in the stack trace. How
 can I analyze from that, what particular part is causing that error?
  
 How can I tell?

 Look inside the PDF document.

This might sound like a stupid question for you, but until two days ago, 
PDFs where just something I viewed with a program like Foxit or Acrobat 
Reader. Are there some nice tools to debug a PDF?

 Happy to try the snapshot. I'm currently checking out the subversion
 trunk. Is the snapshot also deployed to some repository?
  
 No, the version in SVN changes on a regular basis.
 It's a working version that can be broken from time to time;
 although we try to avoid this: a continuous integration tools
 informs us about problems every time we commit something.


I've just compiled from the trunk and the error is still occuring.

Andreas

--
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/


Re: [iText-questions] '' not expected at file pointer 558

2010-07-12 Thread Andreas Ebbert-Karroum
Hi,

Am 12.07.2010 09:47, schrieb 1T3XT info:
 I'm getting the error message as I posted in the stack trace. How
 can I analyze from that, what particular part is causing that error?
  
 How can I tell?

 Look inside the PDF document.


Maybe this helps:

I've debugged into PRTokenizer and dumped the content of the arrayIn in 
RandomAccessFileOrArray:

/CIDInit /ProcSet findresource begin
12 dict begin
/CIDSystemInfo

/Registry (Adobe)
/Ordering (UCS)
/Supplement 0
 
def
/CMapName /Adobe-Identity-UCS def
/CMapType 2 def
1 begincodespacerange
 
endcodespacerange
16 beginbfchar0003
  0020
 0025
  0042
 0027
  0044
 0028
  0045
 002C
  0049
 0035
  0052
 0038
  0055
 0044
  0061
 0046
  0063
 0048
  0065
 004A
  0067
 004B
  0068
 0051
  006E
 0055
  0072
 0057
  0074
 0058
  0075
 endbfchar
endcmap CMapName currentdict /CMap defineresource pop end end
D
 00p

The byte array has a length of 561 and the error occurs after reading 
byte 558. When I look into the sources of PRTokeniser, this looks 
surprising to me, as it seems to throw the error, when there are two 
consecutive '' characters, but there's only one. The bytes starting 
from 540 are, with the offending byte marked in 60:

99, 101, 32, 112, 111, 112, 32, 101, 110, 100, 32, 101, 110, 100, 13, 
68, 13, 62, 60, 48, 48, 112

Does that help to undestand the problem further?

Andreas

--
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/


Re: [iText-questions] '' not expected at file pointer 558

2010-07-12 Thread Andreas Ebbert-Karroum
Am 12.07.2010 10:48, schrieb Andreas Ebbert-Karroum:

 endbfchar
 endcmap CMapName currentdict /CMap defineresource pop end end
 D
 00p

 The byte array has a length of 561 and the error occurs after reading 
 byte 558. When I look into the sources of PRTokeniser, this looks 
 surprising to me, as it seems to throw the error, when there are two 
 consecutive '' characters, but there's only one. The bytes starting 
 from 540 are, with the offending byte marked in 60:

 99, 101, 32, 112, 111, 112, 32, 101, 110, 100, 32, 101, 110, 100, 13, 
 68, 13, 62, 60, 48, 48, 112

 Does that help to undestand the problem further?

I start to have the suspicion that there's something funny with the 
decompression of the stream going on. Semantically the stream should end 
after the end end as shown above, but there are some extra characters. 
Also other objects show that behaviour, but only in this particular 
stream, there's a single '' which cannot be processed. I assume that 
according to the spec, there should be no extra characters in the 
deflated stream content, but I'm wondering how they got in there in the 
first place. The PDF was generated with Adobe CS (I think ... we got it 
from a customer), filled some form fields with iText and then flattened.

58 0 obj
/Filter/FlateDecode/Length 305stream
0001A960E  48 89 5C 91 4D 6E C3 20-10 85 4F C0 1D 58 A6 8B
0001A961E  C8 7F C1 4E 25 CB 52 9A-B4 92 17 FD 51 DD 1E C0
0001A962E  86 71 8A 54 63 84 C9 C2-B7 2F 66 46 59 14 09 A1
0001A963E  4F F3 DE 30 3C 92 73 7B-69 8D F6 3C F9 70 B3 EC
0001A964E  C0 F3 51 1B E5 60 99 6F-4E 02 1F E0 AA 0D CB 72
0001A965E  AE B4 F4 44 49 B0 74 EB-E2 61 6A CD 38 B3 BA 66
0001A966E  C9 67 28 2C DE AD 7C 77-52 F3 00 0F 2C 79 77 0A
0001A967E  9C 36 57 BE FB 3E 77 81-BB 9B B5 BF 30 81 F1 3C
0001A968E  65 4D C3 14 8C A1 D1 6B-6F DF FA 09 78 12 6D FB
0001A969E  56 85 BA F6 EB 3E 78 F8-5D F1 B5 5A E0 79 E4 0C
0001A96AE  47 90 B3 82 C5 F6 12 5C-6F AE C0 EA 34 AC 86 D7
0001A96BE  2F 61 35 0C 8C FA 57 CF-4A B4 0D A3 FC E9 DD A6
0001A96CE  2E 58 90 A7 69 1E 46 D9-0E 81 78 C8 11 2B C2 03
0001A96DE  E2 91 50 20 9E 09 1F 23-16 E4 15 E8 2D 48 2C 50
0001A96EE  BC B5 D8 B0 CC 10 4B C2-02 91 C4 25 89 4F 84 15
0001A96FE  E2 13 E1 31 A2 C8 08 9F-11 E9 DE 0A EF 15 34 73
0001A970E  85 33 0B EA 5C 05 55 C8-03 1F 1E 93 99 7A CB EF
0001A971E  B1 CB 9B 73 21 F1 F8 B7-31 EA 2D 64 6D E0 FE FD
0001A972E  76 B6 3C B8 B6 CD 2E B1-B3 FD 13 60 00 2C 07 97
0001A973E  1C 0D 0A
endstream
endobj

or as byte[]:

[72, -119, 92, -111, 77, 110, -61, 32, 16, -123, 79, -64, 29, 88, -90, 
-117, -56, 127, -63, 78, 37, -53, 82, -102, -76, -110, 23, -3, 81, -35, 
30, -64, -122, 113, -118, 84, 99, -124, -55, -62, -73, 47, 102, 70, 89, 
20, 9, -95, 79, -13, -34, 48, 60, -110, 115, 123, 105, -115, -10, 60, 
-7, 112, -77, -20, -64, -13, 81, 27, -27, 96, -103, 111, 78, 2, 31, -32, 
-86, 13, -53, 114, -82, -76, -12, 68, 73, -80, 116, -21, -30, 97, 106, 
-51, 56, -77, -70, 102, -55, 103, 40, 44, -34, -83, 124, 119, 82, -13, 
0, 15, 44, 121, 119, 10, -100, 54, 87, -66, -5, 62, 119, -127, -69, 
-101, -75, -65, 48, -127, -15, 60, 101, 77, -61, 20, -116, -95, -47, 
107, 111, -33, -6, 9, 120, 18, 109, -5, 86, -123, -70, -10, -21, 62, 
120, -8, 93, -15, -75, 90, -32, 121, -28, 12, 71, -112, -77, -126, -59, 
-10, 18, 92, 111, -82, -64, -22, 52, -84, -122, -41, 47, 97, 53, 12, 
-116, -6, 87, -49, 74, -76, 13, -93, -4, -23, -35, -90, 46, 88, -112, 
-89, 105, 30, 70, -39, 14, -127, 120, -56, 17, 43, -62, 3, -30, -111, 
80, 32, -98, 9, 31, 35, 22, -28, 21, -24, 45, 72, 44, 80, -68, -75, -40, 
-80, -52, 16, 75, -62, 2, -111, -60, 37, -119, 79, -124, 21, -30, 19, 
-31, 49, -94, -56, 8, -97, 17, -23, -34, 10, -17, 21, 52, 115, -123, 51, 
11, -22, 92, 5, 85, -56, 3, 31, 30, -109, -103, 122, -53, -17, -79, -53, 
-101, 115, 33, -15, -8, -73, 49, -22, 45, 100, 109, -32, -2, -3, 118, 
-74, 60, -72, -74, -51, 46, -79, -77, -3, 19, 96, 0, 44, 7, -105, 28]

Not sure if this is still of interest to the others, who are subscribed 
to the mailing list/group. I hope I don't annoy anybody. With the 
knowledge, I could now probably fix that particular document, but 
there's the risk, that the next document will show the same problems, so 
we need to address the earlier steps to avoid the problem.

Thanks for your attention,

Andreas

--
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/


Re: [iText-questions] '' not expected at file pointer 558

2010-07-12 Thread 1T3XT info
Andreas Ebbert-Karroum wrote:
 Not sure if this is still of interest to the others, who are subscribed 
 to the mailing list/group. I hope I don't annoy anybody. With the 
 knowledge, I could now probably fix that particular document, but 
 there's the risk, that the next document will show the same problems, so 
 we need to address the earlier steps to avoid the problem.

It's interesting information, so please keep us posted on the list.
Unfortunately, we all have jobs, and we can't always answer questions
like this right away, but we'll look into it.

--
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/


Re: [iText-questions] '' not expected at file pointer 558

2010-07-12 Thread Andreas Ebbert-Karroum
Hi,

Am 12.07.2010 14:00, schrieb 1T3XT info:
 Andreas Ebbert-Karroum wrote:

 Not sure if this is still of interest to the others, who are subscribed
 to the mailing list/group. I hope I don't annoy anybody. With the
 knowledge, I could now probably fix that particular document, but
 there's the risk, that the next document will show the same problems, so
 we need to address the earlier steps to avoid the problem.
  
 It's interesting information, so please keep us posted on the list.
 Unfortunately, we all have jobs, and we can't always answer questions
 like this right away, but we'll look into it.


Ok :)

I've now patched the current trunk, it works for me with my limited 
understanding of PDF, etc. Maybe you want to consider it. If it stumbles 
over a begin/end pair it counts the nested levels, and stops as soon as 
the last 'end' is reached.

Index: src/core/com/itextpdf/text/pdf/DocumentFont.java
===
--- src/core/com/itextpdf/text/pdf/DocumentFont.java(revision 4536)
+++ src/core/com/itextpdf/text/pdf/DocumentFont.java(working copy)
@@ -210,8 +210,18 @@
  PdfContentParser ps = new PdfContentParser(new 
PRTokeniser(touni));
  PdfObject ob = null;
  PdfObject last = null;
-while ((ob = ps.readPRObject()) != null) {
+boolean foundBegin = false;
+int nestLevel = 0;
+while ((nestLevel0 || !foundBegin)  (ob = 
ps.readPRObject()) != null) {
  if (ob.type() == PdfContentParser.COMMAND_TYPE) {
+
+if (ob.toString().equals(begin)) {
+foundBegin = true;
+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) {

Andreas

--
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/


Re: [iText-questions] '' not expected at file pointer 558

2010-07-12 Thread 1T3XT info
Andreas Ebbert-Karroum wrote:
 I've now patched the current trunk, it works for me with my limited 
 understanding of PDF, etc. Maybe you want to consider it.

Certainly! Thanks for the patch.
I'll try having a look at it tomorrow.
-- 
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info

--
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/


[iText-questions] '' not expected at file pointer 558

2010-07-08 Thread Andreas Ebbert-Karroum
Hi,

I'd like to discuss the problem again, that was mentioned in those posts 
on the mailing list:

http://itext-general.2136553.n4.nabble.com/Inline-image-parsing-issue-td2260626.html
http://itext-general.2136553.n4.nabble.com/Re-not-expected-at-file-pointer-23512-td2172514.html

When I try to parse a PDF that opens nicely in Acrobat Reader, I'm 
getting an exception InvalidPdfException: '' not expected at file 
pointer 558  (see further down for full stack strace).

What can I do about it? Can I fix the PDF in some way? how? Can I patch 
the itext-5.0.2 sources somehow? Although it seems that this is a known 
problem, I couldn't find a bug a request for enhancement in the tracker 
on sourceforge. Shall I create one?

Thanks for your help,

Andreas Ebbert-Karroum,

Full stacktrace:

ExceptionConverter: com.itextpdf.text.exceptions.InvalidPdfException: 
'' not expected at file pointer 558
 at com.itextpdf.text.pdf.PRTokeniser.throwError(PRTokeniser.java:197)
 at com.itextpdf.text.pdf.PRTokeniser.nextToken(PRTokeniser.java:332)
 at 
com.itextpdf.text.pdf.PdfContentParser.nextValidToken(PdfContentParser.java:194)
 at 
com.itextpdf.text.pdf.PdfContentParser.readPRObject(PdfContentParser.java:164)
 at 
com.itextpdf.text.pdf.DocumentFont.fillMetrics(DocumentFont.java:209)
 at 
com.itextpdf.text.pdf.DocumentFont.processType0(DocumentFont.java:165)
 at com.itextpdf.text.pdf.DocumentFont.init(DocumentFont.java:146)
 at 
com.itextpdf.text.pdf.CMapAwareDocumentFont.init(CMapAwareDocumentFont.java:79)
 at 
com.itextpdf.text.pdf.parser.PdfContentStreamProcessor$SetTextFont.invoke(PdfContentStreamProcessor.java:591)
 at 
com.itextpdf.text.pdf.parser.PdfContentStreamProcessor.invokeOperator(PdfContentStreamProcessor.java:226)
 at 
com.itextpdf.text.pdf.parser.PdfContentStreamProcessor.processContent(PdfContentStreamProcessor.java:380)
 at 
com.itextpdf.text.pdf.parser.PdfReaderContentParser.processContent(PdfReaderContentParser.java:41)
 at 
com.itextpdf.text.pdf.parser.PdfTextExtractor.getTextFromPage(PdfTextExtractor.java:73)
 at 
com.itextpdf.text.pdf.parser.PdfTextExtractor.getTextFromPage(PdfTextExtractor.java:88)


--
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/