Overwrite creationDate in pdf using iText and pdf

2019-07-26 20:27发布

问题:

I need to modify the creationDate of my pdf created using iText.

For me is enough to remove the time information putting 00:00:00 from the date.

Is it possible to do during pdf creation with pdfWriter?

Thank you! Marco

回答1:

I got it.. It is simple! You can do it at generation time:

PdfDictionary info = writer.getInfo();
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
info.put(PdfName.CREATIONDATE, new PdfDate(cal));
info.put(PdfName.MODDATE, new PdfDate(cal));


标签: pdf itext