我想使用Groovy从Decode base64生成一个pdf文件。我尝试了以下方法,但pdf并未生成实际内容。我在这里做错了-您能帮我解决此问题吗?
随附了预期的pdf文件屏幕快照,以供参考。Pdf Output file
import com.itextpdf.text.*
import com.itextpdf.text.pdf.PdfWriter;
def content = "SlZCRVJpMHhMak1OSmVMano5TU5DamNnTUNCdlltb05QRHd2VEdsdVpXRnlhWHBsWkNBeEwwd2dOemswTlM5UElEa3ZSU0F6TlRJMApMMDRnTVM5VUlEYzJOVFl2U0NCYklEUTFNU0F4TXpkZFBqNE5aVzVrYjJKcURTQWdJQ0FnSUNBZ0lDQWdJQ0FnSUNBZ0lDQWdJQ0FnCkRRb3hNeUF3SUc5aWFnMDhQQzlFWldOdlpHVlFZWEp0Y3p3OEwwTnZiSFZ0Ym5NZ05DOVFjbVZrYVdOMGIzSWdNVEkrUGk5R2FXeDAKWlhJdlJteGhkR1ZFWldOdlpHVXZTVVJiUERSRVF6a3hRVEU0TnpWQk5rUTNNRGRCUlVNeU1ETkNRakF5TVVNNU0wRXdQanhHTmtNNQpNa0l6TmpoQk9FRXhNelF3T0RRMU4wRXhSRE01TlVFek4wVkNPVDVkTDBsdVpHVjRXemNnTWpGZEwwbHVabThnTmlBd0lGSXZUR1Z1ClozUm9JRFV5TDFCeVpYWWdOelkxTnk5U2IyOTBJRGdnTUNCU0wxTnBlbVVnTWpndlZIbHdaUzlZVW1WbUwxZGJNU0F5SURGZFBqNXoKZEhKbFlXME5DbWplWW1Ka0VHQmdZbUN5QVJJTUlJS3hBVWd3cHdJSk5rY2c4ZVVZQXhNand6U1FMQU1qdWNSL3hwMWZBQUlNQUV5awpCdkFOQ21WdVpITjBjbVZoYlExbGJtUnZZbW9OYzNSaGNuUjRjbVZtRFFvd0RRb2xKVVZQUmcwS0lDQWdJQ0FnSUNBTkNqSTNJREFnCmIySnFEVHc4TDBacGJIUmxjaTlHYkdGMFpVUmxZMjlrWlM5SklEWTVMMHhsYm1kMGFDQTFPQzlUSURNNFBqNXpkSE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Ra0l3TWpGRE9UTkJNRDQ4UmpaRE9USkNNelk0UVRoQk1UTTBNRGcwTlRkQk1VUXpPVFZCTXpkRlFqaytYUzlKYm1adklEWWdNQ0JTCkwweGxibWQwYUNBek55OVNiMjkwSURnZ01DQlNMMU5wZW1VZ055OVVlWEJsTDFoU1pXWXZWMXN4SURJZ01GMCtQbk4wY21WaGJRMEsKYU41aVltQmdZR0xrUGNMRXdEK1ZpWUdoaDRtQmtZV0o4YkVra00wSUVHQUFLbGtERkEwS1pXNWtjM1J5WldGdERXVnVaRzlpYWcxegpkR0Z5ZEhoeVpXWU5DakV4TmcwS0pTVkZUMFlOQ2c9PQ"
def encoded = content.getBytes("UTF-8").encodeBase64().toString()
byte[] decoded = encoded.decodeBase64()
System.out.println("decoded :" +decoded)
def document = new Document()
PdfWriter.getInstance(document,
new FileOutputStream('base64Decoded.pdf'))
document.open()
document.add(new Paragraph(new String(decoded)))
document.close()
答案 0 :(得分:0)
好像content
被两次错误编码。 Base64解码content
产生另一个Base64解码的String。通过Base64解码可生成PDF:
String content = "SlZCRVJp...";
byte[] tmp = Base64.decode(content);
byte[] pdf = Base64.decode(new String(tmp));
FileUtils.writeByteArrayToFile(new File(OUTPUT_FILE), pdf);
然后可以将pdf
传递到PdfReader
对象。