使用itext或任何其他东西将2d字节数组转换为pdf。 [英] convert 2d byte array into pdf using itext or any other thing.

查看:125
本文介绍了使用itext或任何其他东西将2d字节数组转换为pdf。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个来自Web服务的2d字节的pdf文件数组。我需要在我的控制台应用程序中将其转换为pdf。任何人都可以建议如何实现这一目标。提前致谢。



i hava a 2d byte array of pdf file coming from web service. i need to convert that into pdf in my console application using. can anyone suggest something how to achieve that. Thanks in advance.

byte[][] bytes=new byte[s.length][];
	        for (int i=0; i<s.length; i++) {
	            bytes[i]=org.apache.commons.codec.binary.Base64.decodeBase64(s[i].getBytes());}

推荐答案

如果你的bytes数组只包含字符,那么你可以使用FileWriter。如果不是那么OutputStream就是要走的路。

If your bytes array contains only characters then you can go with FileWriter. If it isn't then OutputStream is the way to go.
OutputStream out = new FileOutputStream("out.pdf");
out.write(bArray);
out.close();


这篇关于使用itext或任何其他东西将2d字节数组转换为pdf。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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