Hey, my organization is really interested in GroupsDocs.Watermark package (primarily in Python language), so we’re testing it right now to see whether it’s suitable for our needs.
Current issue which we’re trying to solve is connected to adding watermark to docx files. Our expected result is to have same multiline tile watermark as we’ve made in pdf and few other file extensions using GroupsDocs.Watermark library.
That’s how watermark in pdf looks like.
Screenshot 2024-11-18 at 17.38.57.jpg (94.8 KB)
The code for it was taken from your github repo with only just few adjustments. We’re testing latest python build (24.9.1) on macos / windows
import groupdocs.watermark as gw
import groupdocs.watermark.watermarks as gww
USER_EMAIL = 'useremail@mail.com'
FILE_ID = '86f71790-2573-4a04-935f-3c83c3079a47'
DISCLAIMER = 'Confidential - Do not distribute - Subject to NDA'
def main():
document_path = 'input.pdf'
output_document_path = 'output.pdf'
with gw.Watermarker(document_path) as watermarker:
font = gww.Font('Helvetica', 10.0)
watermark = gww.TextWatermark(f'{USER_EMAIL}\n{FILE_ID}\n{DISCLAIMER}', font)
watermark.foreground_color = gww.Color.gray
watermark.opacity = 0.4
watermark.rotate_angle = -45.0
watermark.text_alignment = gww.TextAlignment.CENTER
line_spacing = gww.MeasureValue()
line_spacing.measure_type = gww.TileMeasureType.POINTS
line_spacing.value = 100.0
watermark_spacing = gww.MeasureValue()
watermark_spacing.measure_type = gww.TileMeasureType.POINTS
watermark_spacing.value = 30.0
watermark.tile_options = gww.TileOptions()
watermark.tile_options.line_spacing = line_spacing
watermark.tile_options.watermark_spacing = watermark_spacing
watermarker.add(watermark)
watermarker.save(output_document_path)
if __name__ == '__main__':
aspose_license = gw.License()
aspose_license.set_license('GroupDocs.WatermarkforPythonvia.NET.lic')
main()
In case I’m trying to use this code for the .docx files, the result is unacceptable and usually looks like this. As you can see on the screenshot, multiline watermark is not displayed properly and even first row (user_email parameter) is not displayed fully. Font size could not be set to less that 24. That’s reproducible not only for multiline tile watermarks, for usual one watermark per file this result is kinda same.
Screenshot 2024-11-18 at 17.47.21.png (381.1 KB)
So, questions are next:
- Is it possible to implement multiline tile watermark pattern in .docx files using python library or any other language? If yes, can you share some ideas of implementation / fixes for this?
- How stable and long-term supported is python version of the library? Should we consider moving to C# one or python version also will have periodical updates?
Thanks for your response in advance!