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

Free Support Forum - aspose.com

CompressionLevel does not work

Hi,

I’m glad I found Aspose pdf. I find it very easy to get started and actually create a pdf.

I’m using the free trial of Aspose.pdf and have stumbled on a problem. I have attached images to my pdf, but when creating the pdf, I can clearly see compression artifacts. I have tried pdf.setCompressionLevel() using both 0 and 9 as input. There is however no visual difference in the resulting pdf and the file size remains unchanged.

Is this perhaps a limitation in the free trial, or are there other ways of controlling the compression?

My code:

File f1 = new File(“1.png”);
java.awt.Image i = loadImage(“2.png”);

Pdf pdf1 = new Pdf();
pdf1.setCompressionLevel(0); // I have tried both 0 and 9 here with no result
pdf1.setIsLandscape(true);

Section sec1 = pdf1.getSections().add();
Image image1 = new aspose.pdf.Image(sec1);
sec1.getParagraphs().add(image1);
image1.getImageInfo().setFile(f1.getAbsolutePath());
image1.getImageInfo().setImageFileType(ImageFileType.Png);

Section sec2 = pdf1.getSections().add();
Image image2 = new aspose.pdf.Image(sec2);
sec2.getParagraphs().add(image2);
image2.getImageInfo().setSystemImage(i);

try{
System.out.println("saving using compression: " + pdf1.getCompressionLevel());
pdf1.save(“test.pdf”);
System.out.println(“pdf written”);
}catch(RuntimeException e){
JOptionPane.showMessageDialog(null, e.getMessage(), “Error saving”, JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
}

Hello Mikael,

Thanks for considering our products.

I have tested the scenario and I’m able to reproduce the same problem. I have logged it in our issue tracking system as PDFJAVA-14936. We will investigate this issue in details and will keep you updated on the status of a correction.

The trial version provides the same features as present in the license one, except for the evaluation watermark in the resultant PDF. You can also get a 30 days temporary license. For more information, please visit How to get a Temporary License

We apologize for your inconvenience.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for the help!
I don’t suppose there is a ‘work around’ for this?

How long do you think it will be until a problem like this one is resolved? (weeks, months, years?)
I know it is difficult to make an estimate, but we need to know since we have to decide whether to go for your product or find another solution.

Hello Mikael,

Before we've analyzed this issue and have gone through its details, I'm afraid it's pretty hard to share the ETA. I will check with the development team and once they have any updates regarding its resolution/ETA date, I will let you know.

Please be patient and spare us little time. We will try our level best to get it resolved, ASAP.

Thanks for your cooperation and understanding.