Exception from AWAbstractExporter.exportReport() for large svg images


#1

Hi support,

I am using svg images in JasperReports with following properties:

ImageExpression =net.sf.jasperreports.renderers.BatikRenderer.getInstance(new java.net.URI($F{URL}).toURL())
ScaleImage =Retain Shape

I am using following libraries:
jasperreports-6.5.1
aspose-words-java-17.6.0
aspose-words-jasperreports-17.6.0

For some larger svg images (see attached file) I get following error:
java.lang.IllegalArgumentException: Invalid scanline stride
at java.awt.image.ComponentSampleModel.getBufferSize(ComponentSampleModel.java:274)
at java.awt.image.ComponentSampleModel.verify(ComponentSampleModel.java:252)
at java.awt.image.ComponentSampleModel.<init>(ComponentSampleModel.java:170)
at java.awt.image.PixelInterleavedSampleModel.<init>(PixelInterleavedSampleModel.java:87)
at java.awt.image.PixelInterleavedSampleModel.createCompatibleSampleModel(PixelInterleavedSampleModel.java:144)
at javax.imageio.ImageTypeSpecifier.getSampleModel(ImageTypeSpecifier.java:1039)
at javax.imageio.ImageTypeSpecifier.createBufferedImage(ImageTypeSpecifier.java:1072)
at javax.imageio.ImageReader.getDestination(ImageReader.java:2892)
at com.sun.imageio.plugins.png.PNGImageReader.readImage(PNGImageReader.java:1317)
at com.sun.imageio.plugins.png.PNGImageReader.read(PNGImageReader.java:1614)
at javax.imageio.ImageIO.read(ImageIO.java:1448)
at javax.imageio.ImageIO.read(ImageIO.java:1352)
at net.sf.jasperreports.engine.util.JRJdk14ImageReader.readImage(JRJdk14ImageReader.java:51)
at net.sf.jasperreports.engine.util.JRImageLoader.loadAwtImageFromBytes(JRImageLoader.java:161)
at awjr.awjr6.awjr7.a(Unknown Source)
at awjr.awjr7.awjr9.ary(Unknown Source)
at awjr.awjr7.awjr9.<init>(Unknown Source)
at awjr.awjr7.awjr7.a(Unknown Source)
at awjr.awjr7.awjr1.a(Unknown Source)
at awjr.awjr7.awjr1.a(Unknown Source)
at com.aspose.words.jasperreports.AWAbstractExporter.a(Unknown Source)
at com.aspose.words.jasperreports.AWAbstractExporter.exportReport(Unknown Source)
at com.deron.te.bi.report.AsposeBiReportDocxExporter.export(AsposeBiReportDocxExporter.java:99)

When the report is generated using the jasperreports-6.5.1 exporter without Aspose it works.
I get the error also with the library Aspose.Words.JasperReports-19.1.

Is there some workaround for this issue? Do you have a better solution than the BatikRenderer to include svg images in the report? Do you have utilities to test if some svg file may cause problems?

Many thanks for your help.
Dan

Diagram.zip (20.3 KB)


#2

@dan.albutiu

Please use the latest version of Aspose.Words for JasperReports 19.6 and let us know how it goes on your side. If you still face problem, please ZIP and attach your .jrprint file here for testing. We will then investigate the issue and provide you more information on it.


#3

Hi Tahir,

I get the same error also with Aspose.Words for JasperReports 19.6.
Please find attached the zipped .jrprint file.
The used svg image is attached to the initial post.

Many thanks for your support.
Dan

exportSvg.zip (67.5 KB)


#4

@dan.albutiu

We have exported the shared .jrprint file to DOCX using the latest version of Aspose.Words for JasperReports 19.6 and have not faced the shared exception. We have attached the output DOCX with this post for your kind reference.

aw jasperreports 19.6.zip (326.3 KB)


#5

Hi Tahir,

Maybe you are using other parameters for the exporter…
Can you send me please the code you use to configure the exporter?

When I compare 2 pdf files, fist is exported by JRPdfExporter, with second exported by AWDocxExporter and saved as pdf, i see a great difference in the quality of the large diagrams.
See attached files; it is the same report but the sizes of the generated files are also very different.
In this example i reduced the size of the diagram by removing some objects. In this way i was able to export using the AWDocxExporter.

Is there a way how i can manage the quality of svg images by some Aspose parameters?
What is your recommended way to include svg images in the report? Using the Batik renderer?

Many thanks for your support.
Dan

CompareExporterOutputs.zip (565.2 KB)


#6

@dan.albutiu

We did not use any parameters for exporter.

Please share the complete steps that you are using at your end to generate the PDF file. Please also share the code example (source code without compilation errors) here to reproduce your issue at our end. We will investigate the issue and provide you more information on it.