实现功能:Excel转pdf,Word转pdf,多个pdf文件合并,给pdf文件添加文字水印,给pdf添加图片水印
import com.aspose.cells.Workbook;
import com.aspose.words.Document;
import com.lowagie.text.Image;
import com.lowagie.text.pdf.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
public class FilesToPdf {
public static String getProRootPath() {
String rootPath = FilesToPdf.class.getResource("/").getPath();
if (rootPath.startsWith("/") && rootPath.indexOf(":") == 2) {
rootPath = rootPath.substring(1);
}
return rootPath.substring(0, rootPath.indexOf("WEB-INF"));
}
public static boolean getLicense() {
boolean result = false;
try {
InputStream is = new FileInputStream(getProRootPath() + "WEB-INF/classes/template/license/license_doc.xml");
com.aspose.words.License aposeLic = new com.aspose.words.License();
aposeLic.setLicense(is);
result = true;
} catch (Exceptio