Yet Another Free Pdf Composer

Setup Steb by Step.


Back Home Next

First of all you need a proper installed Java runtime environment (JRE) version 1.5.0 or above on your system. You can get the current version for free from Sun Microsystems, using this link: java.sun.com. Choose the „Download J2SE JRE“ entry there. You can test, whether you have installed a JRE by opening a command-line and entering

java -version

(Note the space between „java“ and „-version“!!!). Check the output for a responding Java with version 1.5.0 or above.

Now download one of the YAFPC archives and create a directory for installing it to (on Windows „C:\Program files\yafpc“ would be a good choice) and unpack the YAFPC archive there. Once unpacked, you will find a file „YAFPC-2x.jar“ there, which is the main program. The other unpacked files are example scripts and files for testing it under several environments.

Because YAFPC runs in a Java environment, it must be started using a call to java with the program name YAFPC-2x.jar as the argument for java. In order to start YAFPC, open a command line window, change to the directory where YAFPC is installed and invoke:

java -jar YAFPC-2x.jar

Append the arguments for YAFPC if needed.

Please note: It is assumed here, your current directory is the one, where the YAFPC-2x.jar file resides. Otherwise you must invoke the full path to YAFPC-2x.jar as the argument for Java.

1. Starting YAFPC without arguments (GUI-Setup)

2. Starting YAFPC with arguments (Normal PDF-composing)

3. Setting up a PDF-printer/mailer on Windows

4. Setting up a PDF-printer/mailer for Windows clients on a Linux server

1. Starting YAFPC without arguments (GUI-Setup)

Start YAFPC without any arguments. A dialog window „Profile Editor“ will appear. There can be chosen the files to be used as input, cover sheet, letterheads, watermark, appendix and output. Also a mail receiver and a SMTP-server can be set. See a screenshot here:

(Screenshot)

By clicking the „Test“ button, your current settings are tested. According to your settings, an output-PDF should be created or sent to the mail receiver. If you didn't chose an input file, it was assumed, you want to use StdIn. Then the file „InputTest.pdf“ is sent to StdIn for testing.

To save your settings in a YAFPC-Profile (*.fpc), simply chose a filename for the profile and click the „Save and Exit“ button. Now you're ready to use this profile by giving its path with the „-p“ argument to YAFPC on the command line.

Top

2. Starting YAFPC with arguments (Normal PDF-composing)

YAFPC was designed to run in a command-line environment, creating PDF-documents from its input. The GUI Profile Editor, mentioned above, is provided only for comfortable setup and testing. On a command-line or in some script YAFPC is started by invoking „java -jar YAFPC-2x.jar <arguments>“. Possible arguments are:

-i   path to input file
This is the input for creating the document. It must be in PDF-format (further versions of YAFPC maybe able to process RTF- and PS-formats too). If the „-i“ argument is omitted, StdIn will be assumed as the input source.
-o   path to output file
This is the output document, composed as PDF file from the given input and the other files. If the „-o“ argument is omitted, the output will be given to StdOut. If a „Mail receiver (-m)“ is given while „-o“ is omitted, a temporary file will be created and deleted after the mail was successful sent.
-f   path to „First page letterhead“
This is the PDF-file used as letterhead for the first page of the created document. If the „-f“ argument is omitted, the „Next page letterhead (-n)“ is used for the first page too. The „First page letterhead“ must be a PDF-File, containing ONE page only.
-n   path to „Next page letterhead“
This is the PDF-file used as letterhead for the second and all further pages of the created document. If the „-n“ argument is omitted, no letterhead will appear. The „Next page letterhead“ must be a PDF-File, containing ONE page only.
-a   path to „Pages for appending“
This is the PDF-file to be appended to the output document. If the „-a“ argument is omitted, no pages will be appended. If a „Next page letterhead (-n)“ is given, it will be applied to the appended pages too.
-c   path to „Cover sheet“
This is the PDF-file used as cover sheet. It is printed before the input file. No watermark or letterhaed is applied to the cover sheet. The cover sheet PDF-file may contain one or more pages. If the „-c“ argument is omitted, no cover sheet will be printed.
-w   path to „Watermark file“
This is a picture file to be used as watermark for all pages of the output document except of the cover sheet. The watermark file must be in one of the image formats GIF, JPG, PNG or BMP. If the „-w“ argument is omitted, no watermark will be printed.
-m   Mail receiver;
This is the e-mail address, the output document is sent to as attachment. The given string may contain ONE e-mail address only. It's not possible to give more the one receiver here. The format is „SomePerson@SomeDomain.Somewhere“ If the „-m“ argument is omitted, no mail will be sent.
-S   Mail sender;
This is the e-mail address given as "mail from" in the sent email. The given string may contain ONE e-mail address only. The format is „SomePerson@SomeDomain.Somewhere“ If the „-S“ argument is omitted, the "mail from" field will be filled with "username@machine name".
-s   SMTP server
This is the SMTP server to be used for sending mail. The SMTP server must be reachable for YAFPC and must accept relaying for the given mail receiver. The format is an IP-address in dotted notation (192.168.1.123) or a fully qualified hostname (SomeServer.SomeDomain.Somewhere). If the „-s“ argument is omitted while „-m“ is given, it is assumed the „localhost“ should act as SMTP server.
-P   SMTP port
This is the SMTP port number to be used. If no port is given the default port 25 is used.
-U   SMTP auth user
If SMTP authentification is required this is the username. If ommitted no authentication is done.
-A   SMTP auth password
If SMTP authentification is required this is the password. If ommitted no authentication is done.
-u   User Password
This is the „User Password“ for reading the created document. If the user password is omitted, everyone can read the document.
-r   Owner Password
This is the „Owner Password“ for manipulating the created document. If the owner password is omitted and encryption is enabled a random owner password is used and nobody can change the document.
-p   Path to profile
This is the path to a „Profile“, created by the „Profile Editor“. The profile is a file, containing the chosen arguments in XML-format. Arguments, contained in the profile, don't need be given on the command line. If any of the arguments is given in the profile AND on the command line, the command line argument overrides the profile setting for this argument.
Top

3. Setting up a PDF-printer/mailer on Windows

Step 1: Download and install „RedMon“. RedMon is free and provides a printer port on your system, which can redirect any printer driver output to any external program. You can download it from http://www.cs.wisc.edu/~ghost/redmon/index.htm. For more information about how to install and setup RedMon, please refer to their online help. After installing RedMon, create a new local printer and redirect it to one of the „Redirected Ports“ (e.g. RPT1:), provided by RedMon. Install a color PS printer driver for it. You can use any Postscript printer driver. Using the „HP Color LaserJet 8500 PS“ driver would be a good choice.

Step 2: Download and install „Ghostscript“. Ghostscript provides the conversion from Postscript (the output of the printer, installed with step 1) to PDF (the input for YAFPC). You can download Ghostscript from http://sourceforge.net/projects/ghostscript/. For more information about how to install and setup Ghostscript, please refer to the „Install.htm“, coming with the download.

Step 3: If you don't have a Java Runtime Environment on your system, download and install it now. You can test, whether you have a JRE installed by typing

java -version

on a command line. For more information refer to the top of this page.

Step 4: Download and unpack YAFPC, like described in the „Download“ section. There is no need for any „installation“. Simply create a new directory for it and unpack it there.

Step 5: Start YAFPC without any arguments; the Profile Editor will appear. On Windows with a proper installed JRE, you can start YAFPC by double-clicking the „YAFPC-2x.jar“ file. Chose a location and filename for your first profile, select all the files, you want YAFPC to compose to the output PDF. Leave the input file blank. If you don't have proper files for the letterheads, watermark and appendix yet, you can use the sample files in the „Demo“ subdirectory. Chose an output filename or invoke your email address and SMTP server. Then click the „Test“ button. A PDF output will be created or sent to the given address.

Step 6: Open the „WindowsPrinter.bat“ file with any text editor and edit the variables PROFILE, YAFPC, DOMAIN, GHOSTSCRIPT, PDFFILE and LOGFILE. Invoke proper pathes according to your local installation. Please note: It is assumed in the „WindowsPrinter.bat“ file, that the network login names of your users are the same as the mail addresses. If this is not the case, you may need some kind of address aliases for mail sending.

Step 7: Open the „Properties“ of the printer, you have installed in step 1. Select the „Ports“ tab and click „Configure“. Invoke a path to the program „redrun.exe“, installed with RedMon in step 1 in the „Redirect this port to the program“ field. This should look something like this:

C:\Programme\RedMon\redrun.exe

Further invoke a path to the „WindowsPrinter.bat“ file in the „Arguments for this program“ field, giving it the argument „%1“. This should look something like this:

C:\Programme\yafpc\WindowsPrinter.bat %1

Step 8: Open some program, you want to print a PDF from and print to the printer, installed in step 1. That's it.

Top

4. Setting up a PDF-printer/mailer for Windows clients on a Linux server

I'm not a Linux guru! Don't ask me questions about how to install, setup or where to get some program for Linux.

There are several methods for printing in Linux. The following example shows, how I've got it working for me. My Linux box is a 486DX2-50 notebook with 16 MB RAM and a 850 MB HDD, running Slackware 9.1, providing some network services like DHCP, DNS, POP3, SMTP, VPN-tunneling and SAMBA (with a PDF-Printer/Mailer of course). As far as I know, my print system is „BSD-style“. The following description lists the steps, I have done for the printer setup.

Step 1: Make shure you have installed the following programs ( In brackets I've given the versions, which are installed on my machine): Ghostscript (EGS Ghostscript 7.01.1), ps2pdf (ps2pdfwr 1.4), lpr (LPRng-3.8.22), Samba (Samba 3.0.2a), sed (sed 3.02), sendmail (sendmail 8.12.10) and a JRE of course (j2re 1.4.2_01-b06). They all must be proper installed and configured, before you can continue.

Step 2: Edit your „/etc/printcap“ file. Insert the following lines:

pdfwriter:\
:ml#0:\
:mx#0:\
:sd=/var/spool/lpd/pdfwriter:\
:af=/var/spool/lpd/pdfwriter/pdfwriter.acct:\
:sh:\
:lp=/dev/null:\
:lpd_bounce=true:\
:if=/usr/local/yafpc/LinuxPrinter.sh:

This creates a new printer named „pdfwriter“, which passes its print-output to a script, named „/usr/local/yafpc/LinuxPrinter.sh“. „LinuxPrinter.sh“ will create the PDF document and send it to the user. The script reads as follows:

#!/bin/bash
#####################################################
# Sample script to be given to lprn via /etc/printcap
#####################################################

# Edit the following varables to your settings:

DOMAIN="localhost"
PROFILE="/usr/local/yafpc/MakeDemoLinux.fpc"
LOGFILE="/var/spool/lpd/yafpc.log"
YAFPC="/usr/local/yafpc/YAFPC-2x.jar"

# Edit these lines only when you know, what you are doing!
USER="`echo $1 | sed -e 's/-A//' | awk -F@ '{ print $1 }'`"
ADDRESS=$USER@$DOMAIN
RANDM=$RANDOM
PSFILE="/tmp/$USER-$RANDM.ps"
PDFFILE="/tmp/$USER-$RANDM.pdf"
PDF=`which ps2pdf`
JAVA=`which java`

echo ----------------- >> $LOGFILE
date >> $LOGFILE
echo $USER >> $LOGFILE
echo $PROFILE >>$LOGFILE
echo $PDFFILE >>$LOGFILE

cat > $PSFILE

$PDF -dPDFSETTINGS=/prepress $PSFILE $PDFFILE
$JAVA -jar $YAFPC -i $PDFFILE -p $PROFILE -m $ADDRESS 2>> $LOGFILE

rm -f $PSFILE
rm -f $PDFFILE

The script first makes some calculation, to get the user's mail-address, makes some log output, then creates a Postscript-file with a random name in „/tmp“ from its standard-in. Please note: The client's printer driver must create „Postscript“!

Then „ps2pdf“ is called with some arguments to make a PDF-file with a random name in „/tmp“. After that „YAFPC“ is called with a profile, named „MakeDemoLinux.fpc“, the user's mail-address and the PDF-file as input file, passed to it as arguments.

YAFPC creates the PDF-document and sends it to the given mail-address. Finally it removes the created tmp files.

You can find the sample-files in the downloaded YAFPC archive.

Step 3: Download and unpack YAFPC, like described in the „Download“ section. There is no need for any „installation“. Simply create a new directory for it and unpack it there. The „/usr/local/yafpc“ would be a good place for unpacking the YAFPC stuff. Please note: In the enclosed samples, this place is assumed to be used.

Step 4: Start YAFPC without any arguments; the Profile Editor will appear. Remember: To start YAFPC, you have to invoke:

java -jar YAFPC-2x.jar

on a command line.

NOTE: For the GUI „Profile Editor“ of YAFPC to show up, you must call it from a terminal window out of your window manager. If you don't use a GUI on your Linux box, you may need to use YAFPC's „Profile Editor“ on another machine!

Chose a location and filename for your first profile, select all the files, you want YAFPC to compose to the output PDF. Leave the input file blank. If you don't have proper files for the letterheads, watermark and appendix yet, you can use the sample files in the „Demo“ subdirectory. Chose an output filename or invoke your email address. Then click the „Test“ button. A PDF output will be created or sent to the given address.

Step 5: If nessesary, edit the „LinuxPrinter.sh“ file to make the „PROFILE“ variable pointing to your profile.

Step 6: Now send some Postscript-file to your printer by invoking:

lp -d pdfwriter SomePsFile.ps

on a command line. If you don't have any Postscript-file, you can use the sample „DemoInput.ps“, coming with YAFPC. If the PDF-document arrives at your mail-address, most is done.

Step 7: If you want Windows users to be able to use the created „pdfwriter“, you must configure your Samba now, to provide the printer to Windows in your network. Please (PLEASE!!!) refer to the Samba documentation to learn, how to make that. You may also want your Samba server provide some printer driver for automatic driver installation on Windows machines. Nag the Linux gurus with questions about that, if you don't know it. You can use any color PS printer driver for that. The „HP Color LaserJet 8500 PS“ does a good job on my machine.
Thats it. Have fun!

Top

Valid HTML 4.01 Transitional    


Copyright © 2006-2009 Wolfgang Ullrich. All Rights reserved.