Print with PdfBox, render pdf in browser - java

I am usieng PDFBox to fill a template with some data and I wish to render it in Chrome, so that I can give the user the possibility to preview it before printing it from the web page.
Does anyone knows if PDFBox supports to render the created PDF in a browser?
Thanks.

PDFbox not directly, since it just creates the pdf. But you can simply include the pdf in your webpage through varying methods, depending on your architecture.
One simple example is:
<embed src="http://example.com/file.pdf" width="500" height="500" type='application/pdf'>
More options have been discussed in this question: Recommended way to embed PDF in HTML?

Related

how to print dvt hierarchy viewer in pdf

My requirement is just to show the DVT hierarchyView in a HTML format in PDF, I don't want to embed the flash content in to PDF.
Also, the above links seems suggesting use of FLEX which we are not comfortable of.
Do you have any other pointers please

Display PDF in browser

I am developing a Java Web Application (jsp/servlet) using tomcat. I need to display pdf file from local machine. can you suggest what is best way to display it?
I used iframe to display pdf file.
<iframe src="resume.pdf" width="100%" style="height:60em">
[Your browser does <em>not</em> support <code>iframe</code>,
or has been configured not to display inline frames.
You can access the document
via a link though.]
</iframe>
I think you can try a Library called XPDF , I think you can convert from PDF to HTML page , or the second option is just let the user open a link to the page (www.yourwebsite.com/pdffolder/somepdf.pdf)
If you need display a pdf file using tomcat, you can access directly to the file using the specific url where the file is located in your navigator, depending on the path where you put the file, so you can access using 127.0.0.1/files/test.pdf for example. If you need generate a pdf, the best tool I think is iText, this is an easy example how to use id: Introducing PDF and iText

Show PDF content using GWT

How I can show .pdf files content in browser using GXT or GWT Libraries.
1) Web browsers can embed PDF documents handily, this is probably the most practical solution (use standard html windows in your GWT application that display the PDF, and make sure the PDF is accessible from the web). A GWT Child frame can effectively embed a pdf using native browser capabilities, just make sure you encode the content correctly in the header.
2) If you want to do some GWT/java/pdf wizardry, you can use iText's PDF reader/writer interface to customize the type of PDF data you want to display.
The ultimate answer depends on wether you want to embed a WHOLE pdf, or simply extract/create PDF contents as part of your web app.

Java: Embed a HTML or PDF into a JFrame

I am open to alternative solutions, so here is my problem.
I have 111 PDFs that contain information on various degree programs. I can convert them to HTML using freeware.
The problem with the HTML is that it contains CSS, JEditorPane doesn't display the webpage, and the PDF libraries are slow and bulky.
I want to have a JCombobox where users can select a page to view, and have it appear below the box.
Any ideas on the best method?
Use iText API for PDF and DJ Project for HTML/webPage.
Most libraries that convert PDF to HTML can also convert PDF to image.
If you can convert to SVG and display it using one of the SVG libraries (E.g. Batik), that would be one way you could display it without losing any functionality like zoom in/out.
Otherwise you can convert PDF to high-res JPG/PNG and display it in your app.

How to preview PDF using PDF Viewer on an Grails Application

I'm a novice Grails Programmer.I have 2 use case :
render image file show on GSP Page.
render PDF file and show on PDF Viewer integrate with GSP Page.
Can anyone provide examples of how to do this?
Please provide some more details for your actions but roughly I suspect you might want the following:
<img src="${createLinkTo(dir: 'images', file: '1.jpg')}" alt="Image"/>
I don't know of any PDF viewers that could be integrated with an HTML page let alone a one that would be specific to grails. Your best bet is to redirect people to the PDF file and let their own browser handle the file.

Categories

Resources