I have a Word document that I am attempting to convert to PDF using the Aspose.Pdf component.
The problem is that when you convert the document, the watermark included in the PDF document has no transparency.
I am using the following versions:
Aspose.Words -> 5.1.0.0
Aspose.Pdf -> 3.6.2.0
Test document attached.
Hello!
Thank you for your inquiry.
Unfortunately image effects such as watermark, brightness and contrast are not supported. This issue is known as #1154 – Picture effects are not supported when exporting to PDF.
As a workaround you can preprocess the image before inserting it to the document. Sorry for inconvenience.
Regards,
Hello!
We probably can do something for this case. Aspose.Pdf supports image opacity. It is specified as Opacity attribute for Image element as a floating number between 0 and 1. Less values correspond to more image transparency. I tried setting different values and stuck on Opacity=“0.15”. See the intermediate XML in the attachment, almost at the very end. Also I’m attaching the PDF that I get as a result. Since the background behind the image is white fractional opacity visually affects brightness.
Using this approach the watermark becomes a bit different from the original. Seemingly MS Word applies some color transform, not only changes brightness. But this is what we can support relatively fast, without the need of preprocessing the image inside Aspose.Words or requesting changes in Aspose.Pdf. If this solution suits your needs then I will implement it.
Note that from document design point it is better to put watermarks in the header, not in the main story. Watermarks placed in the header are completely independent from the main content.
Also you can try the approach described in Aspose.Pdf documentation to achieve watermark effect: https://docs.aspose.com/pdf/net/adding-multi-line-watermark-to-existing-pdf/
Regards,
Hello again.
As I mentioned, this can be implemented relatively fast. I need to write one more attribute to the intermediate XML. You can work-around this immediately by inserting Opacity programmatically after the conversion. I’ll show the fragment of the previously attached XML and what is needed to be inserted:
If you are keen on regular expressions this wouldn’t be a problem. In both cases this will take effect on document conversion result on your customer’s side.
I have created a new issue in our defect database: #4861 – Implement Watermark image effect via Opacity attribute in PDF
We’ll notify you on any progress or when it is implemented.
Regards,
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.