Troubleshooting

Exit codes

Form2PDF uses the following exit codes:

  • 0 – Everything is ok.
  • 1 – One or more of the supplied parameters were invalid, or had an invalid value.
  • 2 – It was not possible to connect to the SMTP server.
  • 3 – Something went wrong when sending the PDF to the SMTP server.

Using syslog

When the “–syslogfacility” option is specified syslog is used to log messages. The parameter can be “local0” through to “local7” or “user” (default) for the corresponding syslog facility. The syslog daemon, syslogd, may need to be configured through syslog.conf and refreshed in order for log messages to be written to the intended destination.

Running in debug mode

It is possible to run Form2PDF in debug mode by adding the parameter “–debug” or “–debug2” (more logging) to the command-line. Example:

form2pdf –debug2 test.txt test.pdf

Problem sending e-mail

Sending e-mail from Form2PDF requires you have access to a SMTP server to which Form2PDF can connect and send the e-mail via SMTP. The SMTP server can either be local, such as sendmail running on the same server as Form2PDF, or remote such as a SMTP server at your ISP.

By default Form2PDF tries to connect to localhost on port 25, the standard TCP port for SMTP. You may need to change this depending on your environment. One easy way to find out whether the SMTP server is reachable is to telnet to the SMTP host and port you specify. You should get a response from the SMTP server.

Sample session:

# telnet localhost 25
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
220 host.example.com Sendmail 8.11.6/8.11.0; Tue, 6 Dec 2005 16:24:47 +0100
quit
221 2.0.0 host.example.com closing connection
Connection closed by foreign host.

If you get a “connection refused” or similar error message then there is no SMTP server available on the specified host and port.

Performance

If it takes long (several seconds) to convert files into a PDF when using a background image it may very well be the image handling that steals most of the time. Try to convert without the background image and compare the time.

If you run Form2PDF with parameter “–debug2” you will see a couple of lines similar to these:

image_load: Color type is 6, bit depth = 8, pixel depth = 32
Add file `test.txt’
image_print: Storing image with width 2096 and height 2620

This file in uncompressed format is about 5 megapixel where each pixel uses 32 bits (4 bytes), while in PNG compressed format the file was about 170 kb.

So, make sure that you do not use much larger images than needed. For example, a black and white image does not need a pixel depth of 32 bits.