Create a PDF version of your lesson using XSL-FO

Example of a PDF version (click image to download PDF) Example of a PDF version (click image to download PDF) In eLML you have two possibilities to create a PDF version of your lesson: Via XSL-FO or via LaTeX. The first method is described below, the latter method is described in the LaTeX chapter. Both methods have their advantages and drawbacks. For the XSL-FO approach (using the open source Apache FOP to process the FO file) the following drawbacks are known:

  • Both the Apache Formatting Object Parser (FOP) version 0.25 and 0.9 do not yet support the full range of XSL-FO commands which sometimes leads to layout errors. But since 2010 FOP 1.0 is out and you should make sure that the XML editor you are working with uses this latest release. If it doesnt, intall FOP 1.0 yourself.
  • The layout of the PDF file is defined via XSL-FO commands and cannot be changed easily.
  • The XSL-FO technique is generally spoken more complex and less known than LaTeX. But if you're fine with the included eLML transformation file (see PDF version of eLML website as an example) you don't have to care about this point anyway. Just go through the four steps below and you're done.

How to create a PDF version of your lesson:

  1. Open the "Introduction to Database Systems" lesson XML file in oXygen or XMLSpy.
  2. Have a look at the "print" section of your projects configuration file. With the $display_links parameter you can tell the parser if the full URL of links used in your lesson should be printed or not (they are clickable links in both cases but that of course only works if you look at your PDF on your computer). Furthermore you can define if hyphenation should be used, which Apache FOP version you are working with, etc.
  3. This time use the following XSLT file for transformation:
  4. In your oXygen transformation scenario click the "Perform FO Processing" mark in the middle tab and enter a "real" output path. For example you can enter ${cfd}/${cfn}.pdf and oXygen stores the PDF file in the same folder as your XML file.

Use the Template Builder to customize the look of your PDF file! If you want to adapt the look of your PDF file even more you will need to create your own eLML layout template for the FO-transformation. But beware: FO is not for the faint-hearted :-)

If you are using term SVG within your lessons you can use it directly within your PDF file. In Adobe Flash or Illustrator you can export your graphics as SVG. Add this SVG file to your lesson.xml file using the "multimedia" element. You might want to set the "visible" attribute to "print" to make sure that this file is only used within the print-version. Then transform your lesson as described above into an FO file and use the Adobe FO parser to transform the file into a PDF document.

Install Apache FOP 1.0 (with hyphenation) yourself

  1. Go to the Apache FOP website and download the latest stable binary release of FOP 1.0
  2. To be able to use hyphenation go to the OFFO-project (Objects For Formatting Objects) and download the latest stable release plus the "offo-hyphenation-utf8" files.
  3. After unzipping the files move the "fop-hyph.jar" file into the "build" folder (where the fop.jar file resides) and move the whole "hyph" folder (with all the different language hyphenation patterns) into the main FOP-folder where the "build"-folder is also located.
  4. Now Apache FOP is ready to be used in command line mode with e.g. the following command:
    /path-to-fop-folder/fop /path-to-workspace/project/lesson/en/text/ /path-to-workspace/project/lesson/en/text/lesson.pdf

Including SVG and MathML in your PDF

Apache FOP supports the rendering of both SVG-images and MathML-formulas within your PDF, but you will need two additional libraries:

If you are using an XML editor like Oxygen, chances are good that Apache FOP is already installed with the two libraries above. Otherwise you will have to follow the according manuals to download and install the libraries. Usually all you have to do is download the library and move it into the "bin" folder of your Apache FOP installation.

For more information visit the FOP installation guide.