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

Free Support Forum - aspose.com

CGM to PDF - issue when converting

When converting CGM files to PDF I get the following error:
image.png (8.8 KB)

Using this code:
CgmImportOptions options = new CgmImportOptions();
PdfProducer.produce(inputPath, ImportFormat.Cgm, outputPath);

Using - aspose-imaging-20.4-jdk16.jar

Please can you tell me if the code that I have is correct, if it is not correct please could you supply me with the right code so that I can convert from CGM to PDF. Thanks.

Here is an example CGM file that I used:
example.zip (11.9 KB)


We used following code snippet with Aspose.PDF for Java 20.6 and were unable to notice the exception that you shared.

CgmLoadOptions options = new CgmLoadOptions();
Document doc = new Document(dataDir + "file_example_SVG_20kB.cgm", options);
doc.save(dataDir + "output.pdf");

output.pdf (13.7 KB)

Would you please try to use above code snippet with latest version of the API. In case you still face any issue, please feel free to let us know.

Thank you for the code snippet, converting from CGM to PDF now successfully works.

1 Like