Version 2.0[Key Features|Running JHtml2Printf|Using JHtml2Printf|Getting JHtml2Printf|Tech Info|Other Products|
Most of us developers have the need to take a file and put it into "printf" statements for output to the screen. With the advent of the World Wide Web and home pages, we have a number of tools to create web pages. Common Gateway Interface (CGI) programs are used to react to html form data, perform some backend function (such as look up data in a database) and create on-the-fly html for display back to the calling web browser. Unfortunately, creating that html for the CGI output is usually done by hand and is very tedious and time-consuming. The tools used to create web pages don't do us very good when their output cannot be readily used for CGI output. JHtml2Printf helps us in that aspect. It can take any text file and output a file with wrapper printf statements around each line. These formatted output lines can be cut and pasted into a 'C' CGI program file. In this manner you can use the web page development tools you like for developing the CGI output you want. This tool is also good for wrapping html code or other text for PHP and Perl.

JHtml2Printf shown as it is initially.
JHtml2Printf is a pure Java(tm) application. It is packaged in a self-extracting .jar file.
This means that it will extract any files necessary in order to run. The only files that will NOT be available are the
Java distribution files, i.e. Java needs to be installed and available on your system. The minimum Java version is 1.3.
JHtml2Printf is started from the command line in most systems. The command is: java -jar dsbht2pf.jar . This will
start the installation checker. When the correct files are extracted (if they have not already), JHtml2Printf will start.
On Microsoft windows systems, you can create a shortcut that will start up the application. Use the javaw instead of the java command.
This will bring up java without the command box that is used for command line applications.
JHtml2Printf is easy to use. The program has two (2) windows. The left window
contains a tree of files on your disk(s). The right window is where the converted data will appear.
Double-click on directories. They will open up. Select a file name and drag it to the right window. Drop it there.
The file data will appear converted as set up in your 'Set Printf Statment' option.
There currently arethree (3) main menu areas: FILE,OPTIONS, and HELP.
The FILE menu is for opening a file (instead of drag and drop) and exitting the program.
The current OPTIONS are: Set Printf Statement and Set Output File Extension. By default the
output file is the same name and directory of the input file
except for the output file extension. The default extension is: .dat.
Example: input file: c:\html_area\index.html
would produce an oututput file of c:\html_area\index.dat .
The Set Printf Statement option allows the user to customize the output file
contents. Default beginning statement is: printf(.
and the default ending statement is: );. This
would take an input line of: This is a test and produce
an output line of: printf("This is a test\n");.
Input File (Generated using FrontPage 97) :
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; iso-8859-1">
<title>TGA DP Project</title>
<meta name="FORMATTER" content="Microsoft
FrontPage 2.0">
</head>
<frameset rows="19%,81%">
<frame src="header.htm" name="Header">
<frame src="main.htm" name="main">
<noframes>
<body>
<p>This web page uses frames, but your browser doesn't
support them.</p>
</body>
</noframes>
</frameset>
</html>
Output File:
printf("<!DOCTYPE HTML PUBLIC '-//IETF//DTD
HTML//EN'>\n");
printf("\n");
printf("<html>\n");
printf("\n");
printf("<head>\n");
printf("<meta http-equiv='Content-Type'
content='text/html; iso-8859-1'>\n");
printf("<title>TGA DP Project</title>\n");
printf("<meta name='FORMATTER' content='Microsoft
FrontPage 2.0'>\n");
printf("</head>\n");
printf("\n");
printf("<frameset rows='19%,81%'>\n");
printf(" <frame src='header.htm'
name='Header'>\n");
printf(" <frame src='main.htm' name='main'>\n");
printf(" <noframes>\n");
printf(" <body>\n");
printf(" <p>This web page uses frames, but your
browser doesn't\n");
printf(" support them.</p>\n");
printf(" </body>\n");
printf(" </noframes>\n");
printf("</frameset>\n");
printf("</html>\n");
You can obtain JHtml2Printf here.
The distribution is in a java .jar file.
JHtml2Printf was developed by Martin E. Haring. Uses minimum Java 1.3.1 release.