Kaija
Kaija

Reputation: 11

iTextSharp, Why when creating a PDF file size is 2 times larger than the original folder with images?

I need the finished PDF file to be 30% smaller than the original image folder.

There is a folder with images in tiff format. Then I add one image per page (Doc = new document (), etc.), the resulting document size is equal to the size of the image folder. But after passing the doc.Close() PDF file size increased two times (so I use compression PDF later and then the file is approximately equal to the folder), but I need the finished PDF file to be 30% smaller than the original image folder.

Upvotes: 0

Views: 647

Answers (1)

Robin Bennett
Robin Bennett

Reputation: 3231

Most image formats are already compressed, so they won't compress any more. PDFs usually compress because they're mostly text, but one that is mostly images won't.

Also, compression routines usually assume that the data is suitable for compression. If you give them pre-compressed data, the result can be a larger file. It's hard to tell exactly what happened without seeing your files, but I guess that's the reason.

If you want a smaller file, you'll have to reduce the amount of information in your images. Crop them, reduce the colour depth, increase the compression or reduce the number of images.

Upvotes: 2

Related Questions