我正在使用以下代码将附件添加到现有的 pdf 文件中。
PdfFileSpecification fs = PdfFileSpecification.fileEmbedded(stamper.getWriter(), attachTempFile.getAbsolutePath(), new String(attachment.getName().getBytes(), "UTF-8"), null);
stamper.addFileAttachment(new String(attachment.getName().getBytes(), "UTF-8"), fs);
使用正确附件创建的 PDF 但缺少假定为希伯来语的附件名称。以为我在 utf-8 字符串中传递附件名称,但它不起作用。如果附件名称在 EN 中,则可以正常工作。
如何为压模对象设置编码以将所有内容保存在 utf-8 中?