This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doc to Pdf conversion using Java Code

 
Praveen Kumar Anekalmath
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

I need to extract data from Doc to Pdf. How do i approach it? Is there any standard API for this.Please help.
 
Joe Ess
Bartender
Posts: 9214
9
Linux Mac OS X Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Our Accessing File Formats FAQ has several options.
I've had good results using OpenOffice.
 
Praveen Kumar Anekalmath
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Joe Ess,

I tried using Open Office as Doc to Pdf convertor and its working fine.
But in my application the requirement is to genearate doc file using VM templating and it is happening. But i want to generate PDF using VM template. Is this possible to approach? Please suggest.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is a "VM Template"?

If whatever you're doing can be done in OpenOffice, then you might be able to use the OpenOffice Java API to automate it.
 
Praveen Kumar Anekalmath
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ulf Dittmer,
Thanks for the reply.This is my requirement :
The records coming from the database has to be shown in table along with header and footer in Doc. To approach this, i have used org.apache.velocity.Template;
org.apache.velocity.VelocityContext;
org.apache.velocity.app.VelocityEngine;
Using this template it is successfully generating Doc. But i need to generate Pdf along with this Doc. I tried OpenOffice Api to convert Doc to Pdf, but it is not able to recognize the Doc file that is generated by Velocity Engine.When i take any other Doc other than generated from VM its converting into Pdf without any problem.
Even i tried Apache POI to read the Doc file, its throwing error :java.io.IOException: Invalid header signature; read 7311066695147732796, expected -2226271756974174256
I opened the Doc generated from VM in Editplus and it look like this :



Is there any problem in this doc?
Please help how can i read this from either OpenOffice or Apache POI?

[Edited by Jaikiran to enclose the xml in Code tags]
[ July 08, 2008: Message edited by: Jaikiran Pai ]
 
zett ucu
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Praveen Kumar Anekalmath wrote:Hi All

I need to extract data from Doc to Pdf. How do i approach it? Is there any standard API for this.Please help.



Try this page: http://www.dancrintea.ro/doc-to-pdf/
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic