Free Support Forum - aspose.com

PDF file is not being watermarked using aspose.pdf

Hi,

We are facing a issue in watermarking pdf files using functionality given in aspose.pdf and aspose.pdf.kit

Some of the pdf files are being watermarked while others are not.

Please let us know why this is happening as we are unable to trace the issue.

Please find below the code snippet, we are using to watermark a pdf file:

Aspose.Pdf.Kit.License pdfKitLicense = new Aspose.Pdf.Kit.License();
pdfKitLicense.SetLicense("Aspose.Total.lic");
Aspose.Pdf.License pdfLicense = new Aspose.Pdf.License();
pdfLicense.SetLicense("Aspose.Total.lic");
PdfFileStamp fileStamp = new PdfFileStamp(sourceFile, watermarkedOutputPath);
Stamp watermarkStamp = new Stamp();
Watermark oWatermark = new Watermark(AdamContext.Current.AdamApplication);
oWatermark.Load("MyWatermark2");
string imagePath = oWatermark.Image.GetPath();
using (System.IO.Stream stream = new System.IO.FileStream(imagePath, System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite, System.IO.FileShare.Read))
{
watermarkStamp.BindImage(stream);
watermarkStamp.SetOrigin(90, 400);
watermarkStamp.Rotation = 360;
watermarkStamp.Opacity = float.Parse("0.5");
fileStamp.AddStamp(watermarkStamp);
fileStamp.Close();
}

Hi Kundan,


Thanks for your inquiry. Could you please share a sample Pdf document, that is not being watermarked? So we will test it at our end and will provide you more information accordingly.

Sorry for the inconvenience faced.

Best Regards,

Hi,

Thanks for your reply.

Please find attached the sample pdf file, that is not being watermarked.

Awaiting your reply.

Hi Kundan,


Thanks
for using our products.<o:p></o:p>

I have tested the scenario and I am able to reproduce the same problem. For the sake of correction, I have logged it in our issue tracking system as PDFNEWNET-35126. We will investigate this issue in details and will keep you updated on the status of a correction.

We apologize for your inconvenience.

Hi,

We have an urgent deliverable this week and need to resolve this issue.

Please provide your response asap.

Hi Kundan,

Sorry for the inconvenience faced. I’m afraid we can’t share an ETA at the moment. As we have recently noticed the issue and your issue is pending in queue for analysis. Once analysis phase completes then we will be in good position to confirm you ETA. However I’ve shared your concerns with development team. Please spare us some time.

Thanks for your patience and cooperation.

Best Regards,

Hi Kundan,


Thanks for your patience.

We have further investigated the issue reported earlier and as per our observations, the document which you have shared has a page size (461, 339).

24 0 obj

<<

/MediaBox [0.0 0.0 461.528 339.638]

/Type /Page

/BleedBox [12.4961 12.4961 449.031 327.142]

/Contents 25 0 R

/CropBox [0.0 0.0 461.528 339.638]

/Resources <</Font <</T1_2 26 0 R

/T1_1 13 0 R

/T1_0 14 0 R

>>



But in your code snippet, you have tried to put stamp at position (90, 400)

watermarkStamp.SetOrigin(
90, 400);



Therefore the stamp is out of visible page area. In order to make the stamp visible, customer may
just change SetOrigin() parameters.



For example:

watermarkStamp.SetOrigin(90, 90);
<o:p></o:p>

The issues you have found earlier (filed as PDFNEWNET-35126) have been fixed in Aspose.Pdf for .NET 8.0.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.