Extracting text from a DXF File - missing CadBaseEntity class

I am following the example in the knowledge base:

When running the example, I get this missing symbol error:

ReadTest.java:[25,49] cannot find symbol
  symbol:   class CadBaseEntity
  location: package com.aspose.cad.fileformats.cad.cadobjects

My pom.xml includes this dependency:

    <dependency>
        <groupId>com.aspose</groupId>
        <artifactId>aspose-cad</artifactId>
        <version>23.10</version>
   </dependency>

Note: that I can successfully open DXF file with your library. It appears that 23.10 does not include the CadBaseEntity class. When I test with 23.12 I get an additional error because both ImageOptionsBase and CadBaseEntity are not included:

cannot find symbol
[ERROR]   symbol:   class ImageOptionsBase
[ERROR]   location: package com.aspose.cad
cannot find symbol
[ERROR]   symbol:   class CadBaseEntity
[ERROR]   location: package com.aspose.cad.fileformats.cad.cadobjects

My program uses the suggested imports:

import com.aspose.cad.Image;
import com.aspose.cad.License;
import com.aspose.cad.fileformats.cad.CadImage;
import com.aspose.cad.fileformats.cad.cadconsts.CadEntityTypeName;
import com.aspose.cad.fileformats.cad.cadobjects.CadBaseEntity;
import com.aspose.cad.fileformats.cad.cadobjects.CadText;
import com.aspose.cad.ImageOptionsBase;

What is the recommended version to use to get the knowledge base example to work correctly with the Java version?

@approveapples,
Hi.
We recommend to use the latest available version. Infortunately, we have some changes in public API since that knowledge base example was created. Please try to use CadEntityBase instead of CadBaseEntity, and ImageOptionsBase from com.aspose.cad.imageoptions.

Thank you for the suggestions. With the newer API provided in 23.12 the example is working as expected.

1 Like

@approveapples,
glad to hear it works now :slight_smile: