Watermarker.SetText

Watermarker SetText method. Adds Text watermark into the document.

SetText(string, string, string)

Adds Text watermark into the document.

public static void SetText(string inputFileName, string outputFileName, string watermarkText)
ParameterTypeDescription
inputFileNameStringThe input file name.
outputFileNameStringThe output file name.
watermarkTextStringText that is displayed as a watermark.

Remarks

If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.

If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.

Examples

Shows how to add text watermark in the document.

Watermarker.SetText(MyDir + "Simple.docx", ArtifactsDir + "Watermarker.SetText.docx", "Wordize");

See Also


SetText(string, string, string, TextWatermarkOptions)

Adds Text watermark into the document.

public static void SetText(string inputFileName, string outputFileName, string watermarkText, 
    TextWatermarkOptions options = null)
ParameterTypeDescription
inputFileNameStringThe input file name.
outputFileNameStringThe output file name.
watermarkTextStringText that is displayed as a watermark.
optionsTextWatermarkOptionsDefines additional options for the text watermark.

Remarks

If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.

If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.

Examples

Shows how to add text watermark in the document with custom text watermark options.

TextWatermarkOptions textWatermarkOptions = new TextWatermarkOptions();
textWatermarkOptions.FontFamily = "Arial";
textWatermarkOptions.FontSize = 48;
textWatermarkOptions.IsSemitrasparent = false;
textWatermarkOptions.Color = Color.Red;
textWatermarkOptions.Layout = WatermarkLayout.Horizontal;

Watermarker.SetText(MyDir + "Simple.docx", ArtifactsDir + "Watermarker.SetText.pdf", "Wordize", textWatermarkOptions);

See Also


SetText(string, string, SaveFormat, string, TextWatermarkOptions)

Adds Text watermark into the document.

public static void SetText(string inputFileName, string outputFileName, SaveFormat saveFormat, 
    string watermarkText, TextWatermarkOptions options = null)
ParameterTypeDescription
inputFileNameStringThe input file name.
outputFileNameStringThe output file name.
saveFormatSaveFormatThe save format.
watermarkTextStringText that is displayed as a watermark.
optionsTextWatermarkOptionsDefines additional options for the text watermark.

Remarks

If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.

If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.

Examples

Shows how to add text watermark in the document with custom text watermark options and save result in explicitly set save format.

TextWatermarkOptions textWatermarkOptions = new TextWatermarkOptions();
textWatermarkOptions.Color = Color.Red;

Watermarker.SetText(MyDir + "Simple.docx", ArtifactsDir + "Watermarker.SetText.xps", SaveFormat.Xps, "Wordize", textWatermarkOptions);

See Also


SetText(Stream, Stream, SaveFormat, string, TextWatermarkOptions)

Adds Text watermark into the document.

public static void SetText(Stream inputStream, Stream outputStream, SaveFormat saveFormat, 
    string watermarkText, TextWatermarkOptions options = null)
ParameterTypeDescription
inputStreamStreamThe input stream.
outputStreamStreamThe output stream.
saveFormatSaveFormatThe save format.
watermarkTextStringText that is displayed as a watermark.
optionsTextWatermarkOptionsDefines additional options for the text watermark.

Remarks

If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), only the first page of the output will be saved to the specified stream.

If the output format is TIFF, the output will be saved as a single multi-frame TIFF to the specified stream.

Examples

Shows how to add text watermark in the document using streams.

TextWatermarkOptions textWatermarkOptions = new TextWatermarkOptions();
textWatermarkOptions.Color = Color.Red;

using (Stream input = File.OpenRead(MyDir + "Simple.docx"))
using (Stream output = File.Create(ArtifactsDir + "Watermarker.SetText.rtf"))
{
    Watermarker.SetText(input, output, SaveFormat.Rtf, "Wordize", textWatermarkOptions);
}

See Also