To convert old txt (also IBM codepage 437), spool, text, textual report to nice pdf (form, invoice, report, sale sheet) on Windows, Solaris, Linux HP-UX, AIX, Mac OS X, tru64, openvms, sco, irix, bsd, OS/390, z/OS, AS400, ... Support for Japanese, Chinese (simplified and traditional), Korean, Czech, Greek, Polish, Hebrew, Thai, Cyrillic languages.
Important projects based on
SANFACE Software Products.
|What is txt2pdf?|
txt2pdf is flexible and powerful tool to convert txt, text, textual report, spool into pdf (form, invoice, report, sale sheet). It can be used alone, or you can use it from other applications to convert your documents on the fly.
|Why do you need txt2pdf?|
Most of your documents are text files. Usually, your reports from
legacy applications, COBOL applications, DBs, ERP applications and datawarehouse are textual. txt2pdf allows you to take those old text files and turn them into PDF's, which means you don't even need to pass the
data through PostScript first.
You can run txt2pdf on any system that runs PERL (we have customers that use txt2pdf on OpenVMS, MPE, ...) or you can use a binary version on Windows, Solaris, HP-UX, AIX, Linux, Mac OS X (if you're interested in a binary for another operating system, such as FreeBSD, SCO Unix, Irix, Digital Unix (tru64), please let us know, and we'll send you one).
Here there are some of the things that you can achieve with txt2pdf:
txt2pdf is available in several formats so you can download for your convenience. You may choose to download an executable file or you can just download the perl source code. Before you download our software, we ask you please to read the license and registration section to be aware of the licensing model which txt2pdf uses.
If you're interested in purchasing txt2pdf, please see the purchasing txt2pdf section.
We like perl, and that's the reason why we distribute txt2pdf primarily. This source code is our core business. We trust you. Please read the license and registration section.
|The txt2pdf source code in .tar.gz format
The txt2pdf source code in .zip format
|Purchasing, Licensing and Registration|
txt2pdf is shareware. That means that you're welcome to try it and use it as much as you want for 30 days. If after that time you like txt2pdf or would like to continue using it, we ask you please to purchase it or remove it from your system.
Only $59 for the Personal Edition
This means that you use the software for Personal purpose (home user, not inside a company).
This is the price for the Enterprise Edition:
$150 (US) for 1 CPU computer + $5 for every phisical core
e.g. 6 phisical core server fee is: $150 + 5 x $5 = $175
If you need a license for a virtual server:
$200 (US) for 1 CPU computer + $5 for every virtual core
Pay attention: if you have a virtual server with 5 virtual machine that runs 5 txt2pdf process, you need 5 txt2pdf licenses (virtual).
You can buy our software at SWREG. To purchase txt2pdf PE (Personal Edition not inside a company):
txt2pdf PE (Personal Edition)
To purchase txt2pdf EE (Enterprise Edition) if you need less than 5 licences use:
txt2pdf E.E. less than 5 license (remember to select the total number of physical cores. e.g. if you need 2 server licenses: one a 4 quad processor server and one a 4 bi processor server you have to add the additional cores: 4x4 - 1 + 4x2 - 1 = 15 + 7 = 22)
txt2pdf E.E. more than 5 license
txt2pdf E.E. less than 5 license for virtual server (remember to select the total number of cores. e.g. if you need 2 server licenses: one a 4 quad processor server and one a 4 bi processor server you have to add the additional cores: 4x4 - 1 + 4x2 - 1 = 15 + 7 = 22)
txt2pdf E.E. more than 5 license for virtual server
You can upgrade txt2pdf 8.x,
9.x, 10.x to the new version with the discount of the amount you previously
paid + a fix fee for every license:
If you registered a previous release (1.x, 2.x, 3.x, 4.x, 5.x, 6.x, 7x) you have to buy a new license.
Contact us via email at email@example.com for more information about how to upgrade your version.
You can get the following bulk discounts:
|PE (Personal Edition)|
|5-10 licenses||$54 each|
|11 or more licenses||$44 each|
|EE (Enterprise Edition)|
|5-10 licenses||$140 each (no CPU server difference)|
|11 or more licenses||$120 each (no CPU server difference)|
|EE (Enterprise Edition) virtual server|
|5-10 licenses||$190 each (no CPU server difference)|
|11 or more licenses||$170 each (no CPU server difference)|
Contact directly us! We're looking for resellers and partnerships.
No limit license
If you have one or more products with several installations and you want to use txt2pdf inside every tool of yours, here there is the license that you're looking for. It costs $2000 + 20% every year for PE (Personal Edition), $8000 + 20 % every year for EE (Enterprise Edition). Obviously you will receive free _every_ update.
Annual maintenence fee
If you want the best support we can give you and the possibility to have in a year the upgrade of every minor and major release, now you can subscribe an annual maintenece fee. The price of annual maintenece fee is 20% of the actual txt2pdf amount. If you are interested ask us how to subscribe the annual maintenece fee.
|Getting executable txt2pdf|
txt2pdf has been specially compiled for those users who just can't or don't want to run Perl on their systems. It has all the functionalities of the original perl version, and is distributed only in binary form for your convenience.
We currently have 6 executable versions:
For another operating system, such as FreeBSD, SCO Unix, Irix, Digital Unix (tru64) we suggest to user perl code. If you can't use perl code try to contact us. Please note that the Windows version comes with an extra tool known as Visual txt2pdf. We convert using perl2exe.
Create a directory for txt2pdf (eg. txt2pdf)
Unpack the source file that you downloaded. For Windows, you can unzip using WinZip and for Linux and other Unix flavours, you can simply use GNU tar.
Test if the executable perl file works by running the following:
txt2pdf uses the file txt2pdf.cfg for its configuration file. This file must reside in the same directory as the txt2pdf.pl file, since it searches for this file at runtime. You can create your own txt2pdf.cfg file. Inside this file, you can change the values for the tmpdir, author, creator, keywords, subject, title, pdfversion, paper, landscape, defaultfont, usedfonts, lines, tab, pointSize, vertSpace, npage, border, beginfile, endfile, bgdesign, fgdesign, transition, pagemode, pagelayout, rotate, typencoding, withextension, colour, fontmark, sleep, pdfdir, txtdir, ViewerPreferences, fit, zoom, list, japanese, tradchinese, simplchinese, korean, pagemark, inputmod, outputmod, prepdf, annotationtext, underline, linkuse and noid variables. Only with the executable versions you can set also mailhost, mailfrom, notify, priority, mailsubject, mailbody, mail_body_file, sendmail, disposition, attachtype, utf8-iso8859-1, ftphost, ftpuser, ftppassword, ftpdirectory
To change any of these values, you just need to edit txt2pdf.cfg. You can also create a new .cfg file and tell txt2pdf to read it at runtime, using the -configure yourfile.cfg option. In this section, we will discuss the most widely used variables, the one you are most likely to use with txt2pdf.
With the tmpdir variable, you can specify the default directory to use for temporary files. You can use relative or absolute path names. The default directory is ./, but it's better if you specify a specific temporary directory that's in use for your system.
|/tmp/||on Unix systems|
|/temp/||on Windows systems|
|/desktop folder/temp||on MacOS systems|
|/sys$scratch/ or SYS$SCRATCH||on OpenVMS|
|#!ENV#TEMP#!/ENV#||to use TEMP environment variable|
The author, creator, keywords, subject and title variables allow you to set the relative fields in the PDF document that provides information about the document. If these values are not known, then they are just ommited. If the value of title is null, the file name is used as the default value of title.
|Author||The name of the person who created the document.|
|Creator||If the document was created into a PDF from another form, this is the name of the application that created the original document.|
|Keywords||Keywords that are associated with the document.|
|Subject||The subject of the document.|
|Title||The title of the document.|
The default value for pdfversion is 1.2. You can also use 1.3, 1.4, 1.5.
The default value for paper is letter. You can also use A3 (or a3), A4 (or a4), A5 (or a5), tabloid, ledger, legal, statement, executive, jisb4, jisb5, widthxheight. By default, txt2pdf will write output in portrait, but this can be changed to landscape by setting this variable to 1 (the default is 0).
With lines, you can set the maximum amount of lines per page (default (pageHeight-72)/vertSpace, pageHeight depends on the paper selected).
With tab, you can set the amount of white space to be used for every tab (default is 8).
With defaultfont you can set the font you want to use to convert the text, with usedfonts you can set the list of fonts you want to use also in background and with the fontmark feature.
The default defaultfont value is F1 (normal Courier). The default value of usedfonts is defaultfont These the 14 PDF default fonts:
With pointSize you can set the font point size (default 10).
vertSpace is the distance between two lines (default 12).
With the colour variable you can use a configuration file (e.g. colour.cfg) with a powerful syntax. (see point 3).
With the fontmark variable you can use a configuration file (e.g. fontmark.cfg) with a powerful syntax. (see point 3).
By setting npage to 1 (default is 0) you can add a page number to the end of every page.
By setting border to 1 you can add a border to every page.
With transition variable you can use these parameters:
You can also configure colour
and fontmark files. The following is the syntax for the colour.cfg
where number is > 0 < 1 (the PDF rgb syntax)
String means every string you want to mark with the selected colour
e.g. TOTAL FEDERAL GST ACTIVE;0.5:0:1
You can change sentences with any colour you want.
We use this line to make any internet link blue. Obviously you can change it with your preferred colour
You can use PERL regular expressions, and this is the reason why this is so powerful.
e.g. ^Total federal.*active$;.7;.8;.2
The following is the syntax for the fontmark.cfg file
where font is one of the 16 fonts.
e.g. TOTAL GRAHAM PIES OLD;/F4
That means: change the default font to the /F4 font in every string "TOTAL GRAHAM PIES OLD"
You may also use PERL regular expressions here.
Pay attention, from txt2pdf
version 7.1 we suggest you to put design and text syntax not directly inside
bgdesign but inside an EPD. The difference is that using bgdesign txt2pdf
will put the line of text and design syntax in every page, with EPD txt2pdf
will use import only one time the text and design syntax and links it. This
means that with text documents with a lot of pages the final pdf will be
Inside bgdesign and fgdesign files you can use directly the PDF syntax to draw and to write. These are a few examples:
If you want to put a bold big diagonal DRAFT on every generated page, you can use the foreground file with:
(REMEMBER to put the text instruction inside BT and ET)
/F6 55 Tf
.5 .5 -.5 .5 150 455 Tm
/F6 means use italic Helvetica font
55 is the point size.
The meaning of the first line is: use the bold selected font with point size 55.
The meaning of the second line is: start form point (150,455) and write diagonal.
The meaning of the third line is: write DRAFT.
Remember you can use inside bgdesign and fgdeisgn the 19 fonts. To use the Japanese fonts remember to set japanese : 1. To use the traditional chinese fonts remember to set tradchinese : 1. To use the simplified chinese fonts remember to set simplchinese : 1. To use the korean fonts remember to set korean : 1.
If you want to draw a black background border line inside grey, you can use the background file with:
25 25 545 792 re
The meaning of the first line
is: inside the rectangle use grey (0 is black, 1 is white)
The meaning of the second line is: the line is black
The meaning of the third line is: the width of the line is 3
The meaning of the fourth line is: the rectangle is (25,25) (545,792)
The meaning of the fifth line is: draw.
You can find the information about the PDF syntax you can use in the layers directly in The PDF Reference Manual Version 1.3 second edition (696 pages, ~5 Mb) in the Chapter 4 and 5 (Page Descriptions). Inside bgdesign file you can use EPD vectorial objects
This is the syntax:
The first field is exact path where txt2pdf can find the EPD file (you can use also relative path)
2nd, 3rd, 4th and 5th fields are very powerful and complex. You can use it to scale or even rotate the EPD.
At the beginning, we suggest you use:
z1=1, z2=0, z3=0, z4=1
to scale correctly n EPD to divide or multiply z1 and z4 for the same integer
You can find the information about the PDF transformation syntax in The PDF Reference Manual Version 1.3 second edition (696 pages, ~5 Mb) in the Chapter 4.2.
6th and 7th fields are the x and y position on the page (0,0 the bottom left corner)
This is an example
You can test your new files
easily changing into the Tests directory and running the following
../txt2pdf(.pl) -c test.cfg test.txt
test.pdf is the PDF output file
On Unix OS, a simple STDIN and STOUT test is
ls -l | txt2pdf - > ls.pdf
On Windows OS
dir | perl txt2pdf - > dir.pdf
The - (minus char, like Unix style, means: read from standard input, write to standard output)
|-help||print out this message|
|-configure file||default txt2pdf.cfg|
|-list file||a list of textual input files|
|-paper format||default letter, valid formats:
A3 (or a3),
A4 (or a4), A5 (or a5), widthxheight
|-npage||add page number|
|-recursive directory||scan recursively the directory|
|-match files||match different files ex.
(require -recursive option)
|-pdfdir directory||the directory where you want to put the PDF's|
|-txtdir directory||the directory where you want to put the text|
|-mailto "firstname.lastname@example.org"||to send the generated PDFs to the specify email addresses|
|-mailcc "email@example.com"||to send the generated PDFs cc to the specify email addresses|
|-mailbcc "firstname.lastname@example.org"||to send the generated PDFs bcc to the specify email addresses|
|-current||the program version|
|-test||run a test without conversions|
|-||use STDIN and STDOUT|
CreationDate - The date the document was created is automatically set in the Info dictionary.
Automatic conversion of words like http://..., ftp://..., mailto:..., file:... etc to URL's.
Automatic conversion if mime:... links to launch the correct application to open a file (Windows)
POD Documentation inside.
txt2pdf is powerful enough for System Administrators to install globally and provide a default .cfg file for their users/organization. This can be easily done by:
setenv TXT2PDFCFG /path/to/default.cfg (This can be added to .bashrc, .cshrc etc for example)
define/system TXT2PDFCFG pathto:default.cfg (VMS in SYLOGIN.COM for example)
An user can still overwrite the default values by using another setenv or by defining in his own login files if he has a default .cfg file of his/her own. An user can still have a working directory with a txt2pdf.cfg and, if it exists, have it loaded. That allows him/her (without command line options) to setup fully functional working directories. Users may also use the -configure option to overwrite any defaults.
From The PDF Reference Manual Version 1.3 second edition "Note that in the WinAnsiEncoding, character code 128 is used for Euro." Remember you need a PDF 1.3 Reader (e.g. Acrobat Reader 4.xx) for this functionality. See the example you can find also in the Tests directory in every distribution.
|What's new in this version?|
Click here for an exhaustive history file.