For Programmers: Free Programming Magazines  


Home > Archive > Java Help > January 2006 > How to convert Doc, XLS to PDF using Java API









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to convert Doc, XLS to PDF using Java API
Ravi Velamuri

2006-01-26, 7:05 pm

Hi.

How to convert DOC, XLS files into PDF using Java API. Plz advice if
any already worked on this kind of. Thx.
Best
Ravi.

Rhino

2006-01-26, 7:05 pm


"Ravi Velamuri" <ravi.velamuri@gmail.com> wrote in message
news:1138286459.850377.306070@g49g2000cwa.googlegroups.com...
> Hi.
>
> How to convert DOC, XLS files into PDF using Java API. Plz advice if
> any already worked on this kind of. Thx.
> Best
> Ravi.
>


There is a project, POI, to read and write DOC and XLS files with Java.
There is also an existing package, iText, to write _new_ PDFs with Java.
However, I'm not aware of any way to _CONVERT_ DOC or XLS files to PDF
directly. Naturally, that doesn't mean that there is no way to convert them,
just that I don't know of any such tool.

You can find the POI project here: http://jakarta.apache.org/poi/. You'll
find that the ability to write XLS files is apparently fairly mature but
that the ability to write DOC files is still fairly primitive.

You can find the iText project here: http://www.lowagie.com/iText/.

Perhaps you could use POI to read your DOC and XLS files into a Java
program, extracting the relevant pieces of text, then writing them out again
in PDF format. I've never used POI, even for the most trivial of documents,
but I have been quite happy with iText so this approach _might_ work if POI
will co-operate.....

---
Rhino



Oliver Wong

2006-01-26, 7:05 pm


"Rhino" <no.offline.contact.please@nospam.com> wrote in message
news:xr6Cf.14116$ft2.234390@news20.bellglobal.com...
>
> "Ravi Velamuri" <ravi.velamuri@gmail.com> wrote in message
> news:1138286459.850377.306070@g49g2000cwa.googlegroups.com...
>
> There is a project, POI, to read and write DOC and XLS files with Java.
> There is also an existing package, iText, to write _new_ PDFs with Java.
> However, I'm not aware of any way to _CONVERT_ DOC or XLS files to PDF
> directly. Naturally, that doesn't mean that there is no way to convert
> them, just that I don't know of any such tool.
>
> You can find the POI project here: http://jakarta.apache.org/poi/. You'll
> find that the ability to write XLS files is apparently fairly mature but
> that the ability to write DOC files is still fairly primitive.
>
> You can find the iText project here: http://www.lowagie.com/iText/.
>
> Perhaps you could use POI to read your DOC and XLS files into a Java
> program, extracting the relevant pieces of text, then writing them out
> again in PDF format. I've never used POI, even for the most trivial of
> documents, but I have been quite happy with iText so this approach _might_
> work if POI will co-operate.....
>


I believe POI was used on a project in which I was involved (though I
did not directly use POI itself). From what I could see, POI would only give
you a logical view of the data, and, i.e. not a physical view. For example,
you could get the contents of cell (3:2), but there was no direct facility
for determining how wide the resulting string would be should you draw it
onto some surface, for example. I guess you could, though, extract the font
the value was written in, since that kind of info seems to be persisted by
Microsoft Excel.

So you MAY need to write a rendering engine in between POI and iText.

- Oliver


pachi

2006-01-26, 7:05 pm




Try http://www.gohtm.com/ The have a SDK for it

Rhino wrote:
> "Ravi Velamuri" <ravi.velamuri@gmail.com> wrote in message
> news:1138286459.850377.306070@g49g2000cwa.googlegroups.com...
>
> There is a project, POI, to read and write DOC and XLS files with Java.
> There is also an existing package, iText, to write _new_ PDFs with Java.
> However, I'm not aware of any way to _CONVERT_ DOC or XLS files to PDF
> directly. Naturally, that doesn't mean that there is no way to convert them,
> just that I don't know of any such tool.
>
> You can find the POI project here: http://jakarta.apache.org/poi/. You'll
> find that the ability to write XLS files is apparently fairly mature but
> that the ability to write DOC files is still fairly primitive.
>
> You can find the iText project here: http://www.lowagie.com/iText/.
>
> Perhaps you could use POI to read your DOC and XLS files into a Java
> program, extracting the relevant pieces of text, then writing them out again
> in PDF format. I've never used POI, even for the most trivial of documents,
> but I have been quite happy with iText so this approach _might_ work if POI
> will co-operate.....
>
> ---
> Rhino


William Brogden

2006-01-28, 7:05 pm

On 26 Jan 2006 06:40:59 -0800, Ravi Velamuri <ravi.velamuri@gmail.com>
wrote:

> Hi.
>
> How to convert DOC, XLS files into PDF using Java API. Plz advice if
> any already worked on this kind of. Thx.
> Best
> Ravi.
>


If you can get the data out of the DOC files,
the apache FOP project can convert XSL-FO documents to PDF

http://xmlgraphics.apache.org/fop/

--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
Ravi Velamuri

2006-01-30, 7:04 pm

May be i can put more clarity on the content that I am trying to
convert into PDF "my doc file will have text and images also".
if not using POI, any better idea..?Thx always.
-Ravi

Ravi Velamuri

2006-01-30, 7:04 pm

May be i can put more clarity on the content that I am trying to
convert into PDF "my doc file will have text and images also".
if not using POI, any better idea..?Thx always.
-Ravi

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com