set_image method

set_image(input_file_name, output_file_name, watermark_image_file_name)

Adds Image watermark into the document.

def set_image(self, input_file_name: str, output_file_name: str, watermark_image_file_name: str):
    ...
ParameterTypeDescription
input_file_namestrThe input file name.
output_file_namestrThe output file name.
watermark_image_file_namestrImage that is displayed as a watermark.

set_image(input_file_name, output_file_name, save_format, watermark_image_file_name)

Adds Image watermark into the document.

def set_image(self, input_file_name: str, output_file_name: str, save_format: aspose.words.SaveFormat, watermark_image_file_name: str):
    ...
ParameterTypeDescription
input_file_namestrThe input file name.
output_file_namestrThe output file name.
save_formatSaveFormatThe save format.
watermark_image_file_namestrImage that is displayed as a watermark.

set_image(input_file_name, output_file_name, watermark_image_file_name, options)

Adds Image watermark into the document.

def set_image(self, input_file_name: str, output_file_name: str, watermark_image_file_name: str, options: aspose.words.ImageWatermarkOptions):
    ...
ParameterTypeDescription
input_file_namestrThe input file name.
output_file_namestrThe output file name.
watermark_image_file_namestrImage that is displayed as a watermark.
optionsImageWatermarkOptionsDefines additional options for the image watermark.

set_image(input_file_name, output_file_name, save_format, watermark_image_file_name, options)

Adds Image watermark into the document.

def set_image(self, input_file_name: str, output_file_name: str, save_format: aspose.words.SaveFormat, watermark_image_file_name: str, options: aspose.words.ImageWatermarkOptions):
    ...
ParameterTypeDescription
input_file_namestrThe input file name.
output_file_namestrThe output file name.
save_formatSaveFormatThe save format.
watermark_image_file_namestrImage that is displayed as a watermark.
optionsImageWatermarkOptionsDefines additional options for the image watermark.

Examples

Shows how to insert watermark image to the document.

doc = MY_DIR + 'Document.docx'
watermark_image = IMAGE_DIR + 'Logo.jpg'
aw.lowcode.Watermarker.set_image(input_file_name=doc, output_file_name=ARTIFACTS_DIR + 'LowCode.SetWatermarkImage.1.docx', watermark_image_file_name=watermark_image)
aw.lowcode.Watermarker.set_image(input_file_name=doc, output_file_name=ARTIFACTS_DIR + 'LowCode.SetWatermarkText.2.docx', save_format=aw.SaveFormat.DOCX, watermark_image_file_name=watermark_image)
options = aw.ImageWatermarkOptions()
options.scale = 50
aw.lowcode.Watermarker.set_image(input_file_name=doc, output_file_name=ARTIFACTS_DIR + 'LowCode.SetWatermarkText.3.docx', watermark_image_file_name=watermark_image, options=options)
aw.lowcode.Watermarker.set_image(input_file_name=doc, output_file_name=ARTIFACTS_DIR + 'LowCode.SetWatermarkText.4.docx', save_format=aw.SaveFormat.DOCX, watermark_image_file_name=watermark_image, options=options)

See Also