Re: extract text from a PDF file with JAVA
"Sergio" <boser87@hotmail.com> wrote in message
news:1154543880.477999.211030@i3g2000cwc.googlegroups.com...
[OP has a CastClassException on line 427, actual class type is String]
Please show the parse method of the file com.etymon.pj.PdfParser. Be
sure to include line 427.
- Oliver
As you've requested here is the parse method of the file
com.etymon.pj.PdfParser.
It's quite long...the line 427 is the return instruction at the end of
method.
Thanks again.
public static PjObject parse(Pdf pdf, RandomAccessFile raf, long[][]
xref, byte[] data, int start)
[...]
Stack stack = new Stack();
[...]
stack.push(state._streamToken);
[...]
byte[] stream = (byte[])(stack.pop());
PjStreamDictionary pjsd = new PjStreamDictionary(
((PjDictionary)(stack.pop())).getHashtable());
PjStream pjs = new PjStream(pjsd, stream);
stack.push(pjs);
[...]
/*line 427*/ return (PjObject)(stack.pop());
This code is extremely messy in that it pops all sorts of different type
objects into the stack object. I wouldn't be surprised if this were
generated code instead of hand written.
If this is your code, you've got a bug and you need to fix it. If it's
someone else's code, then you should write up an SSCCE demonstrating the bug
and submit it to then. See http://mindprod.com/jgloss/sscce.html
- Oliver