Watermarker.SetImage
SetImage(string, string, string)
Adds Image watermark into the document.
public static void SetImage(string inputFileName, string outputFileName,
string watermarkImageFileName)
Parameter | Type | Description |
---|---|---|
inputFileName | String | The input file name. |
outputFileName | String | The output file name. |
watermarkImageFileName | String | Image 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 image watermark into the document.
Watermarker.SetImage(MyDir + "Simple.docx", ArtifactsDir + "Watermarker.SetImage.docx", MyDir + @"Images\logo.png");
See Also
- class Watermarker
- namespace Wordize.Watermarking
- assembly Wordize
SetImage(string, string, string, ImageWatermarkOptions)
Adds Image watermark into the document.
public static void SetImage(string inputFileName, string outputFileName,
string watermarkImageFileName, ImageWatermarkOptions options = null)
Parameter | Type | Description |
---|---|---|
inputFileName | String | The input file name. |
outputFileName | String | The output file name. |
watermarkImageFileName | String | Image that is displayed as a watermark. |
options | ImageWatermarkOptions | Defines additional options for the image 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 image watermark into the document with custom watermark options.
ImageWatermarkOptions imageWatermarkOptions = new ImageWatermarkOptions();
imageWatermarkOptions.Scale = 0.1;
imageWatermarkOptions.IsWashout = true;
Watermarker.SetImage(MyDir + "Simple.docx", ArtifactsDir + "Watermarker.SetImage.doc", MyDir + @"Images\logo.png", imageWatermarkOptions);
See Also
- class ImageWatermarkOptions
- class Watermarker
- namespace Wordize.Watermarking
- assembly Wordize
SetImage(string, string, SaveFormat, string, ImageWatermarkOptions)
Adds Image watermark into the document.
public static void SetImage(string inputFileName, string outputFileName, SaveFormat saveFormat,
string watermarkImageFileName, ImageWatermarkOptions options = null)
Parameter | Type | Description |
---|---|---|
inputFileName | String | The input file name. |
outputFileName | String | The output file name. |
saveFormat | SaveFormat | The save format. |
watermarkImageFileName | String | Image that is displayed as a watermark. |
options | ImageWatermarkOptions | Defines additional options for the image 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 image watermark into the document saving the result in explicitly specified save format.
ImageWatermarkOptions imageWatermarkOptions = new ImageWatermarkOptions() { Scale = 0.1 };
Watermarker.SetImage(MyDir + "Simple.docx", ArtifactsDir + "Watermarker.SetImage.rtf", SaveFormat.Rtf, MyDir + @"Images\logo.png", imageWatermarkOptions);
See Also
- enum SaveFormat
- class ImageWatermarkOptions
- class Watermarker
- namespace Wordize.Watermarking
- assembly Wordize
SetImage(Stream, Stream, SaveFormat, Image, ImageWatermarkOptions)
Adds Image watermark into the document.
public static void SetImage(Stream inputStream, Stream outputStream, SaveFormat saveFormat,
Image watermarkImage, ImageWatermarkOptions options = null)
Parameter | Type | Description |
---|---|---|
inputStream | Stream | The input stream. |
outputStream | Stream | The output stream. |
saveFormat | SaveFormat | The save format. |
watermarkImage | Image | Image that is displayed as a watermark. |
options | ImageWatermarkOptions | Defines additional options for the image 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 image watermark from Image object into the document using streams.
ImageWatermarkOptions imageWatermarkOptions = new ImageWatermarkOptions() { Scale = 0.1 };
using (Stream input = File.OpenRead(MyDir + "Simple.docx"))
using (Stream output = File.Create(ArtifactsDir + "Watermarker.SetImage.xps"))
using (System.Drawing.Image image = System.Drawing.Image.FromFile(MyDir + @"Images\logo.png"))
{
Watermarker.SetImage(input, output, SaveFormat.Xps, image, imageWatermarkOptions);
}
See Also
- enum SaveFormat
- class ImageWatermarkOptions
- class Watermarker
- namespace Wordize.Watermarking
- assembly Wordize
SetImage(Stream, Stream, SaveFormat, Stream, ImageWatermarkOptions)
Adds Image watermark into the document.
public static void SetImage(Stream inputStream, Stream outputStream, SaveFormat saveFormat,
Stream watermarkImageStream, ImageWatermarkOptions options = null)
Parameter | Type | Description |
---|---|---|
inputStream | Stream | The input stream. |
outputStream | Stream | The output stream. |
saveFormat | SaveFormat | The save format. |
watermarkImageStream | Stream | Image stream that is displayed as a watermark. |
options | ImageWatermarkOptions | Defines additional options for the image 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 image watermark into the document using streams.
ImageWatermarkOptions imageWatermarkOptions = new ImageWatermarkOptions() { Scale = 0.1 };
using (Stream input = File.OpenRead(MyDir + "Simple.docx"))
using (Stream output = File.Create(ArtifactsDir + "Watermarker.SetImage.pdf"))
using (Stream image = File.OpenRead(MyDir + @"Images\logo.png"))
{
Watermarker.SetImage(input, output, SaveFormat.Pdf, image, imageWatermarkOptions);
}
See Also
- enum SaveFormat
- class ImageWatermarkOptions
- class Watermarker
- namespace Wordize.Watermarking
- assembly Wordize