- 支持一行多个,一页多行水印
- 支持libreoffice将Word转PDF后水印仍然有效
- 后附完整代码
水印效果
![](https://i-blog.csdnimg.cn/direct/2ea614f3a3cd42dcaab2c687a3af526d.png)
开发环境
- Idea 2024.4
- openjdk-22.0.2
- Maven
代码
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.3.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.hsl</groupId>
<artifactId>WaterMark</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>WaterMark</name>
<description>WaterMark</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId&g