使用Java代码给PDF文件加文字水印

直接上代码运行即可

依赖

有的可能用不上我直接复制全部了

 <dependencies><!--word文件转PDF以及水印--><dependency><groupId>e-iceblue</groupId><artifactId>spire.doc.free</artifactId><version>3.9.0</version></dependency><dependency><groupId>e-iceblue</groupId><artifactId>spire.pdf.free</artifactId><version>3.9.0</version></dependency><!--解析word时用到的包--><dependency><groupId>com.lowagie</groupId><artifactId>itext</artifactId><version>2.1.7</version></dependency><!--lombok--><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><version>1.18.16</version><scope>compile</scope></dependency><!--Aspose相关依赖 需要在本地指定导入--><dependency><groupId>com.aspose.words</groupId><artifactId>aspose-words</artifactId><version>words-15.8.0-jdk16</version><scope>system</scope><systemPath>${project.basedir}/src/main/resources/lib/aspose-words-15.8.0-jdk16.jar</systemPath></dependency><dependency><groupId>com.aspose.cells</groupId><artifactId>aspose-cells</artifactId><version>cell-8.5.2</version><scope>system</scope><systemPath>${project.basedir}/src/main/resources/lib/aspose-cells-8.5.2.jar</systemPath></dependency><dependency><groupId>com.aspose.pdf</groupId><artifactId>aspose-pdf</artifactId><version>pdf-17.3.0</version><scope>system</scope><systemPath>${project.basedir}/src/main/resources/lib/aspose.pdf-17.3.0.jar</systemPath></dependency><!--文件上传--><!--骑缝章相关依赖--><dependency><groupId>com.itextpdf</groupId><artifactId>itextpdf</artifactId><version>5.5.13</version></dependency><dependency><groupId>com.itextpdf</groupId><artifactId>itext-asian</artifactId><version>5.2.0</version></dependency><dependency><groupId>com.itextpdf.tool</groupId><artifactId>xmlworker</artifactId><version>5.5.13</version></dependency><dependency><groupId>fr.opensagres.xdocreport</groupId><artifactId>fr.opensagres.poi.xwpf.converter.pdf-gae</artifactId><version>2.0.1</version></dependency></dependencies>

文字水印

方式1

 public static void addWatermarkWYH(String filepath, String data) {Document pdfDocument = new Document(filepath);TextStamp textStamp = new TextStamp(data);//背景(好像没用)textStamp.setBackground(true);//x坐标  可以通过xy坐标来定义水印的具体位置textStamp.setXIndent(100);//y坐标textStamp.setYIndent(10);//通过以下属性控制水印的样式 字体 大小 颜色等//旋转角度textStamp.setRotateAngle(0);//字体类型textStamp.getTextState().setFont(FontRepository.findFont("Arial"));//字体大小textStamp.getTextState().setFontSize(20.0F);//字体样式textStamp.getTextState().setFontStyle(FontStyles.Italic);//字体颜色textStamp.getTextState().setForegroundColor(com.aspose.pdf.Color.fromRgb(Color.yellow));TextStamp textStamp1 = new TextStamp(data);textStamp1.setBackground(true);textStamp1.setXIndent(200);//设置位置textStamp1.setYIndent(10);textStamp1.setRotateAngle(0);//设置旋转角度textStamp1.getTextState().setFont(FontRepository.findFont("Arial"));textStamp1.getTextState().setFontSize(30.0F);//设置字体大小textStamp1.getTextState().setFontStyle(FontStyles.Italic);textStamp1.getTextState().setForegroundColor(com.aspose.pdf.Color.fromRgb(Color.green));TextStamp textStamp2 = new TextStamp(data);textStamp2.setBackground(true);textStamp2.setXIndent(300);textStamp2.setYIndent(10);textStamp2.setRotateAngle(0);textStamp2.getTextState().setFont(FontRepository.findFont("Arial"));textStamp2.getTextState().setFontSize(40.0F);textStamp2.getTextState().setFontStyle(FontStyles.Italic);textStamp2.getTextState().setForegroundColor(com.aspose.pdf.Color.fromRgb(Color.red));PageCollection pages = pdfDocument.getPages();System.out.println(pages);int size = pages.size();for (int i = 1; i <= size; i++) {//如果只想要一个水印 只添加一个即可pages.get_Item(i).addStamp(textStamp);pages.get_Item(i).addStamp(textStamp1);pages.get_Item(i).addStamp(textStamp2);}pdfDocument.save(filepath);}
  public static void main(String[] args) throws IOException {//原pdf文件路径String sourcePath = "D:\\File\\b.pdf";//指定水印内容ConvertPDFUtils.addWatermarkWYH(sourcePath, "已审核");}

方式2

  /*** @param page          要添加水印的页面* @param textWatermark 水印文字*/public static void AddTextWatermark(PdfPageBase page, String textWatermark) {Dimension2D dimension2D = new Dimension();dimension2D.setSize(page.getCanvas().getClientSize().getWidth() / 3, page.getCanvas().getClientSize().getHeight() / 3);PdfTilingBrush brush = new PdfTilingBrush(dimension2D);brush.getGraphics().setTransparency(0.3F);brush.getGraphics().save();brush.getGraphics().translateTransform((float) brush.getSize().getWidth() / 2, (float) brush.getSize().getHeight() / 2);brush.getGraphics().rotateTransform(-45);brush.getGraphics().drawString(textWatermark, new PdfTrueTypeFont(new Font("新宋体", Font.PLAIN, 30), true), PdfBrushes.getGray(), 0, 0, new PdfStringFormat(PdfTextAlignment.Center));brush.getGraphics().restore();brush.getGraphics().setTransparency(1);Rectangle2D loRect = new Rectangle2D.Float();loRect.setFrame(new Point2D.Float(0, 0), page.getCanvas().getClientSize());page.getCanvas().drawRectangle(brush, loRect);}
    public static void main(String[] args) throws IOException {//原pdf文件路径String sourcePath = "D:\\file\\test.pdf";//目标pdf文件路径String targetPath = "D:\\file\\Watermark22.pdf";//加载原pdf文档PdfDocument pdf = new PdfDocument();pdf.loadFromFile(sourcePath);PdfReader reader = new PdfReader(sourcePath);int total = reader.getNumberOfPages();for (int i = 0; i < total; i++) {ConvertPDFUtils.AddTextWatermark(pdf.getPages().get(i), "已审阅");}//保存pdf.saveToFile(targetPath);ConvertPDFUtils.addWatermark(sourcePath, "hahah");//关闭pdf.close();}

图片水印

package dmyz.util;/*** @Author 魏一鹤* @Description  生成图片水印* @Date 10:43 2022/6/28
**/
import com.spire.pdf.*;
import com.spire.pdf.automaticfields.PdfCompositeField;
import com.spire.pdf.automaticfields.PdfPageCountField;
import com.spire.pdf.automaticfields.PdfPageNumberField;
import com.spire.pdf.graphics.*;import java.awt.*;
import java.awt.geom.Dimension2D;
import java.awt.geom.Rectangle2D;public class ImageWaterMark {public static void main(String[] args) {//实例化PdfDocument类的对象,并加载测试文档PdfDocument pdf = new PdfDocument();//获取文档pdf.loadFromFile("D:\\File\\test\\wyh\\moban.pdf");//添加一个空白页,目的为了删除jar包添加的水印,后面再移除这一页pdf.getPages().add();//创建字体PdfTrueTypeFont font = new PdfTrueTypeFont(new Font("宋体", Font.PLAIN, 10),true);//遍历文档中的页for (int i = 0; i < pdf.getPages().getCount(); i++) {Dimension2D pageSize = pdf.getPages().get(i).getSize();float y = (float) pageSize.getHeight() - 40;//初始化页码域PdfPageNumberField number = new PdfPageNumberField();//初始化总页数域PdfPageCountField count = new PdfPageCountField();//创建复合域PdfCompositeField compositeField = new PdfCompositeField(font, PdfBrushes.getBlack(), "第{0}页 共{1}页", number, count);//设置复合域内文字对齐方式compositeField.setStringFormat(new PdfStringFormat(PdfTextAlignment.Right, PdfVerticalAlignment.Top));//测量文字大小Dimension2D textSize = font.measureString(compositeField.getText());//设置复合域的在PDF页面上的位置及大小compositeField.setBounds(new Rectangle2D.Float(((float) pageSize.getWidth() - (float) textSize.getWidth())/2, y, (float) textSize.getWidth(), (float) textSize.getHeight()));//将复合域添加到PDF页面compositeField.draw(pdf.getPages().get(i).getCanvas());}//移除第一个页pdf.getPages().remove(pdf.getPages().get(pdf.getPages().getCount()-1));//加载图片,设置为背景水印PdfPageBase page = pdf.getPages().get(0);//指定水印在文档中的位置及图片大小page.setBackgroundImage("D:\\File\\test\\wyh\\zhang.png");Rectangle2D.Float rect = new Rectangle2D.Float();//设置水印大小以及位置rect.setRect(400, 600, 150, 150);page.setBackgroundRegion(rect);//保存文档pdf.saveToFile("D:\\File\\test\\wyh\\imageWaterMark.pdf");pdf.close();}
}

全部的工具类代码

package dmyz.util;import com.aspose.cells.License;
import com.aspose.cells.SaveFormat;
import com.aspose.cells.Workbook;
import com.aspose.pdf.*;
import com.aspose.pdf.devices.JpegDevice;
import com.aspose.pdf.devices.PngDevice;
import com.aspose.pdf.devices.Resolution;
import com.spire.pdf.PdfPageBase;
import com.spire.pdf.graphics.*;import javax.imageio.ImageIO;
import java.awt.Color;
import java.awt.Font;
import java.awt.*;
import java.awt.geom.Dimension2D;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.io.*;
import java.util.ArrayList;
import java.util.List;public class ConvertPDFUtils {/*** 获取license** @return*/public static boolean getLicense() {boolean result = false;try {InputStream is = ConvertPDFUtils.class.getClassLoader().getResourceAsStream("\\license.xml");License aposeLic = new License();aposeLic.setLicense(is);result = true;} catch (Exception e) {e.printStackTrace();}return result;}/*** 支持DOC, DOCX, OOXML, RTF, HTML, OpenDocument, PDF, EPUB, XPS, SWF等相互转换<br>** @param excelfilePath [原始excel路径]* @param pdfFilePath   [输出路径]*/public static Boolean excelConvertToPdf(String excelfilePath, String pdfFilePath) {// 验证Licenseif (!getLicense()) {return false;}try {// 原始excel路径Workbook wb = new Workbook(excelfilePath);// 输出路径File pdfFile = new File(pdfFilePath);FileOutputStream fileOS = new FileOutputStream(pdfFile);wb.save(fileOS, SaveFormat.PDF);return true;} catch (Exception e) {e.printStackTrace();return false;}}/*** 支持DOC, DOCX, OOXML, RTF, HTML, OpenDocument, PDF, EPUB, XPS, SWF等相互转换<br>** @param wordfilePath [原始excel路径]* @param pdfFilePath  [输出路径]*/public static Boolean wordConvertToPdf(String wordfilePath, String pdfFilePath) {// 验证Licenseif (!getLicense()) {return false;}try {// 原始word路径Document doc = new Document(wordfilePath);// 输出路径File pdfFile = new File(pdfFilePath);FileOutputStream fileOS = new FileOutputStream(pdfFile);doc.save(fileOS,SaveFormat.PDF);return true;} catch (Exception e) {e.printStackTrace();return false;}}/*** 将pdf转图片** @param inputStream pdf源文件流* @param imgFilePath 转成一张图片文件全路径 例如 "D:\\home\\qq.png"*/public static void pdfToImage(InputStream inputStream, String imgFilePath) {try {System.out.println("convert pdf2jpg begin");long old = System.currentTimeMillis();if (!getLicense()) {return;}Document pdfDocument = new Document(inputStream);//分辨率Resolution resolution = new Resolution(130);JpegDevice jpegDevice = new JpegDevice(resolution);List<BufferedImage> imageList = new ArrayList<BufferedImage>();List<File> fileList = new ArrayList<File>();for (int index = 1; index <= pdfDocument.getPages().size(); index++) {File file = File.createTempFile("tempFile", "png");FileOutputStream fileOS = new FileOutputStream(file);jpegDevice.process(pdfDocument.getPages().get_Item(index), fileOS);fileOS.close();imageList.add(ImageIO.read(file));fileList.add(file);}//临时文件删除BufferedImage mergeImage = mergeImage(false, imageList);ImageIO.write(mergeImage, "png", new File(imgFilePath));long now = System.currentTimeMillis();System.out.println("convert pdf2jpg completed, elapsed :" + ((now - old) / 1000.0) + "秒");//删除临时文件for (File f : fileList) {if (f.exists()) {f.delete();}}} catch (Exception e) {e.printStackTrace();}}/*** 合并任数量的图片成一张图片** @param isHorizontal true代表水平合并,fasle代表垂直合并* @param imgs         待合并的图片数组* @return* @throws IOException*/public static BufferedImage mergeImage(boolean isHorizontal, List<BufferedImage> imgs) throws IOException {// 生成新图片BufferedImage destImage = null;// 计算新图片的长和高int allw = 0, allh = 0, allwMax = 0, allhMax = 0;// 获取总长、总宽、最长、最宽for (int i = 0; i < imgs.size(); i++) {BufferedImage img = imgs.get(i);allw += img.getWidth();if (imgs.size() != i + 1) {allh += img.getHeight() + 5;} else {allh += img.getHeight();}if (img.getWidth() > allwMax) {allwMax = img.getWidth();}if (img.getHeight() > allhMax) {allhMax = img.getHeight();}}// 创建新图片if (isHorizontal) {destImage = new BufferedImage(allw, allhMax, BufferedImage.TYPE_INT_RGB);} else {destImage = new BufferedImage(allwMax, allh, BufferedImage.TYPE_INT_RGB);}Graphics2D g2 = (Graphics2D) destImage.getGraphics();g2.setBackground(Color.LIGHT_GRAY);g2.clearRect(0, 0, allw, allh);g2.setPaint(Color.RED);// 合并所有子图片到新图片int wx = 0, wy = 0;for (int i = 0; i < imgs.size(); i++) {BufferedImage img = imgs.get(i);int w1 = img.getWidth();int h1 = img.getHeight();// 从图片中读取RGBint[] ImageArrayOne = new int[w1 * h1];// 逐行扫描图像中各个像素的RGB到数组中ImageArrayOne = img.getRGB(0, 0, w1, h1, ImageArrayOne, 0, w1);if (isHorizontal) {// 水平方向合并// 设置上半部分或左半部分的RGBdestImage.setRGB(wx, 0, w1, h1, ImageArrayOne, 0, w1);} else {// 垂直方向合并// 设置上半部分或左半部分的RGBdestImage.setRGB(0, wy, w1, h1, ImageArrayOne, 0, w1);}wx += w1;wy += h1 + 5;}return destImage;}/*** pfd转图片** @param pdf     源文件全路径* @param outPath 转后的文件夹路径*/public static void pdfToImage(String pdf, String outPath) {// 验证Licenseif (!getLicense()) {return;}try {long old = System.currentTimeMillis();System.out.println("convert pdf2png begin");Document pdfDocument = new Document(pdf);//图片宽度:800//图片高度:100// 分辨率 960//Quality [0-100] 最大100//例: new JpegDevice(800, 1000, resolution, 90);Resolution resolution = new Resolution(960);
//            JpegDevice jpegDevice = new JpegDevice(resolution);PngDevice pngDevice = new PngDevice(resolution);for (int index = 1; index <= pdfDocument.getPages().size(); index++) {// 输出路径File file = new File(outPath + "/" + index + ".png");FileOutputStream fileOs = new FileOutputStream(file);
//                jpegDevice.process(pdfDocument.getPages().get_Item(index), fileOs);pngDevice.process(pdfDocument.getPages().get_Item(index), fileOs);fileOs.close();}long now = System.currentTimeMillis();System.out.println("convert pdf2png completed, elapsed :" + ((now - old) / 1000.0) + "秒");} catch (Exception e) {e.printStackTrace();}}/*** @param page      要添加水印的页面* @param imageFile 水印图片路径*/public static void AddImageWatermark(PdfPageBase page, String imageFile) {page.setBackgroundImage(imageFile);Rectangle2D rect = new Rectangle2D.Float();rect.setFrame(page.getClientSize().getWidth() / 2 - 100, page.getClientSize().getHeight() / 2 - 100, 200, 200);page.setBackgroundRegion(rect);}/*** @param page          要添加水印的页面* @param textWatermark 水印文字*/public static void AddTextWatermark(PdfPageBase page, String textWatermark) {Dimension2D dimension2D = new Dimension();dimension2D.setSize(page.getCanvas().getClientSize().getWidth() / 3, page.getCanvas().getClientSize().getHeight() / 3);PdfTilingBrush brush = new PdfTilingBrush(dimension2D);brush.getGraphics().setTransparency(0.3F);brush.getGraphics().save();brush.getGraphics().translateTransform((float) brush.getSize().getWidth() / 2, (float) brush.getSize().getHeight() / 2);brush.getGraphics().rotateTransform(-45);brush.getGraphics().drawString(textWatermark, new PdfTrueTypeFont(new Font("新宋体", Font.PLAIN, 30), true), PdfBrushes.getGray(), 0, 0, new PdfStringFormat(PdfTextAlignment.Center));brush.getGraphics().restore();brush.getGraphics().setTransparency(1);Rectangle2D loRect = new Rectangle2D.Float();loRect.setFrame(new Point2D.Float(0, 0), page.getCanvas().getClientSize());page.getCanvas().drawRectangle(brush, loRect);}/*** @param sourceFile 需要重新重命名的图片路径* @param targetPath 重命名的图片路径保存地址*/public static void fileCopyRightWay(String sourceFile, String targetPath) {try {//读取源地址文件的字节流FileInputStream in = new FileInputStream(sourceFile);FileOutputStream out = new FileOutputStream(targetPath);byte[] bs = new byte[1026];int count = 0;while ((count = in.read(bs, 0, bs.length)) != -1) {//把读取到的字节流写入到目的地址的文件里面out.write(bs, 0, count);}//刷新下输出流out.flush();// 关闭输入流和输出流out.close();out.close();} catch (FileNotFoundException e) {e.printStackTrace();} catch (IOException e) {e.printStackTrace();}}/*** 添加水印** @param filepath [文件路径]* @param data     [水印文字内容]*/public static void addWatermark(String filepath, String data) {Document pdfDocument = new Document(filepath);TextStamp textStamp = new TextStamp(data);textStamp.setBackground(true);textStamp.setXIndent(100);textStamp.setYIndent(100);textStamp.setRotateAngle(50);textStamp.getTextState().setFont(FontRepository.findFont("Arial"));textStamp.getTextState().setFontSize(34.0F);textStamp.getTextState().setFontStyle(FontStyles.Italic);
//        textStamp.getTextState().setForegroundColor(Color.getLightGray());TextStamp textStamp1 = new TextStamp(data);textStamp1.setBackground(true);textStamp1.setXIndent(300);//设置位置textStamp1.setYIndent(300);textStamp1.setRotateAngle(50);//设置旋转角度textStamp1.getTextState().setFont(FontRepository.findFont("Arial"));textStamp1.getTextState().setFontSize(34.0F);//设置字体大小textStamp1.getTextState().setFontStyle(FontStyles.Italic);
//        textStamp1.getTextState().setForegroundColor(Color.LIGHT_GRAY);//设置字体颜色TextStamp textStamp2 = new TextStamp(data);textStamp2.setBackground(true);textStamp2.setXIndent(500);textStamp2.setYIndent(500);textStamp2.setRotateAngle(50);textStamp2.getTextState().setFont(FontRepository.findFont("Arial"));textStamp2.getTextState().setFontSize(34.0F);textStamp2.getTextState().setFontStyle(FontStyles.Italic);
//        textStamp2.getTextState().setForegroundColor(Color.getLightGray());PageCollection pages = pdfDocument.getPages();int size = pages.size();for (int i = 1; i <= size; i++) {pages.get_Item(i).addStamp(textStamp);pages.get_Item(i).addStamp(textStamp1);pages.get_Item(i).addStamp(textStamp2);}pdfDocument.save(filepath);}public static void addWatermarkWYH(String filepath, String data) {Document pdfDocument = new Document(filepath);TextStamp textStamp = new TextStamp(data);//背景(好像没用)textStamp.setBackground(true);//x坐标  可以通过xy坐标来定义水印的具体位置textStamp.setXIndent(100);//y坐标textStamp.setYIndent(10);//通过以下属性控制水印的样式 字体 大小 颜色等//旋转角度textStamp.setRotateAngle(0);//字体类型textStamp.getTextState().setFont(FontRepository.findFont("Arial"));//字体大小textStamp.getTextState().setFontSize(20.0F);//字体样式textStamp.getTextState().setFontStyle(FontStyles.Italic);//字体颜色textStamp.getTextState().setForegroundColor(com.aspose.pdf.Color.fromRgb(Color.yellow));TextStamp textStamp1 = new TextStamp(data);textStamp1.setBackground(true);textStamp1.setXIndent(200);//设置位置textStamp1.setYIndent(10);textStamp1.setRotateAngle(0);//设置旋转角度textStamp1.getTextState().setFont(FontRepository.findFont("Arial"));textStamp1.getTextState().setFontSize(30.0F);//设置字体大小textStamp1.getTextState().setFontStyle(FontStyles.Italic);textStamp1.getTextState().setForegroundColor(com.aspose.pdf.Color.fromRgb(Color.green));TextStamp textStamp2 = new TextStamp(data);textStamp2.setBackground(true);textStamp2.setXIndent(300);textStamp2.setYIndent(10);textStamp2.setRotateAngle(0);textStamp2.getTextState().setFont(FontRepository.findFont("Arial"));textStamp2.getTextState().setFontSize(40.0F);textStamp2.getTextState().setFontStyle(FontStyles.Italic);textStamp2.getTextState().setForegroundColor(com.aspose.pdf.Color.fromRgb(Color.red));PageCollection pages = pdfDocument.getPages();System.out.println(pages);int size = pages.size();for (int i = 1; i <= size; i++) {//如果只想要一个水印 只添加一个即可pages.get_Item(i).addStamp(textStamp);pages.get_Item(i).addStamp(textStamp1);pages.get_Item(i).addStamp(textStamp2);}pdfDocument.save(filepath);}//word->pdfpublic static boolean docToPdf(String inPath, String outPath) {if (!getLicense()) { // 验证License 若不验证则转化出的pdf文档会有水印产生return false;}FileOutputStream os = null;try {long old = System.currentTimeMillis();File file = new File(outPath); // 新建一个空白pdf文档os = new FileOutputStream(file);Document doc = new Document(inPath); // Address是将要被转化的word文档doc.save(os, SaveFormat.PDF);// 全面支持DOC, DOCX, OOXML, RTF HTML, OpenDocument, PDF,// EPUB, XPS, SWF 相互转换long now = System.currentTimeMillis();System.out.println("pdf转换成功,共耗时:" + ((now - old) / 1000.0) + "秒"); // 转化用时} catch (Exception e) {e.printStackTrace();return false;}finally {if (os != null) {try {os.flush();os.close();} catch (IOException e) {e.printStackTrace();}}}return true;}}

Java实现给PDF文件加文字水印和图片水印(可以自定义水印格式)相关推荐

  1. java实现给PDF文件添加图片水印,java实现给PDF文件添加文字水印

    接上一篇,pdf跟tif 是一起做的 java实现 1.给PDF文件添加图片水印: public static void waterMark1(String inputFile,String outp ...

  2. 咖啡汪日志——JAVA导出pdf文件加水印 文字+图片、文字

    咖啡汪日志--JAVA导出pdf文件加水印 文字和图片.文字 hello,又大家见面了! 作为一只不是在戏精就是在戏精路上的哈士奇,今天要展示给大家的就是如何快捷地给pdf文件增加各种水印.嗷呜呜,前 ...

  3. java实现对pdf文件压缩,拆分,修改水印,添加水印

    最近要实现一个文件上传,并且在线预览上传文件的功能,设计思路是:把上传的文件通过openoffice转成pdf文件,并将pdf文件以流的形式返回到浏览器,由于上传的部分文件过大,转成pdf后传回前端浏 ...

  4. 如何批量给pdf文件添加文字水印?

    工作中我们会给重要的办公文件文件水印,给文件加上公司的名称等,这样可以有效防止文件内容被别人盗用抄袭,其中就包括word.Excel.PPT.图片.PDF等文件.PDF文件由于其特殊性,越来越成为最常 ...

  5. pdf文件加水印怎么加,5个方法快速易学

    PDF文件加水印是一个非常重要且常见的操作,对于不熟悉这一技能的人来说可能会感到困难.这也是为什么在某些浏览器中"pdf文件加水印怎么加"搜索量可高达几百万之多.但是,我们都知道掌 ...

  6. vue 中利用canvas 给pdf文件加水印---详细教程(附上完整代码)

    需求:在h5网页中打开pdf文件,要求给文件添加水印 实现技术及插件:vue,vue-pdf,canvas 插件安装: npm i vue-pdf --save npm i pdf-lib --sav ...

  7. Java实现对PDF文件添加水印

    Java实现对PDF文件添加水印 目录 Java实现对PDF文件添加水印 导入依赖 工具方法 效果 最近项目中遇到对PDF添加水印,实现有多种,采取的是itextpdf 导入依赖 <!-- 对P ...

  8. JAVA 实现返回PDF文件流并进行下载

    JAVA 实现返回PDF文件流并进行下载 首先确保本地存放pdf 保证通过路径可以拿到文件 我这边把pdf放在e盘下的目录 1.前台方法 原生ajax 发送请求返回文件流进行下载 function d ...

  9. java+icepdf+下载_Java使用icepdf将pdf文件按页转成图片

    本文实例为大家分享了Java使用icepdf将pdf文件按页转成图片的具体代码,供大家参考,具体内容如下 Maven icepdf包,这里过滤掉jai-core org.icepdf.os icepd ...

最新文章

  1. 8086 c语言,2016年上海大学机电工程与自动化学院微机硬件及软件(包含8086微机和C语言)之C程序设计考研复试题库...
  2. 我的第一个Spring MVC程序
  3. 图像-摄像头驱动流程
  4. python 示例_带有示例的Python列表copy()方法
  5. 操作系统宕机,MySQL数据找回记录
  6. Promise基本概念和基本示例使用
  7. php 量 高并发 nosql,nosql - 高并发下Apache+mongodb的php驱动不稳定
  8. 拦截游戏窗口被移动_家中最值得购入的17款儿童游戏,教你如何从IPAD中夺回小朋友的注意力...
  9. 袁国宝:罗永浩直播之道
  10. js中this指向的四种规则+ 箭头函数this指向
  11. popupWindow在5.0版本以下不显示的问题
  12. html设计的概念,HTML标签, 元素与列表,前端UI设计-2019.08.30
  13. SQL Server数据分析面试题(202008)
  14. html5 游戏 算法,台球类html5游戏的AI设计与核心算法的实现
  15. 6/7/8/9/10/11代主板刷bios跳过校验方法刷修改bios自制bios方法
  16. ARMA-GARCH模型与单独的ARMA模型和GARCH模型有什么区别
  17. android播放器1004,Android音频开发MediaPlayer(-38,0)(-1004)错误解决
  18. 推荐一下我的个人博客:业余草-www.xttblog.com
  19. 单片机c语言 王东锋,单片机实训总结报告.docx
  20. 女神不理你?运行这10行代码Python,让女神爱上你!

热门文章

  1. 公务员考试计算机基础试题,2019年国家公务员考试计算机基础试题6
  2. 成都拓嘉辰丰:商家在申请多多买菜提货点时该如何做?
  3. 浏览器开发者工具用法
  4. java 图片转灰度_java 图片灰度化
  5. 利用计算机浏览信息,利用计算机浏览信息时,可以实现任意页面之间的跳转,这种技术最恰当的说法是(??)...
  6. ubuntu中文桌面改英文
  7. spyder python教程_新手小白用spyder学习python的一点笔记
  8. 在IIS服务器上部署SSL证书(基于阿里云平台)
  9. 机械师未来战舰Ⅱ评测
  10. React应用react-color