我正在学习如何使用 PDFBox 生成 PDF。到目前为止,我设法创建了文档并修改了基本的元数据。
不过,我确实对创建日期有疑问。我尝试了很多事情,这是最合乎逻辑的事情:
//My PDDocument is called "document".
PDDocumentInformation info = document.getDocumentInformation();
info.setCreationDate(Calendar.getInstance());
结果,当右键单击生成的 PDF 并选择“属性”时是mar 28 jun 2011 12:28:36 CEST
. (mar
代表“狂欢”,周二在法语中)。我的问题是正确的时间应该是 12:28:36 GMT+1。
当我 printSystem.out.println(Calendar.getInstance());
时,它会返回(...)zone=sun.util.calendar.ZoneInfo[id="Europe/Zurich",(...)
(按需提供完整内容),这是正确的!
那么,问题出在哪里?