0

I have a PDF file that's being read through Java and returned as a byte array in a JSON response.

I want to find a way to parse those bytes from the PDF file using:

FileUtil.getFileBytes(fileToRead)

on the client side. Is there any way to render and display the PDF?

I know that I can put the file on a public server, but this may change based on user configuration, so I want to read the PDF on Java side and render the bytes on client side using Javascript or any jQuery plugin.

Any thoughts?

4

2 回答 2

1

查看 html 中的内联内容。看看这个内联图像的例子:Embedding Base64 Images

如果浏览器知道如何显示它(可能只有 chrome),它就会显示。

于 2013-07-24T16:59:13.503 回答
0

如果您想从网络连接读取字节并将它们制作成 PDF,您可以使用 Java I/OInputStreamsOutputStreams.

首先,使用InputStream.

然后,将它们写到一个新的文件中FileOutputStream

最后,调用 PDF 阅读器应用程序来显示 PDF。应该有几个。

我知道这个答案有点含糊,如果我误解了你的问题,我很抱歉,但我希望这能给你一些指导!

于 2013-07-24T17:09:44.160 回答