使用iText和pdf writer覆盖pdf中的creationDate [英] Overwrite creationDate in pdf using iText and pdf writer

查看:118
本文介绍了使用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));

这篇关于使用iText和pdf writer覆盖pdf中的creationDate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆