The tiff file is 9KB, but after I put in a pdf, the file size of the pdf is 338K.
Is there any way I can reduce the size?
Here is the code:
public static void embeddedImageInPdf(String imagefile, String out) {
Document document = null;
try {
Image image = new Image();
image.setFile(imagefile);
document = new Document();
addImageToPdf(document, image);
document.save(out);
} catch (Exception e) {
} finally {
if (document != null) {
document.close();
}
}
}
protected static void addImageToPdf(Document document, Image image) throws Exception {
Page p = document.getPages().add();
p.getParagraphs().add(image);
}