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

Free Support Forum - aspose.com

Decrease Size Of Watermark Image Annotation

I have 50 Kb png image when i added it to 45 KB PDF File by watermarkannotation on first page the size of file will be 80 kb
Is there any way to reduce this size, as when we added this annotation to all pages the size will be approx 230 kb and this is large size
And when we try to add stamp with same image in adobe the size doesnt increase as much as in aspose
this all requirement files in zip
WaterMarkImage Size.zip (146.9 KB)

@NourKhashan

You can please use OptimizeResources() method in order to reduce the file size:

var oo = new Aspose.Pdf.Optimization.OptimizationOptions();
oo.ImageCompressionOptions.ImageQuality = 20;
oo.ImageCompressionOptions.MaxResolution = 100;
oo.ImageCompressionOptions.ResizeImages = true;
oo.ImageCompressionOptions.CompressImages = true;
oo.ImageCompressionOptions.Version = Aspose.Pdf.Optimization.ImageCompressionVersion.Fast;
oo.RemoveUnusedObjects = true;
oo.RemoveUnusedStreams = true;
oo.LinkDuplcateStreams = true;
oo.SubsetFonts = true;
oo.AllowReusePageContent = true;
oo.UnembedFonts = true;

using (Document document = new Document(dataDir + "outputfile.pdf"))
{
 document.OptimizeSize = true;
 document.OptimizeResources(oo);
 document.Save(dataDir + "output" + DateTime.Now.Millisecond + ".pdf");
}

output778.pdf (54.2 KB)

@asad.ali Thanks for ur replay.
Bu I dont want to reduce the file quality.
When we add stamp in adobe with same image and save pdf the size of pdf doesnt increase and the quality of pdf file page doesnt change, so all what i need is the same behaviour after adding watermark annotation

@NourKhashan

Can you please share the similar PDF generated by Adobe Reader at your end? We will further proceed to assist you accordingly.

@asad.ali
The first file we added same image and size is 54 KB and the second one we added default stamp from adobe and size is 42 KB and the resolution and quality of pdf doesnt affect
1- PDF From Adbobe.pdf (54.0 KB)
2- PDF With default stamp from adobe.pdf (41.9 KB)

@NourKhashan

Thanks for providing the sample files. We have logged an investigation ticket as PDFNET-51761 in our issue tracking system to further analyze this case. We will look into details of the logged ticket and let you know as soon as it is resolved. Please be patient and spare us some time.

We are sorry for the inconvenience.