Cannot read property 'mg' of undefined

29 views
Skip to first unread message

Samuele Panarotto

unread,
Feb 4, 2015, 11:57:03 AM2/4/15
to pdfnet-w...@googlegroups.com
Good morning,

today, after many test, without change the source code, suddenly I get this error:

Cannot read property 'mg' of undefined

The error points at line 781 of CoreControl.js, but I can't understand the reason of this type of error.

Could you please help me?

Thank you.

Matt Parizeau

unread,
Feb 4, 2015, 8:04:14 PM2/4/15
to pdfnet-w...@googlegroups.com
Hi Samuele,

This might be because you're trying to load an annotation on a page number that doesn't exist in the document that's loaded. If you're saving annotations using the default annotationHandler.php and not specifying a documentId then when you save annotations from one document it will load those same annotations when you open another document.

So if you saved an annotation on page 10 and then opened a 5 page document and try to load that annotation back in you might see this error. To stop this you should specify a unique documentId for each document or just clear out the saved annotations while testing different documents.

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Samuele Panarotto

unread,
Feb 5, 2015, 3:54:57 AM2/5/15
to pdfnet-w...@googlegroups.com
Hi Matt,

the problem is that the document is 74 page and the annotation (added with PDFBox are at page 2).

Until yesterday, everything worked well, until it started to give me this errors.

Thank you

Matt Parizeau

unread,
Feb 5, 2015, 3:08:54 PM2/5/15
to pdfnet-w...@googlegroups.com
Hi Samuele,

Would it be possible to send us the XFDF file as it seems like the error may be occurring when loading that file. Or if the annotation is internal to the XOD then just the XOD file.

Matt Parizeau
Software Developer
PDFTron Systems Inc.
Reply all
Reply to author
Forward
0 new messages