Domanda

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?

È stato utile?

Soluzione

If you mean you have a Java applicaiton running that needs to display the PDF, then Java's Desktop provides one solution. Your code would do this:

  1. get/download the pdf and save to a file:

    File myPdf = saveToFile(pdfStream);

  2. call desktop to display the PDF

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

Another option would be to launch a browser with a url to display the PDF. This can be done with the Desktop.browse(uri) method.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top