We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

TextFragmentAbsorber accept linux error & aspose pdf java

i work on aspose pdf 18.1 version

TextFragmentAbsorber accept error null point exception

  • window and mac no problem

but linux centos error

    Document document = new Document(fileServerProperties.getBasePath() + pdfStyleProperties.getTemplatePath());

    String directoryPath = fileServerProperties.getBasePath() + pdfStyleProperties.getFontPath();

    File file = new File(directoryPath);
    if (file.isDirectory()) {
        System.out.println("font File is a Directory");
    }
    else {
        System.out.println("font Directory doesn't exist!!");
    }

    com.aspose.pdf.Document.addLocalFontPath(fileServerProperties.getBasePath() + pdfStyleProperties.getFontPath());

    TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber("\\#[a-zA-Z0-9\\s\\.]+\\#"); // like
    TextSearchOptions textSearchOptions = new TextSearchOptions(true);
    textFragmentAbsorber.setTextSearchOptions(textSearchOptions);

    try {
        **document.getPages().accept(textFragmentAbsorber); <<<----**
    } catch (Exception e) {
        e.printStackTrace();
    }

how can i using on success

@yhkim

Could you please make sure that all Windows fonts are present in the Linux system? Please try to install msttcorefonts package and check again. In case issue still persists, please share your sample PDF document with us so that we can also try to replicate the issue at our end and address it accordingly.

PS: Please use 21.7 version of the API as it is the latest one and has maximum improvements and fixes.