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 -> 18.104.22.168
Aspose.Pdf -> 22.214.171.124
Test document attached.
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.
Aspose.Words acquired and are interested in acquiring Aspose.PDF and Aspose.Cells, the effect of watermark is important for our clients.
Is this working in any solution?
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:
Thanks for the answer, but I do not see any document attached. Are You could re-attach it?
Sorry, try it now in the previous post.
The example of the watermark in the PDF document would be valid.
With this solution, if a customer inserts a watermark in a Word document, convert it to a PDF, can get a watermark like the example?
If so, if I would be useful.
How could obtain this result?
Thanks and Regards,
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:
<Image File="D:\_Klepus\Aspose\user_files\juamurex_watermark\PruebaA-my.001.png" Opacity="0.15" Type="png" IsImageNotFoundErrorIgnored="true" ZIndex="-1" FixWidth="270" FixHeight="196.5" />
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.
Ok, I try to implement this solution as you implement the new property.
I would be interested in being notified when implemented property.
Thank you for your prompt response and assistance.
Yes, we’ll notify you here in the thread. Forum threads are linked with issues in the defect database for that purpose.
The issues you have found earlier (filed as 4861) have been fixed in this update.