Browse DevX
Sign up for e-mail newsletters from DevX


Publishing XML Documents in PDF and HTML with Cocoon : Page 4

Sure, you can create a custom framework for multi-format publishing, but why bother? It's already been done. Take advantage of Apache Cocoon's ability to deliver PDF and HTML documents on demand.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Test the Application
To test the application, browse to these URLs:

http://localhost:8080/cocoon/xmltopdf/pageOne.pdf http://localhost:8080/cocoon/xmltopdf/pageTwo.pdf http://localhost:8080/cocoon/xmltopdf/pageOne.html http://localhost:8080/cocoon/xmltopdf/pageTwo.html

As an example, the output for pageTwo.pdf will look something like Figure 2.

Figure 2. Coccon PDF Output: The figure shows Cocoon's PDF output for the pageTwo.pdf file.
Following the steps listed in this article should get you up and running quickly using Cocoon. Download all the source code for this article to get a quick example. For follow-up information, I suggest you visit Apache's Web site. Cocoon collaborates with other Apache Projects and has a lot more to offer than the simple features described in this article.

Puneet M. Sangal, Practice Manager, has 12 years' experience in global management, project management, selling services, consulting, and software development in Europe, Pacific, India, and the U.S. He has studied executive management at IIM Calcutta, and holds an MS from Northeastern University in Boston, MA, and a BE from BIT Ranchi.
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date