Publishing Books Using XML Technologies
Dr. Herong Yang, Version 4.01

PDF Document Generation with hyPub Perl Programs

This section describes how a Perl program is used to control the PDF documents generation process

Introduction to Perl

Perl is the most flexible scripting language that you can use for managing text files and executing other programs. If you want to try it, follow these steps:

1. Download ActivePerl from http://www.activestate.com/Products/ActivePerl/.

2. Install it by following the installation instructions.

3. Try the hello.pl program:

   print "Hello world!\n";

3. Try the dir.pl program with executes another program through the system function:

   system("dir \\");

pdf.pl - A Perl Program to Generate PDF Documents

In order to perform the steps described in the previous section, I wrote a Perl program called pdf.pl. You can run pdf.pl with 3 command options:

1. "pdf.pl compile" - It does the following steps to generate Web page files:

  • Validating the book source files to make sure they are well formed XML files.
  • Merging multiple book source files into a single source file, if there a single book is stored in multiple source files.
  • Splitting the source file into multiple XML files with one file per chapter and per section.

2. "pdf.pl link" - It works on all XML files to evaluate variables and build hyper links.

3. "pdf.pl finish" - It does the following final steps:

  • Merging all XML files back into a single final XML file.
  • Transforming the final XML file to an XSL-FO document.
  • Formatting the XSL-FO document to a PDF document.

Table of Contents

 About This Book

 Ideas on Publishing Books using XML

 Overview of hyPub - A Simple XML Publishing Tool

 Writing Book Contents in XHTML Source Files

 Transforming Book Source Files with XSL Technology

 Designing Web Page Layouts with Tables

 Controlling Web Page Appearance with CSS

 Sharing HTML Codes with JavaScript Files

 Generating Web Pages with hyPub

 Formatting Printable Documents with XSL-FO

Generating PDF Documents with hyPub

 Requirements on PDF Version

 PDF Documents Generation Steps

PDF Document Generation with hyPub Perl Programs

 hyPub Sample PDF Documents and Source Code

 Areas of Future Improvements

 References

 PDF Printing Version

Dr. Herong Yang, updated in 2007
PDF Document Generation with hyPub Perl Programs