Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

PDF file contents of word document using XSLT.

 
Rahul Ba
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 206
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 206
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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




Exception as

 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you declare the fox namespace properly? http://xmlgraphics.apache.org/fop/1.0/extensions.html#fox-namespace
 
Rahul Ba
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 206
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Be sure to read the instructions carefully; it seems you missed a jar file.
 
Rahul Ba
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic