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

Free Support Forum - aspose.com

Putting a tiff image in a pdf- the file size of pdf increase a lot

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);
}

Hi There,


Thanks for contacting support.

I have tested the scenario with above code using Aspose.Pdf for Java 17.2.0 and have managed to convert TIF to PDF successfully. The resultant PDF document size is 11 KB. I have also attached the PDF document for your reference.

In order to reproduce the problem in our environment, please share which API version of Aspose.Pdf for Java you are using. Also please share details of your environment.

We are sorry for this inconvenience.

Best Regards,