Loading...
X

What program to open .docbook files (DocBook)

In fact, .docbook files are not meant to be read – they are meant to be converted to HTML, man, PDF, DOCX, ODT, EPUB, FictionBook2, and many others.

What is DocBook?

DocBook is an XML-based standard used in many modern documentation tasks. When you want to create a DocBook document source, you write XML files that describe the document's layout, paragraphing, and other attributes. The structure of the XML file may sound familiar to you if you've seen HTML before. XML tends to be an improvement over the old HTML specification and can be used to create complete web pages and other markup documents.

What are the benefits of DocBook?

DocBook is the OASIS standard and the format in which most open source projects store their documentation. Docbook is developed as an open source application. The project is hosted on SourceForge and is available under the GPL license. DocBook is available as Document Type Definition (DTD) and XML Schema (XSD). The project has a large developer and support community, spanning both open source and commercial groups.

The most important reasons why DocBook is used in projects:

  • DocBook is the standard
  • DocBook open source
  • DocBook is used in most large projects
  • DocBook has a large developer and support community.

DocBook is also an XML application, and XML technologies solve a number of publishing problems for documentation teams, including:

  • Single source
  • Joint development
  • Cross-platform editing
  • Multichannel publishing
  • Improving the quality and consistency of information
  • Expanding the functionality of electronic withdrawal
  • Opt out of vendor binding

If you are already familiar with XML, then you can start learning DocBook. If you don't understand XML, the good news is that learning DocBook will help you learn XML. Below are two must-read books for anyone new to DocBook.

DocBook – The Definitive Guide http://www.docbook.org/tdg/en/html/docbook.html

DocBook XSL – The Complete Guide http://www.sagehill.net/docbookxsl/index.html

But I think you came to this article first of all in order to open a DocBook file. Well, or at least convert.

DocBook in Writer (LibreOffice)

If you just need to quickly open the .docbook file, then you don't even need to install additional programs if you already have LibreOffice. Writer can open .docbook files. But I strongly discourage this option, because for some reason Writer skips completely random pieces of text without indicating it in any way. In the opened file, about 10% may be missing! Use this only as a last resort.

How to convert DocBook to PDF

Next, we will consider a universal program that can convert to many formats, including PDF. But if you just need PDF, then I highly recommend dblatex (DocBook to LaTeX Publishing), which can convert DocBook (XML and SGML) to DVI, PDF, PostScript using latex. The thing is, dblatex makes the most beautiful PDFs! These PDFs include a table of contents and other elements that are simply missing in the universal program.

Install the dblatex package.

Then just run a command like:

dblatex FILE.docbook

FILE.pdf will be created in the same folder.

Pandoc – universal document converter

If you need to convert files from one markup format to another, pandoc is your Swiss army knife. Pandoc can convert between numerous formats, a full list of them can be found on the program's website: https://pandoc.org/

Install the pandoc package.

Then run one of the following commands:

pandoc --from docbook --to docx --output myDocbook.docx myDocbook.xml

pandoc --from docbook --to odt --output myDocbook.odt myDocbook.xml

pandoc --from docbook --to latex --output myDocbook.pdf myDocbook.xml

pandoc --from docbook --to epub3 --output myDocbook.epub myDocbook.xml

pandoc --from docbook --to markdown --output myDocbook.md myDocbook.xml

pandoc --from docbook --to html --output myDocbook.html myDocbook.xml

As you might have already figured out:

  • –from is the original format
  • –to – the format to convert to
  • –output is the filename for the new format
  • myDocbook.xml – The original DocBook document.

Everything is very simple. But for PDF I recommend dblatex!

Other programs for converting DocBook

There are a few more applications that you may find useful if you want to convert a DocBook file to a different format.

  • kdoctools – Generate documentation from docbook.
  • poxml – Translates DocBook XML files using gettext po files
  • docbook2x is a software package that converts DocBook documents to the traditional Unix manual page format and the GNU Texinfo format.
  • docbook-to-man – batch converter from DocBook SGML to nroff/troff macros man.

Leave Your Observation

Your email address will not be published. Required fields are marked *

Scroll Up