<commit_before>= asciidoctor-fopdf
<NAME> <https://github.com/mojavelinux>
:license: https://github.com/mojavelinux/asciidoctor-fopdf/blob/master/LICENSE[MIT]
:idprefix:
:idseparator: -

ifndef::icons[]
[float]
= asciidoctor-fopdf
endif::icons[]

DocBook-to-PDF conversion using free software made easy! (based on DocBook XSL and Apache FOP)

Using the asciidoctor-fopdf project, you can convert any DocBook file into a nicely formatted PDF with nothing more than a Java runtime (JVM).
All the open source software required to perform the conversion is automatically fetched from trusted binary repositories the first time you run it.

== Doing is believing

Before we get into the goals and the technical details of the project, let's see the conversion happen.

=== Prerequisites

The only prerequisite to perform the DocBook to PDF conversion is a Java runtime (JVM) (and, naturally, an internet connection).
You can use any recent Java runtime (i.e., Java 6 or better).

If Java is setup correctly, you should be able to type:

 $ java -version

or

 $ "$JAVA_HOME/bin/java -version"

and see output that looks like:

....
java version "1.7.0_25"
OpenJDK Runtime Environment (fedora-2.3.10.3.fc17-x86_64)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
....

If not, you can install a Java runtime using your system's package manager or by downloading a distribution from the http://java.com/en/download[Java download site].

It's not even necessary to install the Java runtime into your system.
Simply set the +JAVA_HOME+ environment variable to the location where you extract the distribution.

Next, you need to retrieve the asciidoctor-fopdf project.

=== Retrieve the project

You can retrieve the asciidoctor-fopdf project in one of two ways:

. Clone the git repository
. Download a zip archive of the repository

If you want to clone the git repository, simply copy the URL of the repository on GitHub and pass it to +git clone+ command:

 $ git clone https://github.com/mojavelinux/asciidoctor-fopdf

Next, change to the project directory:

 $ cd asciidoctor-fopdf

If you want to download a zip archive, click on the button:[Download Zip] button on the right-hand side of the repository page on GitHub.
Once the download finishes, extract the archive, then open a shell and change to that directory.

Now you're ready to convert!

=== Generate a DocBook file

If you don't already have a DocBook file, you can generate one using Asciidoctor (or your tool of choice).

To create a DocBook file using Asciidoctor, first create an AsciiDoc file in the current directory and populate it with this sample content:

.sample.adoc
[source,asciidoc]
----
= Hello, AsciiDoc!
Doc Writer <<EMAIL>>
:doctype: book
:toc:
:numbered:

An introduction to http://asciidoc.org[AsciiDoc].

== First Section

* item 1
* item 2

[source,ruby]
puts "Hello, World!"

TIP: asciidoctor-fopdf takes the pain out of converting a DocBook file to a PDF file like this one.
----

Next, convert the AsciiDoc file to DocBook:

 $ asciidoctor sample.adoc

You should now see a file named [file]_sample.xml_ in the current directory.
We'll now convert that file to PDF.

TIP: You could also try these steps using the [file]_README.adoc_ file in the root directory of the project.<commit_msg>Fix Asciidoctor command<commit_after>= asciidoctor-fopdf
<NAME> <https://github.com/mojavelinux>
:license: https://github.com/mojavelinux/asciidoctor-fopdf/blob/master/LICENSE[MIT]
:idprefix:
:idseparator: -

ifndef::icons[]
[float]
= asciidoctor-fopdf
endif::icons[]

DocBook-to-PDF conversion using free software made easy! (based on DocBook XSL and Apache FOP)

Using the asciidoctor-fopdf project, you can convert any DocBook file into a nicely formatted PDF with nothing more than a Java runtime (JVM).
All the open source software required to perform the conversion is automatically fetched from trusted binary repositories the first time you run it.

== Doing is believing

Before we get into the goals and the technical details of the project, let's see the conversion happen.

=== Prerequisites

The only prerequisite to perform the DocBook to PDF conversion is a Java runtime (JVM) (and, naturally, an internet connection).
You can use any recent Java runtime (i.e., Java 6 or better).

If Java is setup correctly, you should be able to type:

 $ java -version

or

 $ "$JAVA_HOME/bin/java -version"

and see output that looks like:

....
java version "1.7.0_25"
OpenJDK Runtime Environment (fedora-2.3.10.3.fc17-x86_64)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
....

If not, you can install a Java runtime using your system's package manager or by downloading a distribution from the http://java.com/en/download[Java download site].

It's not even necessary to install the Java runtime into your system.
Simply set the +JAVA_HOME+ environment variable to the location where you extract the distribution.

Next, you need to retrieve the asciidoctor-fopdf project.

=== Retrieve the project

You can retrieve the asciidoctor-fopdf project in one of two ways:

. Clone the git repository
. Download a zip archive of the repository

If you want to clone the git repository, simply copy the URL of the repository on GitHub and pass it to +git clone+ command:

 $ git clone https://github.com/mojavelinux/asciidoctor-fopdf

Next, change to the project directory:

 $ cd asciidoctor-fopdf

If you want to download a zip archive, click on the button:[Download Zip] button on the right-hand side of the repository page on GitHub.
Once the download finishes, extract the archive, then open a shell and change to that directory.

Now you're ready to convert!

=== Generate a DocBook file

If you don't already have a DocBook file, you can generate one using Asciidoctor (or your tool of choice).

To create a DocBook file using Asciidoctor, first create an AsciiDoc file named [file]_sample.adoc_ in the current directory and populate it the sample content below.

.sample.adoc
[source,asciidoc]
----
= Hello, AsciiDoc!
Doc Writer <<EMAIL>>

An introduction to http://asciidoc.org[AsciiDoc].

== First Section

* item 1
* item 2

[source,ruby]
puts "Hello, World!"

TIP: asciidoctor-fopdf takes the pain out of converting a DocBook file to a PDF file like this one.
----

Next, convert the AsciiDoc file to DocBook:

 $ asciidoctor -b docbook -d book -a toc -a numbered sample.adoc

You should now see a file named [file]_sample.xml_ in the current directory.
We'll now convert that file to PDF.

TIP: You could also try these steps using the [file]_README.adoc_ file in the root directory of the project.
{'fraction_non_alphanumeric': 0.07294510160752199, 'fraction_numerical': 0.007885956930542918, 'mean_word_length': 4.271782573940848, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '165903', 'n_tokens_mistral': 1999, 'n_tokens_neox': 1890, 'n_words': 927}