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

Free Support Forum - aspose.com

Compressing pdfs in java

Hi Aspose Team,
Could you please let us know how can I compress a pdf that is generated using Aspose.Words.
is there any compression technique available in aspose.pdf kit for java.
I could see some info for .NET in your help documents but no info provided for Java implementation.

Please help us on the above.

Thanks
Ganesh

Hi Ganesh,

You may use the setCompressionLevel method of the Settings class to set the compression of the PDF file. The compression level values range from 0 to 9. Please use the following code:


Settings.setCompressionLevel(4);

PdfFileStamp stamp=new PdfFileStamp(“input.pdf”,“output.pdf”);

stamp.close();


I hope this helps. If you find any further questions, please do let us know.
Regards,