itext

Digital signature in each page using iText [duplicate]

旧巷老猫 提交于 2020-08-26 11:14:04
问题 This question already has answers here : How to show digital PDF signature in all document's Page using iText? (2 answers) Closed 3 years ago . I have generated a report which have 3 pages using iReport. Now the signature only appears in one page. But I need to sign each page using iText. PdfReader reader = new PdfReader(fullFilePath); String outputPath = reportPath + randomUUID + fileExtension; FileOutputStream fout = new FileOutputStream(outputPath); stp = PdfStamper.createSignature(reader,

Digital signature in each page using iText [duplicate]

好久不见. 提交于 2020-08-26 11:12:43
问题 This question already has answers here : How to show digital PDF signature in all document's Page using iText? (2 answers) Closed 3 years ago . I have generated a report which have 3 pages using iReport. Now the signature only appears in one page. But I need to sign each page using iText. PdfReader reader = new PdfReader(fullFilePath); String outputPath = reportPath + randomUUID + fileExtension; FileOutputStream fout = new FileOutputStream(outputPath); stp = PdfStamper.createSignature(reader,

设计模式(9) 装饰模式

情到浓时终转凉″ 提交于 2020-08-11 01:55:59
装饰模式 装饰模式的特点 动态撤销功能 装饰模式可以动态向一个现有的对象添加新的功能,同时又不改变其结构。就增加功能来说,使用继承的方式生成子类也可以达到目的,但随着扩展功能的不断增加,子类的数量会快速膨胀,而装饰模式提供了一种更加灵活的方案。 装饰模式 GOF对装饰模式的描述为: Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality. — Design Patterns : Elements of Reusable Object-Oriented Software UML类图: IComponent接口定义了现有的功能,ConcreteComponent是它的具体实现类。 为了给IComponent扩展功能,引入了IDecorator接口,它继承了IComponent接口,ConcreteDecorator是扩展功能的具体实现。 为了更形象地理解这一模式,模拟实现一个文字处理软件功能,最初软件只具备单纯的文字输入、显示功能,后来扩展了更高级的功能,比如字体可以加粗、文字颜色可以调整、可以有不同的字号等等。 最初的功能 public

How to change PDF Version of existing PDF by overwriting original file in IText?

*爱你&永不变心* 提交于 2020-08-10 20:30:21
问题 I have the following code to change the pdf version of a pdf file. I do not want to have a second file at the end, but rather want the original file's pdf version to be updated directly. So my pdfs for reading and writing are the same: WriterProperties wp = new WriterProperties(); wp.setPdfVersion(PdfVersion.PDF_1_6); PdfDocument pdfDoc = new PdfDocument(new PdfReader("orig.pdf"), new PdfWriter("orig.pdf", wp)); pdfDoc.close(); But by doing this I get an error with A fatal error has been

Is PdfStamper disposing output stream? (iTextSharp)

亡梦爱人 提交于 2020-08-09 02:37:27
问题 I am using iTextSharp to add page numbers to a PDF with C#. While running code analysis the MemoryStream for the output is suspected to be disposed more than once. See this warning generated by Visual Studio. Is this an API problem? Should the second parameter of PdfStamper be marked as out ? Is there a way for me to fix this warning? MemoryStream mem = null; PdfReader reader = null; PdfStamper stamper = null; try { mem = new MemoryStream(); reader = new PdfReader(m_pdf); stamper = new

Digital signatures using itext 5.5.5

陌路散爱 提交于 2020-08-04 06:07:05
问题 I upgraded from iText 5.2.1 to iText 5.5.5 I was using PdfStamper along with PdfSignatureApperance to apply digital signatures. Here is my snippet of code. PdfStamper stamper = PdfStamper.createSignature(reader, byteArrayOutputStream,'\0'); PdfSignatureAppearance appearance = stamper.getSignatureAppearance(); appearance.setCrypto(key, chain, null, PdfSignatureAppearance.WINCER_SIGNED); From the above code, there are couple of things which are not present in the current version. 1) In version