When running conversion odg->pdf, NPE is thrown (Java)

Hello, we’re running odg->pdf conversion. To test the limits, we’ve created quite a large odg file (in attachment). When running the conversion, Aspose throws NullPointerException:

java.lang.NullPointerException
	at com.aspose.imaging.Image.a(Unknown Source)
	at com.aspose.imaging.Image.a(Unknown Source)
	at com.aspose.imaging.internal.cV.i.b(Unknown Source)
	at com.aspose.imaging.internal.cV.o.a(Unknown Source)
	at com.aspose.imaging.internal.cO.c.a(Unknown Source)
	at com.aspose.imaging.internal.cV.o.d(Unknown Source)
	at com.aspose.imaging.internal.cV.o.a(Unknown Source)
	at com.aspose.imaging.internal.cO.c.a(Unknown Source)
	at com.aspose.imaging.internal.cV.o.d(Unknown Source)
	at com.aspose.imaging.internal.cV.o.a(Unknown Source)
	at com.aspose.imaging.internal.cO.c.c(Unknown Source)
	at com.aspose.imaging.internal.cO.b.cacheData(Unknown Source)
	at com.aspose.imaging.internal.cR.b.b(Unknown Source)
	at com.aspose.imaging.internal.cR.b.a(Unknown Source)
	at com.aspose.imaging.internal.cO.b.a(Unknown Source)
	at com.aspose.imaging.internal.an.I.a(Unknown Source)
	at com.aspose.imaging.internal.an.v.a(Unknown Source)
	at com.aspose.imaging.internal.an.q.a(Unknown Source)
	at com.aspose.imaging.internal.an.q.b(Unknown Source)
	at com.aspose.imaging.internal.an.q.export(Unknown Source)
	at com.aspose.imaging.Image.a(Unknown Source)
	at com.aspose.imaging.L.a(Unknown Source)
	at com.aspose.imaging.internal.mx.b.a(Unknown Source)
	at com.aspose.imaging.internal.mx.c.a(Unknown Source)
	at com.aspose.imaging.Image.save(Unknown Source)
	at com.devfactory.interfax.rendering.fileformat.OdgProcessor.toIntermediateContainer(OdgProcessor.java:46)
	at com.devfactory.interfax.rendering.fileformat.IntermediateProcessor.process(IntermediateProcessor.java:35)

Here’s the code we use. Smaller files are handles fine
:

        var image = Image.load(is);
        final OdgRasterizationOptions rasterizationOptions = new OdgRasterizationOptions();
        //without setting the size, the Apose generates corrupted files
        rasterizationOptions.setPageSize(new SizeF(image.getWidth(), image.getHeight()));

        var outputStream = new ByteArrayOutputStream();
        var options = new PdfOptions();
        options.setVectorRasterizationOptions(rasterizationOptions);
        image.save(outputStream, options);
        return outputStream.toByteArray();

The questions are:

  1. what’s the reason of the failure?
  2. if size of the file, what are the limitation? if some elements aren’t supported, please let us know which.

large-odg.zip (5.8 MB)

@astafev,

I have worked with the sample file shared by you and have observed the issue specified. A ticket with ID IMAGINGJAVA-1701 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

@astafev

Can you please try using latest Aspose.Imaging for Java on your end. Can you please also set the Heap Size to above 2 GB. Please test the following code as well.

try (Image image = Image.load("large-odg.odg"))
{
    final OdgRasterizationOptions rasterizationOptions = new OdgRasterizationOptions();
    rasterizationOptions.setPageSize(new SizeF(image.getWidth(), image.getHeight()));
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    PdfOptions options = new PdfOptions();
    options.setVectorRasterizationOptions(rasterizationOptions);
    image.save(outputStream, options);
}