![]() | HTMLDOC 1.8.27 Software Users Manual | |
| Home · Articles & FAQs · Bugs & Features · Documentation · Download · Forums | Login | |
[ Comments | Contents | Previous | Next ] Calling HTMLDOC from a Shell ScriptShell scripts are probably the easiest to work with, but are normally limited to GET type requests. Here is a script called topdf that acts as a portal, converting the named file to PDF:
#!/bin/sh
#
# Sample "portal" script to convert the named HTML file to PDF on-the-fly.
#
# Usage: http://www.domain.com/path/topdf/path/filename.html
#
#
# Tell HTMLDOC not to run in CGI mode...
#
HTMLDOC_NOCGI=1; export HTMLDOC_NOCGI
#
# The "options" variable contains any options you want to pass to HTMLDOC.
#
options='-t pdf --webpage --header ... --footer ..."
#
# Tell the browser to expect a PDF file...
#
echo "Content-Type: application/pdf"
echo ""
#
# Run HTMLDOC to generate the PDF file...
#
htmldoc $options http://${SERVER_NAME}:${SERVER_PORT}$PATH_INFO
Users of this CGI would reference the URL "http://www.domain.com/topdf.cgi/index.html" to generate a PDF file of the site's home page. The options variable in the script can be set to use any supported command-line option for HTMLDOC; for a complete list see Chapter 8 - Command-Line Reference. [ Comments | Contents | Previous | Next ] User Comments [ Add Comment ]No comments for this page. | ||
| Copyright 1997-2008 by Easy Software Products. HTMLDOC and <HTML>DOC are the trademark property of Easy Software Products. HTMLDOC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. | ||