![]() | HTMLDOC 1.8.27 Software Users Manual | |
| Home · Articles & FAQs · Bugs & Features · Documentation · Download · Forums | Login | |
[ Comments | Contents | Previous | Next ] Calling HTMLDOC from CC programs offer the best flexibility and easily supports on-the-fly report generation without the need for temporary files. Here are some simple C functions that can be used to generate a PDF report to the HTTP client from a temporary file or pipe:
#include <stdio.h>
#include <stdlib.h>
/* topdf() - convert a HTML file to PDF */
FILE *topdf(const char *filename) /* I - HTML file to convert */
{
char command[1024]; /* Command to execute */
/*
* Tell HTMLDOC not to run in CGI mode...
*/
putenv("HTMLDOC_NOCGI=1");
/*
* Write the content type to the client...
*/
puts("Content-Type: application/pdf\n");
/*
* Run HTMLDOC to provide the PDF file to the user...
*/
sprintf(command, "htmldoc --quiet -t pdf --webpage %s", filename);
return (popen(command, "w"));
}
/* topdf2() - pipe HTML output to HTMLDOC for conversion to PDF */
FILE *topdf2(void)
{
/*
* Tell HTMLDOC not to run in CGI mode...
*/
putenv("HTMLDOC_NOCGI=1");
/*
* Write the content type to the client...
*/
puts("Content-Type: application/pdf\n");
/*
* Open a pipe to HTMLDOC...
*/
return (popen("htmldoc --quiet -t pdf --webpage -", "w"));
}
[ 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. | ||