Dear all,
Hi,
Thanks for using our products.
I have tested the scenario where I have used one of my sample PDF document and have tried adding Image and Text watermark over it using the code snippet which you have shared earlier and as per my observations, both watermarks are properly appearing. I wonder that the problem seems to be related to the source PDF file which you are using. Can you please share the resource file so that we can test the scenario at our end. We are sorry for your inconvenience.
PS, I have tested the scenario with upcoming release version of Aspose.Pdf for .NET 7.3.0. Also please share some details regarding the problem you are facing.
Hi… please find .pdf as enclosed…
Hi,
I have tested the scenario using Aspose.Pdf for .NET 7.2.0 where I have tried adding a sample Image and Text watermark (using the same code snippet which you have shared earlier) and as per my observations, both watermarks are properly appearing on resultant file. Please take a look over the third page of attached PDF file.
Hi,
Hi,
Thanks for sharing the details.
In my previous post, I meant to say that the text appearing over the Bottom-Left of page is Text watermark which is added using TextStamp class. Whereas the image appearing over the Bottom-Right is not watermark image as its added to page contents using XImage object. In case you need to add an image as a watermark, you may consider using ImageStamp class. Besides this, I think you are still not comfortable with the current approach of adding Image/Text to PDF file because they are appearing as normal objects. You may consider following the approach specified over
- Add Image Stamp on All Pages in a PDF File (Facades)
- Add Text Stamp on All Pages in a PDF File (Facades)
because when using above approach, you can specify that either the Watermark will appear as background or not.
Now concerning to the exception that you are facing, please share the sample project. You may consider removing Aspose.PDF for .NET from project as it will reduce the size of archive. We are sorry for your inconvenience.
PS, Please do let us know the version of Aspose.PDF for .NET which you are using
Hi Thanks,
Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Thank you for sharing the sample application.
I tested your application with the latest version of Aspose.Pdf for .NET v7.2 and I am unable to reproduce the exception you are getting. I think you may be using some older version of Aspose.Pdf for .NET. I would suggest you to upgrade to the latest version of Aspose.Pdf for .NET and let us know whether it works fine for you.
Also, you may change you code regarding the image stamp with the below mentioned code to get your desired results.
Document pdfDocument = new Document(pdffile);
//create footer
ImageStamp imageStamp = new ImageStamp("aspose-logo.jpg");
//set properties of the stamp
imageStamp.BottomMargin = 10;
imageStamp.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Right;
imageStamp.VerticalAlignment = VerticalAlignment.Bottom;
pdfDocument.Pages[pdfDocument.Pages.Count].AddStamp(imageStamp);
You may also check the following link for details:
Adding Image in Footer of PDF File
Please feel free to contact support in case you need any further assistance.
Thank You & Best Regards,
Thanks, but how to display imageStamp on the center of the page?
please ignore it …
it01:Thanks, but how to display imageStamp on the center of the page?
imageStamp.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Center;<o:p></o:p>
imageStamp.VerticalAlignment = Aspose.Pdf.VerticalAlignment.Center;
In case you need any further information, please feel free to contact.