-1
我已經使用pdfstamper修改了使用itext的pdf。我的應用程序現在創建並保存一個新的pdf文件。我想直接在瀏覽器中瀏覽pdf。在這裏我實際的代碼在使用itext的瀏覽器中顯示pdf
public static void test07(){
try{
PdfReader reader = new PdfReader("c:\\temp\\file.pdf");
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream("c:\\temp\\new.pdf"));
AcroFields form = stamper.getAcroFields();
//fill the fields
stamper.close();
reader.close();
} catch (Exception e){
e.printStackTrace();
}
}
的問題是:我應該如何修改這個代碼,並顯示在瀏覽器中的PDF文件在servlet? 我已經嘗試使用ByteArrayOutputStream和response.getOutputStream,但沒有。
嗨,謝謝你的回答。我嘗試但沒有,唯一的方法,我發現是︰http://stackoverflow.com/questions/5968328/question-on-java-servlet-to-open-a-pdf-file-using-itext – elporco
所以你的問題解決了嗎?如果不是,你將不得不展示更多的代碼,因爲在這一點上,問題是什麼很不清楚。 –
嗨羅比,是的問題解決了。謝謝! – elporco