google-code-export / purepdf

Automatically exported from code.google.com/p/purepdf
2 stars 1 forks source link

Problem with getInfo #4

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I have the error below using this project :

----------------------
----------------------
TypeError: Error #1009: Il est impossible d'accéder à la propriété ou à la
méthode d'une référence d'objet nul.
    at org.purepdf.io::RandomAccessFileOrArray/get
length()[/Users/alessandro/Documents/Workspaces/Flash/Opensource/purePDF/src/org
/purepdf/io/RandomAccessFileOrArray.as:97]
    at
org.purepdf.pdf::PdfReader/readPdf()[/Users/alessandro/Documents/Workspaces/Flas
h/Opensource/purePDF/src/org/purepdf/pdf/PdfReader.as:308]
    at
FileManager/init/finDuChargement()[D:\ServeurWindows\www\flex\FileManager\src\Fi
leManager.mxml:51]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()

//strange reference to /Users/Alessandro...
----------------------
----------------------
And here is my code.
"public function init():void{

var adresse:URLRequest = new
URLRequest("http://localhost/flex/FileManager/bin-debug/fichiers/copyrelem/CALED
ONIE2004_01.pdf");

var loader:URLLoader = new URLLoader ();
loader.addEventListener(Event.COMPLETE, finDuChargement);
loader.load( adresse );
//until here, all his working, next i don't know what's going wrong             
function finDuChargement (event:Event):void
    {

//var pdf: ByteArray = URLLoader(event.target).data as ByteArray;
var pdf: ByteArray = loader.data as ByteArray;
var reader: PdfReader = new PdfReader( pdf );
reader.addEventListener( Event.COMPLETE, onReadComplete );
reader.readPdf();

function onReadComplete(event:Event):void
                    {
var map: HashMap = reader.getInfo();
for( var iterator: Iterator = map.keySet().iterator(); iterator.hasNext(); )
                        {
var key: String = iterator.next();
zoneText.text += key + ": " + map.getValue( key ) ;
                        }
                    }"

Original issue reported on code.google.com by samuel.i...@gmail.com on 1 Jun 2010 at 11:34

GoogleCodeExporter commented 9 years ago
* which version of purepdf are you using?
* can you send me the pdf file you're using to to reproduce this bug?

Original comment by alessand...@gmail.com on 3 Jun 2010 at 6:46

GoogleCodeExporter commented 9 years ago
* i've just downloaded the current online version
* below the attached file you asked for.

Original comment by samuel.i...@gmail.com on 5 Jun 2010 at 4:41

Attachments:

GoogleCodeExporter commented 9 years ago
Hi! What's up ?

* Did you find one issue? 
* Is it possible to extract swc to have readable/writable purePDF's files?

Original comment by samuel.i...@gmail.com on 14 Jun 2010 at 1:18

GoogleCodeExporter commented 9 years ago
Hello!

Did you test your library with the posted file?

Thanks!

Sincerely,
Sam

Original comment by samuel.i...@gmail.com on 5 Jul 2010 at 12:48

GoogleCodeExporter commented 9 years ago
I have the exact same problem. Flash Builder 4/Mac os X

Original comment by arild.li...@gmail.com on 7 Jul 2010 at 7:37

GoogleCodeExporter commented 9 years ago
I have downloaded Samuels PDF and loaded it with purepdf. I have the following 
output on the console. There are error messages and an error dialog but the 
application continues to run:

readXRefStream: 61
readXRefStream: 10
TypeError: Error #1034: Type Coercion failed: cannot convert 
Vector.<int>@5efffb1 to org.purepdf.pdf.PdfObject.
Error #2044: Unhandled error:. text=number of entries in this xref subsection 
not found

I'm using Flex 4.1 SDK (build 16076) in an AIR application on Windows XP with 
purePDF of May 27th.

The errors seem to refer to the getInfo method. As I posted earlier on the 
mailing list I had other problems with this method. It seems to very much 
depend on the PDF you are reading whether you get an error or not. I can't, 
however, really understand what's going on.

Regards,
Thilo

Original comment by thilo.ra...@gmail.com on 8 Sep 2010 at 10:00

GoogleCodeExporter commented 9 years ago
I know about this problem, but PDFReader isn't completed at all yet.

Original comment by alessand...@gmail.com on 14 Jan 2011 at 11:31

GoogleCodeExporter commented 9 years ago
OK, let me know when you'll fix it!
And thanks for this tool! 

Original comment by samuel.i...@gmail.com on 14 Jan 2011 at 12:56

GoogleCodeExporter commented 9 years ago
Hi all,

I faced the error #1304 issue and tried to solved it, since the Coercition 
Failed Error is just a cast issue.
Alessandro, you should replace the offending line :
index.add( Vector.<int>( [ 0, size ] ) );
with :
index.add(new PdfNumber(0));
index.add(new PdfNumber(size));

Since PDFArray (the index variable) expect PDFObjects and not a Vector instance.

I can send you a patch about it.

Hope this helps !
Bruno

PS : Looks like the code in the trunk is a little bit unstable :-( I had to 
replace some file.readInt() with file.readByte() to make the code works as the 
official release.

Original comment by bruno.ma...@gmail.com on 3 Jun 2011 at 8:40