paddpdb2bib [--encfrom=...] [--encto=...] [--first-last] [ <custom field mappings> ] AddressDB.pdb


Given a PDB file from one's Address Book on a pilot device (one that is parseable by Palm::Address), output a database in bibtex format that is suitable for processing via the directory LaTeX macro package.



Print usage instructions to STDERR.


Print the manual page to STDOUT.


Print the version information to STDOUT.


Name of the encoding from which to transcode the text fields in the PDB.


Name of the encoding to which to transcode the output bibtex fields text. Defaults to the same encoding as given by the encfrom option.

father or middle

These 4 options provide a way to map the custom fields to URL, birthday, patronymic, and spouse name, respectively. An unmapped custom fields will be added to the note field, labeled the same way as they are custom named in the PDB.


Boolean option, if set, the names will be output in the First Last format. Otherwise (the default), they are output as Last, First. The option is there since some documents consider this the ``preferred named format''.

If the middle name field mapping is specified, the output becomes First Middle Last, and Last, First Middle respectively. Note that in pathological cases (e.g., if somebody has a first name and a patronymic, but not a last name in your database) this may affect the sorting order in a wrong way, because bibtex has no way to distinguish a bare First Middle from a legal First Last.

Finally, in the First ... Last format sometimes the first and last names are arbitrarily guessed by the bibtex the wrong way around, and thus the corresponding contact is sorted wrongly as well. Using the default Last, First ... format usually helps in such cases.


Follows a snapshot from the documentation of the directory LaTeX package, on which the fields emitted by this script are marked with a corresponding comment in the end, detailing from which Palm::Address fields they are extracted.

The decision whether to emit @person or @company is based on whether the ``name'' fields of the person is defined.

        @person{key, % of the form contact:<palm record id>
          name = "Full name(s), in standard BibTeX format", % name, firstName father
          nickname = "Nickname(s)",
          birthday = "Birthday date(s), in numeric 'day month' format", % from birthday
          birthyear = "Birth year(s)", % from birthday
          p.street = "Street of private residence", % address
 = "City of private residence", % city
 = "ZIP code of private residence", % zipCode
          p.state = "State of private residence", % state
 = "Country of private residence", % country
 = "Private phone number", % "Home" phone[1-5] fields
          p.cellular = "Private mobile phone number", % "Mobile" and "Pager" phone[1-5] fields
          p.fax = "Private fax number", % "Fax" phone[1-5] fields
 = "Private e-mail address", % "E-mail" phone[1-5] fields
          p.url = "Private home page", % url
          p.account = "Private bank account",
          r.street = "Street of alternative residence",
 = "City of alternative residence",
 = "ZIP code of alternative residence",
          r.state = "State of alternative residence",
 = "Country of alternative residence",
 = "Alternative phone number", % "Other" phone[1-5] fields
          r.cellular = "Alternative mobile phone number",
          r.fax = "Alternative fax number",
 = "Alternative e-mail address",
          r.url = "Alternative home page",
          r.account = "Alternative bank account",
 = "Work organization name", % company
          w.title = "Job title", % title
          w.street = "Street of work organization",
 = "City of work organization",
 = "ZIP code of work organization",
          w.state = "State of work organization",
 = "Country of work organization",
 = "Work phone number",  % "Work" and "Main" phone[1-5] fields
          w.cellular = "Work mobile phone number",
          w.fax = "Work fax number",
 = "Work e-mail address",
          w.url = "Work home page",
          w.account = "Work bank account",
          note = "Additional notes about the person", % unmapped+note

For a @company entry the phone fields are concatenated together from the given [rpw].... alternatives.

        @company{key, % of the form contact:<palm record id>
          name = "Company name", % company
          street = "Company street", % address
          city = "Company city", % city
          zip = "Company ZIP code", % zipCode
          state = "Company state", % state
          country = "Company country", % country
          phone = "Company phone number",
          cellular = "Company mobile phone number",
          fax = "Company fax number",
          email = "Company e-mail address",
          url = "Company home page",
          account = "Company bank account",
          note = "Additional notes about the company", % unmapped+note


Download the prerequisite Perl modules for this script from CPAN, and then you'll be able to run the present script as well.

Install directory from CTAN, unless you already have it installed as a part of your TeX distribution.


Fetch the AddressDB.pdb from your pilot, for example, by using pilot-xfer(1). Create a file all.tex as the master document to format your address book, e.g.:

        \documentclass[a4paper,twocolumn]{article} % vim:fileencoding=cp1251
        \usepackage[obeyspaces]{url} % so "Foo Bar <>" appears with the spacing inside!

Then convert the PDB to the bibtex database, and format the document:

        $ paddpdb2bib --encfrom=cp1251 \
                --url=custom1 --birthday=custom2 --father=custom3 --spouse=custom4 \
                AddressDB.pdb > all.bib
        $ texi2dvi all.tex
        $ bibtex all.aux
        $ texi2dvi all.tex


        $Log: paddpdb2bib,v $
        Revision 1.7  2007/02/05 17:20:31  vassilii
        pod docs only:
        1) eliminate from BUGS the one about email typesetting,
        and add to the EXAMPLE a corresponding incantation for package {url}
        2) SEE ALSO - hyperlinking
        Revision 1.6  2007/01/15 16:52:26  vassilii
        In the Last, First format don't start with the comma
        if there is no Last name. The new scheme is the best default
        w.r.t. the sorting of non-latin contacts. Switched the default,
        the cmdline, and the pod docs accordingly. Finally, no sorting
        glitches in my versatile phonebook!
        Revision 1.5  2007/01/12 18:35:48  vassilii
        BUG fixed in the birthday sorting order - now 0-padding the numbers to 2 digits
        the output now includes a descriptive header in a comment format
        documented --version option
        Revision 1.4  2007/01/12 13:10:28  vassilii
        added --version cmdline option
        restored the spouse to work in the First Last ordering as well
        Revision 1.3  2007/01/12 03:33:29  vassilii
        RCS kwds in the pod
        only the "guest" ambiguous phones are now labeled 
                (like (Pager) in the mobile fields)
        workaround posted for the directory \dircheck bug
        pod updates


With non-Latin encodings, bibtex(1) is pretty freaky. You might need to procure a custom patched bibtex version that works with your national encoding.

For some reason, the directory package, coupled with LaTeX and Bibtex on my system fails to properly sort the produced entries when I use the koi8-r encoding (sorting them in the YU A B C D order, i.e., according to the Latin alphabet), so for a decent sorting of Russian one has to use the cp1251 code page.

The \dircheck macro only calls \Dirheader for the first Russian letter present in the sorted output, and never works for the subsequent ones. This is a bug in the directory package, and a patch against its version 1.20 has been submitted upstream. You can download the same patch separately from

Some escaping debugging might be in order, as well as general code beautification.

More intelligent guessing of ambiguous mapping between the PDB and bibtex fields might be in order, maybe based on category and which fields are present.

Adding to the note field could also be made configurable on a per-field basis, as well as overflowing extra phones of the same type to the note.

The birthday dates are passed using HTTP::Date internal heuristics. Some more generic ways could be used, such as using the on-palm format for dates, or unleashing various DateTime::Format beasts. (bork! bork!)

Maybe per-category export?


CTAN entry for the directory package, Palm::Address(3), bibtex(1), texi2dvi(1), HTTP::Date(3)


Vassilii Khachaturov <>


This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.