set_text method
Contents
[
Hide
]set_text(input_file_name, output_file_name, watermark_text)
Adds Text watermark into the document.
def set_text(self, input_file_name: str, output_file_name: str, watermark_text: str):
...
Parameter | Type | Description |
---|---|---|
input_file_name | str | The input file name. |
output_file_name | str | The output file name. |
watermark_text | str | Text that is displayed as a watermark. |
set_text(input_file_name, output_file_name, save_format, watermark_text)
Adds Text watermark into the document.
def set_text(self, input_file_name: str, output_file_name: str, save_format: aspose.words.SaveFormat, watermark_text: str):
...
Parameter | Type | Description |
---|---|---|
input_file_name | str | The input file name. |
output_file_name | str | The output file name. |
save_format | SaveFormat | The save format. |
watermark_text | str | Text that is displayed as a watermark. |
set_text(input_stream, output_stream, save_format, watermark_text)
Adds Text watermark into the document.
def set_text(self, input_stream: io.BytesIO, output_stream: io.BytesIO, save_format: aspose.words.SaveFormat, watermark_text: str):
...
Parameter | Type | Description |
---|---|---|
input_stream | io.BytesIO | The input stream. |
output_stream | io.BytesIO | The output stream. |
save_format | SaveFormat | The save format. |
watermark_text | str | Text that is displayed as a watermark. |
set_text(input_file_name, output_file_name, watermark_text, options)
Adds Text watermark into the document.
def set_text(self, input_file_name: str, output_file_name: str, watermark_text: str, options: aspose.words.TextWatermarkOptions):
...
Parameter | Type | Description |
---|---|---|
input_file_name | str | The input file name. |
output_file_name | str | The output file name. |
watermark_text | str | Text that is displayed as a watermark. |
options | TextWatermarkOptions | Defines additional options for the text watermark. |
set_text(input_file_name, output_file_name, save_format, watermark_text, options)
Adds Text watermark into the document.
def set_text(self, input_file_name: str, output_file_name: str, save_format: aspose.words.SaveFormat, watermark_text: str, options: aspose.words.TextWatermarkOptions):
...
Parameter | Type | Description |
---|---|---|
input_file_name | str | The input file name. |
output_file_name | str | The output file name. |
save_format | SaveFormat | The save format. |
watermark_text | str | Text that is displayed as a watermark. |
options | TextWatermarkOptions | Defines additional options for the text watermark. |
set_text(input_stream, output_stream, save_format, watermark_text, options)
Adds Text watermark into the document.
def set_text(self, input_stream: io.BytesIO, output_stream: io.BytesIO, save_format: aspose.words.SaveFormat, watermark_text: str, options: aspose.words.TextWatermarkOptions):
...
Parameter | Type | Description |
---|---|---|
input_stream | io.BytesIO | The input stream. |
output_stream | io.BytesIO | The output stream. |
save_format | SaveFormat | The save format. |
watermark_text | str | Text that is displayed as a watermark. |
options | TextWatermarkOptions | Defines additional options for the text watermark. |
Examples
Shows how to insert watermark text to the document.
doc = MY_DIR + 'Big document.docx'
watermark_text = 'This is a watermark'
aw.lowcode.Watermarker.set_text(input_file_name=doc, output_file_name=ARTIFACTS_DIR + 'LowCode.WatermarkText.1.docx', watermark_text=watermark_text)
aw.lowcode.Watermarker.set_text(input_file_name=doc, output_file_name=ARTIFACTS_DIR + 'LowCode.WatermarkText.2.docx', save_format=aw.SaveFormat.DOCX, watermark_text=watermark_text)
watermark_options = aw.TextWatermarkOptions()
watermark_options.color = aspose.pydrawing.Color.red
aw.lowcode.Watermarker.set_text(input_file_name=doc, output_file_name=ARTIFACTS_DIR + 'LowCode.WatermarkText.3.docx', watermark_text=watermark_text, options=watermark_options)
aw.lowcode.Watermarker.set_text(input_file_name=doc, output_file_name=ARTIFACTS_DIR + 'LowCode.WatermarkText.4.docx', save_format=aw.SaveFormat.DOCX, watermark_text=watermark_text, options=watermark_options)
Shows how to insert watermark text to the document from the stream.
watermark_text = 'This is a watermark'
with system_helper.io.FileStream(MY_DIR + 'Document.docx', system_helper.io.FileMode.OPEN, system_helper.io.FileAccess.READ) as stream_in:
with system_helper.io.FileStream(ARTIFACTS_DIR + 'LowCode.WatermarkTextStream.1.docx', system_helper.io.FileMode.CREATE, system_helper.io.FileAccess.READ_WRITE) as stream_out:
aw.lowcode.Watermarker.set_text(input_stream=stream_in, output_stream=stream_out, save_format=aw.SaveFormat.DOCX, watermark_text=watermark_text)
with system_helper.io.FileStream(ARTIFACTS_DIR + 'LowCode.WatermarkTextStream.2.docx', system_helper.io.FileMode.CREATE, system_helper.io.FileAccess.READ_WRITE) as stream_out:
options = aw.TextWatermarkOptions()
options.color = aspose.pydrawing.Color.red
aw.lowcode.Watermarker.set_text(input_stream=stream_in, output_stream=stream_out, save_format=aw.SaveFormat.DOCX, watermark_text=watermark_text, options=options)
See Also
- module aspose.words.lowcode
- class Watermarker