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

Free Support Forum - aspose.com

Bar-Chart Display Error

Hi,

Our bar-charts is not showing up, below is the screen shots:

Current result:
image.png (180.5 KB)

Expected result:
image.jpg (147.9 KB)

Below is our code:
try {
com.aspose.pdf.Document pdfDoc = new Document(pagePDFPath);
java.io.OutputStream imageStream = new FileOutputStream(imagePath);
com.aspose.pdf.devices.Resolution resolution = new Resolution(200);
JpegDevice jpegDevice = new JpegDevice(resolution, 60);
jpegDevice.process(pdfDoc.getPages().get_Item(1), imageStream);
imageStream.close();
pdfDoc.close();
gotImage.set(true);
} catch (Exception ex) {
ex.printStackTrace();
}

Library we are using:
import com.aspose.pdf.Document;
import com.aspose.pdf.devices.JpegDevice;
import com.aspose.pdf.devices.Resolution;

Please let me know if you need more info, thanks.

@mdispensa

Could you please share your sample PDF document with us so that we can test the scenario in our environment and address it accordingly.

Example-Chart-Data.pdf (99.1 KB)
I am sharing a sample pdf with you

@mdispensa

We were unable to notice the issue while using Aspose.PDF for Java 20.7. Please check attached output image. Please try using latest version of the API and if issue still persists, let us know.
Converted_Image_2.jpg (101.0 KB)

Can you share your sample code here?

@mdispensa

Following is the complete sample code which we used:

try {
            Document pdfDocument = new Document(dataDir + "Example-Chart-Data.pdf");
            for (Page page : pdfDocument.getPages()) {
                java.io.OutputStream imageStream = new java.io.FileOutputStream(dataDir + "Converted_Image_" + page.getNumber() + ".jpg");
                com.aspose.pdf.devices.Resolution resolution = new com.aspose.pdf.devices.Resolution(200);
                com.aspose.pdf.devices.JpegDevice jpegDevice = new com.aspose.pdf.devices.JpegDevice(resolution, 60);
                jpegDevice.process(page, imageStream);
                imageStream.close();
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }