| Login | Bugs & Features | Documentation | Download | Forums | ||
Articles · Developer Guide · Search Help HTMLDOC 1.8.27 Software Users ManualContents 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"));
}
Contents Previous Next | ||||||
| Copyright 1997-2010 Easy Software Products. All rights reserved. HTMLDOC and <HTML>DOC are trademarks of Easy Software Products. | ||||||