1

I'm trying to search text from pdf file and get page number. My code look like this:

    DocumentUtil.applyAsposeWordLicense();
    DocumentUtil.applyAsposePdfLicense();
    com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(".....Kontoeroeffnung.pdf");
    // Accept the absorber for all the pages
    String localeTitle = Ivy.cms().findContentObjectValue(AbsDocumentConstant.BASIC_CONTRACT_TITLE, Locale.GERMAN).getContentAsString();
    TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber(String.format("(?i)%s", "Online-Kontoeröffnung"), new TextSearchOptions(true));
    pdfDocument.getPages().accept(textFragmentAbsorber);

But I got this exception, I try to figure out what happened, but this library is closed source and error message don't have enough information:

Caused by: java.lang.IllegalStateException: Resource file /com/aspose/pdf/engine/commondata/text/cmaps/PredefinedCMaps/ not found in assembly
    at com.aspose.pdf.internal.p650.z2.m7(Unknown Source)
    at com.aspose.pdf.internal.p650.z2.m4(Unknown Source)
    at com.aspose.pdf.internal.p651.z2.m2(Unknown Source)
    at com.aspose.pdf.internal.p651.z2.<init>(Unknown Source)
    at com.aspose.pdf.internal.p652.z1.m4(Unknown Source)
    at com.aspose.pdf.internal.p652.z7.<init>(Unknown Source)
    at com.aspose.pdf.internal.p652.z1.<init>(Unknown Source)
    at com.aspose.pdf.internal.p652.z3.<init>(Unknown Source)
    at com.aspose.pdf.internal.p651.z8.m1(Unknown Source)
    at com.aspose.pdf.internal.p654.z29.m28(Unknown Source)
    at com.aspose.pdf.internal.p657.z6.m1(Unknown Source)
    at com.aspose.pdf.internal.p657.z9.m4(Unknown Source)
    at com.aspose.pdf.internal.p657.z9.<init>(Unknown Source)
    at com.aspose.pdf.internal.p657.z6.m1(Unknown Source)
    at com.aspose.pdf.internal.p657.z11.m1(Unknown Source)
    at com.aspose.pdf.internal.p657.z11.m3(Unknown Source)
    at com.aspose.pdf.internal.p657.z11.m7(Unknown Source)
    at com.aspose.pdf.internal.p657.z11.m7(Unknown Source)
    at com.aspose.pdf.internal.p657.z13.m1(Unknown Source)
    at com.aspose.pdf.internal.p657.z13.m1(Unknown Source)
    at com.aspose.pdf.internal.p657.z13.m6(Unknown Source)
    at com.aspose.pdf.internal.p657.z13.<init>(Unknown Source)
    at com.aspose.pdf.internal.p657.z13.<init>(Unknown Source)
    at com.aspose.pdf.TextFragmentAbsorber.visit(Unknown Source)
    at com.aspose.pdf.Page.accept(Unknown Source)
    at com.aspose.pdf.PageCollection.accept(Unknown Source)
    at ch.axonivy.fintech.abs.document.utils.DocumentUtil.fucking(DocumentUtil.java:214)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at ch.ivyteam.ivy.scripting.internal.types.IvyJavaMethod.invokeImpl(IvyJavaMethod.java:73)

Anyone have the same problem with me?

Luong Dinh
  • 569
  • 4
  • 17
  • Would you please mind sharing the PDF file which you are using for text search and also some information regarding your working environment. They will help us to test the scenario and we will be able to share our findings. My name is Nayyer and I am developer evangelist at Aspose. – codewarior Aug 14 '17 at 21:16
  • @codewarior I can't share PDF, but that seems the problem of environment. I tried it on my college computer, it's work well. But the root cause still is the magic. – Luong Dinh Aug 15 '17 at 02:40
  • @Luoung, From above code snippet and stacktrace, it appears that you are trying to search non-English content inside the document but we cannot be entirely certain about the reasons of issue, unless we test and replicate it in our environment. However can you please share some further information regarding your test environment. PS, you may double check the specific system configurations and local language culture settings on both system. – codewarior Aug 17 '17 at 07:19

0 Answers0