使用iText和pdf writer覆盖pdf中的creationDate
问题描述:
我需要修改使用iText创建的pdf的creationDate.
I need to modify the creationDate of my pdf created using iText.
对我来说,删除从日期中添加00:00:00的时间信息就足够了.
For me is enough to remove the time information putting 00:00:00 from the date.
在使用pdfWriter创建pdf期间可以做吗?
Is it possible to do during pdf creation with pdfWriter?
谢谢!马可
答
我明白了.很简单!您可以在生成时做到这一点:
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));