1. 首页
  2. 编程语言
  3. Java
  4. pdf文件加水印源代码

pdf文件加水印源代码

上传者: 2018-12-09 04:55:38上传 RAR文件 892.14KB 热度 71次
给pdf文件加水印。源代码有详解。主要代码: PdfReader pdfReader = new PdfReader(inputPath); int numberOfPages = pdfReader.NumberOfPages; FileStream outputStream = new FileStream(outputPath, FileMode.Create); PdfStamper pdfStamper = new PdfStamper(pdfReader, outputStream); PdfContentByte waterMarkContent; string watermarkimagepath = watermarkPath; iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(watermarkimagepath); image.SetAbsolutePosit ion(250, 675); image.ScaleAbsoluteHeight(50); image.ScaleAbsoluteWidth(50); waterMarkContent = pdfStamper.GetUnderContent(1); waterMarkContent.AddImage(image); pdfStamper.Close(); pdfReader.Close(); System.IO.File.Delete(inputPath); System.IO.File.Move(outputPath, inputPath); System.IO.File.Delete(outputPath);
用户评论
码姐姐匿名网友 2018-12-09 04:55:38

不好用啊,不能满足需求

码姐姐匿名网友 2018-12-09 04:55:38

也不是jar,只有个txt,内容也太不详细了,不建议下载

码姐姐匿名网友 2018-12-09 04:55:38

东西不错,正是需要的