Document conversion is one of the most frequent processes that endures across a lot of industries. Sometimes, it is the business need to put a watermark on the resultant document after conversion. For example, you want to convert a Word document to PDF or PowerPoint PPT/PPTX to PDF with a watermark (text or image) in all the PDF pages.
GroupDocs.Conversion for .NET and Java gives you such an option. It possesses a class WatermarkOptions with rich properties such as:
- Text/Font
- Color
- Width
- Height
- Background
- Transparency
- Rotation angle
Convert Word to PDF and Add Watermark - C# Example
Let’s have a look at the C# implementation of how to convert a word DOCX document to PDF and add a watermark to the resultant PDF document.
using (Converter converter = new Converter("sample.docx")) | |
{ | |
WatermarkOptions watermark = new WatermarkOptions | |
{ | |
Text = "Sample watermark", | |
Color = Color.Red, | |
Width = 100, | |
Height = 100, | |
Background = true | |
}; | |
PdfConvertOptions options = new PdfConvertOptions | |
{ | |
Watermark = watermark | |
}; | |
converter.Convert("converted.pdf", options); | |
} |
Convert PPTX to PDF and Add Watermark - Java Example
Below is the Java code example shows how to convert a PowerPoint PPTX presentation to PDF and add a watermark to the resultant PDF document.
ConversionConfig conversionConfig = new ConversionConfig(); | |
conversionConfig.setStoragePath("source file path"); | |
conversionConfig.setOutputPath("output path"); | |
ConversionHandler conversionHandler = new ConversionHandler(conversionConfig); | |
String sourceFileName = "source.pptx"; | |
PdfSaveOptions saveOptions = new PdfSaveOptions(); | |
WatermarkOptions watermarkOptions = new WatermarkOptions(); | |
watermarkOptions.setText("Watermark text"); | |
watermarkOptions.setColor(Color.blue); | |
watermarkOptions.setFont(new Font("Arial", 40, 12)); | |
watermarkOptions.setRotationAngle(45); | |
watermarkOptions.setTransparency(0.1); | |
watermarkOptions.setLeft(200); | |
watermarkOptions.setTop(400); | |
saveOptions.getWatermarkOptions().setBackground(true); | |
saveOptions.setWatermarkOptions(watermarkOptions); | |
ConvertedDocument result = conversionHandler.<String> convert(sourceFileName, saveOptions); | |
result.save(sourceFileName + "." + result.getFileType()); |
Below is the screenshot, you can see the conversion of a PPTX to PDF along with watermark text.

- Download API from here.
- If there’s an issue, you can post on the forum.
- Documentation is always there for your help.