Hi, we are trying to convert an SVG file to a jpeg/png file using JpegDevice/PngDevice, but it seems to be rendering the gradient incorrectly.
We are using this SVG image gradient_svg_image.zip (1.7 KB)
we have used the below code:
//“this.source” is the data of the SVG file in String.
SvgLoadOptions options = new SvgLoadOptions();
com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(
new ByteArrayInputStream(this.source.getBytes()), options);
ByteArrayOutputStream imageStream = new ByteArrayOutputStream();
Resolution resolution = new Resolution(this.height.intValue(), this.width.intValue());
JpegDevice jpegDevice = new JpegDevice(750, 472, resolution, this.res.intValue());// resolution,
// this.res.intValue());
jpegDevice.setCropRectangle(new Rectangle(0, 0, 562, 353));
jpegDevice.process(pdfDocument.getPages().get_Item(1), imageStream);
return imageStream.toByteArray();
Please let us know what seems to be the problem, or if there is anything that we can do differently.