ExtractBookMarks doesn"t run with some Pdf

Hi,

I've got an InvalidCastException in Aspose.Pdf.Kit.dll assembly with a multi-levels bookmarked Pdf. Then i tried with another Pdf (single level bookmark) and it runs without any exception.

Here's the stack if it can help you :

x22bcffa34b42a390.x93baed8933778e80.x41b1a34077c4ae7a(x5bdee61ea12b1569 xccb63ca5f63dc470, Int32 x66bbd7ed8c65740d, IList x9961d01c6815ef17, BookMarks xf69c6c8125cda4f8)
x22bcffa34b42a390.x93baed8933778e80.x2f1891c297bf7100()
Aspose.Pdf.Kit.PdfContentEditor.ExtractBookMarks()

Tom.

Hi,

Thank you for considering Aspose.

Could you please share you code and Pdf document that can reproduce this problem and let us check it.

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team

Here is my code:

Aspose.Pdf.Kit.PdfContentEditor edit = new Aspose.Pdf.Kit.PdfContentEditor();

edit.BindPdf(pdfpath);

Aspose.Pdf.Kit.BookMarks bms = edit.ExtractBookMarks();

But i can't send you the pdf. The file is confidential and too big (50Mb)

Thus i send you another Pdf that does not throw an InvalidCastException, but an ArgumentOutOfRangeException with the same code

Tom.

Hi,

I am able to reproduce this error. I will discuss this with the developers and we will let you know as soon as solution is found.

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team

Hi,

Have you done something about bookmarks extraction ?

Thank you.

Tom.

Hi,

Yes, this bug has been fixed already. Please download the latest version.

Thanks.

Hi,

It's OK with the PDF i had posted previously.

But not with my first post that i had not sent to you because of the document privacy.

I have found out the problem. It seems your bookmark extractor engine don't support "named destinations" (PDF 1.2 feature). That's why it throws an InvalidCastException trying to cast a Named Destination as a Page Destination.

I hope this feature would be added in earlier Aspose.Pdf.Kit versions.

Tom.

Hi,

I am not sure about this issue, kindly if you can send me your pdf document and let me check this issue, so i can discuss this with the developer and will ask if we can support this feature in new version as well. if the size is big, then just split it and then send us that document that can reproduce this error.

Thanks.

Hi,

I've found a PDF that throw the same System.InvalidCastException :

at x22bcffa34b42a390.x93baed8933778e80.x41b1a34077c4ae7a(x5bdee61ea12b1569 xc
cb63ca5f63dc470, Int32 x66bbd7ed8c65740d, IList x9961d01c6815ef17, BookMarks xf6
9c6c8125cda4f8)
at x22bcffa34b42a390.x93baed8933778e80.x2f1891c297bf7100()
at Aspose.Pdf.Kit.PdfContentEditor.ExtractBookMarks()

Please try the PDF at :

http://www.adobe.com/devnet/acrobat/pdfs/pdf_reference_1-7.pdf

Tom.

PS: You would also notice that the process use much resources for a while (100% CPU and up to 620Mb memory used)

Hi,

I am able to reproduce this error with the Pdf file you have mentioned and logged it as issue # PDFKITNET-3921. I will discuss this with the developer and we will let you know as soon as solution is found.

Thanks.

Hi intphant,
I have checked the error, The problem is as you say, Now the bookmark extractor engine don't support "named destinations" . That's why it throws an InvalidCastException trying to cast a Named Destination as a Page Destination.
I will fix this bug in four days.

This bug has been fixed. Please download hotfix 2.6.4.0.

Hi,

Thank you, the bug is fixed. But the process uses too much resources (100% CPU, 600Mb Memory on a 21Mb PDF).

Tom.

We have planed to improve the performance and reduce the memory but I am afraid we can’t finish this task in short time. Sorry for the inconvenience.

Now the bookmark extractor engine don't support "named destinations" . I am using

the java version,I am sure this problem is in java version.

ArrayList bookMarksList=new ArrayList();
bookMarksList=editor.extractBookMarks();

for(int i=0;i<bookMarksList.size();i++){
BookMark bookMark=(BookMark)bookMarksList.get(i);
System.out.print("title:"+bookMark.getTitle()+"\n");
System.out.print("level:"+bookMark.getLevel()+"\n");
System.out.print("action:"+bookMark.getAction()+"\n");
System.out.print("destination:"+bookMark.getDestination()+"\n");

above code can produce below:

java.lang.ClassCastException: com.aspose.pdf.kit.cu cannot be cast to com.aspose.pdf.kit.ft
at com.aspose.pdf.kit.k3.a(Unknown Source)
at com.aspose.pdf.kit.k3.a(Unknown Source)
at com.aspose.pdf.kit.k3.do(Unknown Source)
at com.aspose.pdf.kit.PdfBookMarkEditor.extractBookMarks(Unknown Source)
at samples.contentEditor.ExtractBookMarks.main(ExtractBookMarks.java:23)

Hi Yan,

Thank you very much for considering Aspose.

Can you please share the PDF file you're having problem with? We'll look into the matter at our end and update you accordingly.

Regards,

this is a my test file.

Hi Yan,

I have reproduced the problem at my end and logged it as PDFKITJAVA-9639 in our issue tracking system. Our team will be looking into the matter and you'll be updated as the issue is resolved.

We're sorry for the inconvenience.

Regards,

The issues you have found earlier (filed as 9639) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.