File Size Grows by a big margin after adding watermark

We are adding a Text watermark on a PDF File using the BindLogo method. After the watermark is added, the file size grows exponentially.

Original File: ~90 KB. After Watermarking: ~230 KB

Original File: ~3 MB . After Watermarking: ~44 MB

We have tried the option to Optimize the file after adding the watermark but that does not makes a difference.

Is it possible to restrict this exponential growth ?

Hi Sanjay,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for the details.

Please share your sample code, template and resultant files to help us regenerate the issue. We will check it and get back to you soon. Also, please let us know which version of Aspose.Pdf for .NET you are using.

Sorry for the inconvenience,

Hi,

Sorry for the delay. Sanjay is on leave so I will be responding instead.

Below is the code sample we are using to append watermark


mem = new MemoryStream();
PdfFileStamp fileStamp = new PdfFileStamp(stream, mem);

Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp();
if (!String.IsNullOrEmpty(Id))
{
FormattedText text = new FormattedText(Id.ToUpper(), System.Drawing.Color.Gray, FontStyle.Helvetica, EncodingType.Winansi, true, 17);
stamp.BindLogo(text);
stamp.Opacity = 0.3F;

stamp.SetOrigin(widthLeft, height);
stamp.Rotation = 90.0F;
stamp.IsBackground = true;
fileStamp.AddStamp(stamp);
fileStamp.Close();
}

Document doc = new Document(mem);
doc.Metadata[Constants.PdfMetadataKey] = Id;
MemoryStream mem1 = new MemoryStream();
doc.Save(mem1);
mem.Dispose();
return mem1;

In the above code, "stream" is System.IO.Stream object which contains the PDF File and "Id" is the string we want to add as Watermark.

PDF File attached for reference.

Thanks

Apoorv Gupta

Hi Apoorv,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the template file and sample code.

We have found your mentioned issue after an intial test using your shared template file and sample code. Your issue has been registered in our issue tracking system with issue id: PDFNEWNET-32572. We will notify you via this forum thread regarding the update against your issue.

Sorry for the inconvenience caused,

We have the same issue with Aspose.PDF.Facades version 6.8.0.0.

We need a solution for that as soon as possible!!!

Daniel

Hi Apoorv,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Please download and try the latest version of Aspose.Pdf for .NET v6.8 as I tested and your reported issue is fixed in this new release. Please do let us know if you still face any issue.

Sorry for the inconvenience,

Hi Daniel,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Please share your template file and sample code with us. This will help us identify the cause of the issue soon.

Thank You & Best Regards,