List of usage examples for com.lowagie.text Image setCompressionLevel
public void setCompressionLevel(int compressionLevel)
From source file:questions.compression.CompressionLevelsImage.java
public static void createPdf(int compressionLevel) { try {//from w w w .j av a 2 s.c om Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(RESULT[compressionLevel + 1])); writer.setCompressionLevel(compressionLevel); document.open(); Image img = Image.getInstance(RESOURCE); img.setCompressionLevel(compressionLevel); document.add(img); document.close(); } catch (IOException e) { e.printStackTrace(); } catch (DocumentException e) { e.printStackTrace(); } }