0

I am converting my XHTML pages, which are part of an application form filled by the user, into PDF files and saving them on the remote server. I have 6 parts in the application form each part is one XHTML page.

Once user fills up to 4 parts , upon click of continue button in 4 part/page, I am generating the PDF and saving it to remote server. On 5th part/page I have show a "PrintPreview " button. Once user clicks on it I have to get Saved PDF and open it in the PDF format.

I am able to read the PDF using InputStream but I don't know how to Open it in the java. How Can I do that using Java?

4

1 に答える 1

1

PDFを表示する必要のあるJavaアプリケーションを実行している場合は、Javaのデスクトップが1つのソリューションを提供します。あなたのコードはこれを行います:

  1. PDFを取得/ダウンロードしてファイルに保存します。

    File myPdf = saveToFile(pdfStream);

  2. デスクトップを呼び出してPDFを表示する

    java.awt.Desktop.getDesktop().open(myPdf);

別のオプションは、PDFを表示するためのURLでブラウザを起動することです。これは、メソッドを使用して実行できますDesktop.browse(uri)

于 2012-11-05T01:56:50.847 に答える