可能是什么问题?
FileInputStream src= new FileInputStream(new File(path));// PDF Form
PDFDocument pdf= PDFFactory.openDocument(src);
String data="<root><name>company</name><tel>000000</tel></root>";
byte[] byteData = data.getBytes("UTF8");
InputStream formInputStream= new ByteArrayInputStream(byteData);
pdf.importFormData(formInputStream); // Data Binding
outWriteStream(inSrcPdf.save(), ServiceContext.getOutputStream());
//----------------
private void outWriteStream(InputStream in, OutputStream out) throws IOException{
byte[] buffer = new byte[10240];
int len = 0;
while (true) {
len = in.read(buffer);
if (len == -1) break;
out.write(buffer, 0, len);
}
out.close();
}
IE或Reader显示
Chrome或FF显示: