Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

html to pdf convesiion

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have used jquery -jqplot to plot few line chats as per requirments, now these plots are to be saved in form of pdf which would be viewed as report.
The problem is that jqplot has only the feature to save the charts/plots as image which is not useful at this point.

Through search i found bullzip,pdf4ml,itext ,yahpconverter,icpdf are some of freewares used for html to pdf converstion. however i am not sure which is freeware and which api would be helpful for this kind of problem as here i need to save the entire web page.

could some one please guide me to the right path for implementing the nire web page to be saved as pdf docuement...?





 
Bartender
Posts: 3648
16
Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try iText since it's fairly simple to use and learn. You should able to find examples by Googling a bit.
 
Rancher
Posts: 43011
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you can make the HTML into CSS-styled XHTML; then http://code.google.com/p/flying-saucer/ is for you.
 
raj chopra
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Hi Tsang,

Thanks for reply, for more clarity, the page to be converted into pdf is in jsp, i am going through few of the sample codes in itex, my query is that is it possible for the itex to render graphs or charts from a jsp page rather than normal java code?

as the pdf is only useful when the graphs are rendered using jquery .
 
Ulf Dittmer
Rancher
Posts: 43011
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think iText would (or could) recreate anything created via JavaScript. For what purpose is this PDF? If people are interested in saving web pages as PDFs, they could always install a PDF printer driver (like PDF24 on Windows; OS X has one built in; not sure about Linux).

Also, do you want to do this on the server, or on the client?
 
raj chopra
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ulf dittmer,

Thanks for reply,

The page i want to convert to pdf contains barcharts,line charts, and some csv data ( which is viewed as table in front end) . To be more specific this is kind of report generated page which displays pictorial data in web browser.The purpose is that the charts displayed need to be saved as pdf some what similar like jasper soft. This is a typical web application.

I think saving entire web page as pdf would be very useful and server we use are windows, server side or client side both are welcomed .

Also i need to use only freeware please let me know how can i proceed.
 
Marshal
Posts: 67300
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What I would do is to add CSS for print media that hides the navigation and other page decoration, and leaves only the data portion of the page to be printed. If the user wants to capture it as a PDF, they can use the browser Print capability, and capture it as a PDF as Ulf has already suggested.

The end user must install the appropriate print driver on their client machine. You cannot do it for them. (I find it appalling that Windows does not have this native capability; it's been available in OS X since the start, and is something I use every single day.)

If that's not good enough, then you'll likely have to find a way to generate the chart on the server rather than the client, and create the PDF there. Personally, I would not take this approach.
 
K. Tsang
Bartender
Posts: 3648
16
Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Given you you mentioned, why not generate that page as a report format using Jasper Report.

Also for graphs and stuff, JFreeCharts is open source project for this kind of stuff. But I'm not sure if PDF can be generated.
 
That new kid is a freak. Show him this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!