os:ubuntu 20.04
jdk8
maven dependency
junit:junit:jar:4.12:compile
cn.hutool
hutool-all
5.8.9
org.projectlombok
lombok
1.18.20
true
provided
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.file.FileNameUtil;
import com.aspose.cad.Image;
import com.aspose.cad.imageoptions.CadRasterizationOptions;
import com.aspose.cad.imageoptions.PdfOptions;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
@Slf4j
public class WaysToGetThumbnailTest {
@Test
public void replicateProblem(){
String filePath = "/home/Downloads/screenshot/panoramic-elevator.dwg";
byte[] src = FileUtil.readBytes(filePath);
try (ByteArrayInputStream bais = new ByteArrayInputStream(src, 0, src.length);
Image image = Image.load(bais);
) {
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
rasterizationOptions.setPageWidth(1200);
rasterizationOptions.setPageHeight(1200);
PdfOptions options = new PdfOptions();
options.setVectorRasterizationOptions(rasterizationOptions);
image.save("/home/Downloads/screenshot/target/save.pdf",options);
} catch (IOException e) {
log.error("An IOException encountered while rasterizing CAD file ", e);
}
}
}
Error message:
class com.aspose.cad.internal.Exceptions.InvalidOperationException: Cannot read a name from the name table in a font. Debug info: platformID 1, encodingID 20, languageID 0, nameID 1, length 15, offset 923
com.aspose.cad.internal.b.d.a(Unknown Source)
com.aspose.cad.Image.b(Unknown Source)
com.aspose.cad.Image.saveInternal_internalized(Unknown Source)
com.aspose.cad.Image.save(Unknown Source)