XHTML is a text-based file format with markup in the XML format. This format is widely used because of being generic and involves less scripting. Whereas, PDF files are fixed-layout format files that are popularly used because of being platform-independent. In certain cases, you may need to convert XHTML files to PDF format. In accordance with such use cases, this article demonstrates how to convert XHTML to PDF format in Java.