File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes Generating PDFs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Generating PDFs" Watch "Generating PDFs" New topic
Author

Generating PDFs

Viji Bharat
Ranch Hand

Joined: Sep 18, 2000
Posts: 101
All:
I tried one examples from O'Reilly Chapter 9 - http://www.oreilly.com/catalog/javaxml/chapter/ch09.xml (Examples 9-1 and 9-2) by creatint the ChapterOne.xml and <<associated file>>.xsl files. This is supposed to convert the XML to a PDF file. However, when I open ChapterOne.xml using the browser, I get only one line
type="text/xslfo"
What is wrong? I have no clue. Can anyone help me?
Frank Daly
Ranch Hand

Joined: Mar 31, 2000
Posts: 139
Hi Viji
You should go to http://xml.apache.org/cocoon/faqs.html#faq-iepdfbug
frank
Viji Bharat
Ranch Hand

Joined: Sep 18, 2000
Posts: 101
Frank:
Thanks for the link. I am using Cocoon 1.8.2 but I still couldn't get it working. I think I have something wrong in the setup. I followed the Cocoon instructions but could not find out what is wrong.
My cocoon directory is c:\cocoon and my build directory with all the cocoon classes are in C:\Cocoon\build directory.
I have created a cocoon directory under c:\tomcat\webapps and have copied the necessary .jar files from c:\cocoon\lib to c:\tomcat\lib and also copied the samples directory from c:\cocoon to c:\tomcat\samples.
Besides these, is there anything else I should do? Any specific settings in web.xml under c:\tomcat\webapps\cocoon\web-inf?
Any suggestions?

[This message has been edited by Viji Bharat (edited February 02, 2001).]
Frank Daly
Ranch Hand

Joined: Mar 31, 2000
Posts: 139
Hi Viji,
Are you able to see Cocoon.xml in your browser? This indicates that your cocoon setup is ok.
Displaying ChapterOne.xml is a separate problem. The file shold display correctly in Netscape but in IE there is non standard implementation. I made a change to web.xml file that you mentioned. I added a line near the end something like <urlpattern>*.pdf</urlpattern> just like the *.xml line. This tells tomcat to use cocoon to display .pdf files. Change the name of the ChapterOne.xml file to ChapterOne.pdf
Hopefully your pdf should display ok.
frank
Viji Bharat
Ranch Hand

Joined: Sep 18, 2000
Posts: 101
Frank:
I get this error when I try to view Cocoon.xml from my browser (IE 5.0). Any suggestions to correct this error?
Viji
Publishing Engine could not be initialized.
java.lang.RuntimeException: Exception when creating " org.apache.cocoon.processor.xsp.XSPProcessor" :
java.lang.NoSuchMethodError: See http://xml.apache.org/cocoon/faqs.html#faq-normalize
at org.apache.cocoon.framework.Manager.create(Manager.java:124)
at org.apache.cocoon.framework.Router.init(Router.java:80)
at org.apache.cocoon.framework.Manager.create(Manager.java:109)
at org.apache.cocoon.Engine.<init>(Engine.java:179)
at org.apache.cocoon.Engine.getInstance(Engine.java:232)
at org.apache.cocoon.Cocoon.init(Cocoon.java:157)
at org.apache.tomcat.core.ServletWrapper.doInit(ServletWrapper.java:317)
at org.apache.tomcat.core.Handler.init(Handler.java:215)
at org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:296)
at org.apache.tomcat.core.Handler.service(Handler.java:254)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:484)
Frank Daly
Ranch Hand

Joined: Mar 31, 2000
Posts: 139
hi Viji
I posted a way of installing cocoon; it's at http://www.javaranch.com/ubb/Forum31/HTML/000151.html
and is the second post at this link. If i was you i'd reinstall cocoon.
hope this works
frank
Viji Bharat
Ranch Hand

Joined: Sep 18, 2000
Posts: 101
Frank:
I reinstalled cocoon 1.8.2 and made the necessary changes to server.xml, web.xml etc. but still I get the error "Publishing engine could not be initialized".
If any of you had the same problem and found a way to correct this error, please let me know how you corrected the problem.
Viji
Frank Daly
Ranch Hand

Joined: Mar 31, 2000
Posts: 139
Hi Viji
I'm using cocoon 1.8 and I didn't get this problem. There is a faq at http://xml.apache.org/cocoon/faqs.html which includes your problem.
frank
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Generating PDFs