aspose file tools*
The moose likes XML and Related Technologies and the fly likes PDF file contents of word document using XSLT. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "PDF file contents of word document using XSLT." Watch "PDF file contents of word document using XSLT." New topic
Author

PDF file contents of word document using XSLT.

Rahul Ba
Ranch Hand

Joined: Oct 01, 2008
Posts: 205

Hi public,

I am creating pdf file through the XML, XSL and FOP. I want PDF file contents to display external file contents such as word document.
I know for displaying image in PDF we use <fo:external-graphic> but what tag we should to display file contents other than pdf file type.

Thanks in advance.

Rahul
Rahul Ba
Ranch Hand

Joined: Oct 01, 2008
Posts: 205

Ok, now I found workaround to this as extenal-garphic is only for images. I am reading the file contents and putting it into XML, XM L is pretty fine but when I use xslt to it it gives me following error:



My file data in XML is as



so, what I need to do so that I can put proper data into the PDF.

Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
There's a FOP extension that claims to be able to do this: http://www.jeremias-maerki.ch/development/fop/index.html

Also see http://xmlgraphics.apache.org/fop/1.0/extensions.html#external-document

Also, it looks like you tried to put binary data (such as a PDF) into XML - that won't work.
Rahul Ba
Ranch Hand

Joined: Oct 01, 2008
Posts: 205

I am using following code but when i run the program I am getting exception.




Exception as

Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
Did you declare the fox namespace properly? http://xmlgraphics.apache.org/fop/1.0/extensions.html#fox-namespace
Rahul Ba
Ranch Hand

Joined: Oct 01, 2008
Posts: 205
ok, I did the same changes but the same exception. Let me put the XSL code here for your better understanding:





Thanks in advance.
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
It is my understanding that using PDFs for fo:external-graphic and fox:external-document will only work if you've installed the FOP extensions I pointed you to; did you do that?
Rahul Ba
Ranch Hand

Joined: Oct 01, 2008
Posts: 205
Ya, I have put the following jar files in the classpath but it did not work

fontbox-0.8.0-incubating.jar
jempbox-0.8.0-incubating.jar
fop-pdf-images-2.0.0.SNAPSHOT.jar
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
Be sure to read the instructions carefully; it seems you missed a jar file.
Rahul Ba
Ranch Hand

Joined: Oct 01, 2008
Posts: 205
I have this pdfbox-0.8.0-incubating.jar in class path..bymistakely I forgot to mention in the previous mail.
Same thing is happening..Sorry for bothering...but I need some help ASAP.

Thanks for helping.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: PDF file contents of word document using XSLT.