|
rllib
1
|
#include <rlreport.h>

Public Member Functions | |
| rlReport () | |
| virtual | ~rlReport () |
| int | open (const char *filename) |
| int | close () |
| int | printf (const char *format,...) |
| int | beginDocument () |
| int | endDocument () |
| int | include (const char *filename, rlIniFile *ini=NULL) |
| int | includeHeader (const char *documentclass="\ocumentclass[a4paper]{article}", const char *language="\sepackage[english]{babel}", const char *inputenc="\sepackage[utf8]{inputenc}", const char *layout="\etlength{\arindent}{0pt} \etlength{\opmargin}{-50pt} \etlength{\ddsidemargin}{0pt} \etlength{\extwidth}{480pt} \etlength{\extheight}{700pt}") |
| int | includeCSV (const char *filename, int use_first_row_as_title=1, const char *legend=NULL, char delimitor='\t') |
| int | includeImage (const char *filename, const char *legend=NULL, float scale=1.0f) |
| int | spawn (const char *command) |
| int | pdflatex (const char *command=NULL) |
Private Attributes | |
| FILE * | fout |
| rlString | file |
class for generating PDF files with LaTeX
//### typical usage begin #############################################
int report(PARAM *p)
{
rlReport r;
rlString filename;
filename = p->file_prefix; // use an individual filename for each client
filename += ".tex";
r.open(filename.text());
r.includeHeader("\\documentclass[a4paper]{article}","\\usepackage[ngerman]{babel}"); // german article on A4 paper
//// here we may include our own header definitionsr.beginDocument(); //// --- begin here we use the methods: printf(), include(), includeCSV(), includeImage(), spawn() -------------- r.printf("\\section{Teil 1}\n"); r.printf("Hallo Welt\n"); r.includeImage("test.jpg","Testbild",0.8f); r.includeCSV("test.csv",1,"Test CSV"); r.printf("\\cppbegin{main.cpp}\n"); r.include("main.cpp"); r.printf("\\end{lstlisting}\n"); r.printf("\\simplecodebegin{Verzeichnis Inhalt}\n"); r.spawn("ls -al"); r.printf("\\end{lstlisting}\n"); //// --- end here we use the methods: printf(), include(), includeCSV(), includeImage(), spawn() ---------------- r.endDocument(); r.close();
r.pdflatex(); // pdflatex -interaction=nonstopmode file.tex
filename = p->file_prefix; filename += ".pdf"; pvDownloadFileAs(p,filename.text(), "report.pdf"); pvClientCommand(p,"pdf","report.pdf"); // open report.pdf on the client using the pdf-viewer return 0; } //### typical usage end ###############################################
Definition at line 64 of file rlreport.h.
| rlReport::rlReport | ( | ) |
Definition at line 21 of file rlreport.cpp.
|
virtual |
Definition at line 26 of file rlreport.cpp.
| int rlReport::beginDocument | ( | ) |
| int rlReport::close | ( | ) |
| int rlReport::endDocument | ( | ) |
| int rlReport::include | ( | const char * | filename, |
| rlIniFile * | ini = NULL |
||
| ) |
Include a file to the output.
If ini != NULL then the content of ini can be used as text modules as follows:
Withnin file we use something like \$[SECTION][NAME] to address the text module we want to include.
Definition at line 77 of file rlreport.cpp.
| int rlReport::includeCSV | ( | const char * | filename, |
| int | use_first_row_as_title = 1, |
||
| const char * | legend = NULL, |
||
| char | delimitor = '\t' |
||
| ) |
print a CSV table to the output file
filename := name.csv
use_first_row_as_title := 0 | 1
legend := NULL | text_describing_the_table
Definition at line 241 of file rlreport.cpp.
| int rlReport::includeHeader | ( | const char * | documentclass = "\\documentclass[a4paper]{article}", |
| const char * | language = "\\usepackage[english]{babel}", |
||
| const char * | inputenc = "\\usepackage[utf8]{inputenc}", |
||
| const char * | layout = "\\setlength{\\parindent}{0pt} \\setlength{\\topmargin}{-50pt} \\setlength{\\oddsidemargin}{0pt} \\setlength{\\textwidth}{480pt} \\setlength{\\textheight}{700pt}" |
||
| ) |
Include the LaTeX header to the output file.
If optional_parameter == NULL then output the default parameters.
Examples:
includeHeader("\\usepackage[a4paper]{article}", "\\usepackage[ngerman]{babel}");
includeHeader("\\usepackage[a4paper]{book}", "\\usepackage[english,greek]{babel}");
See:
http://en.wikibooks.org/wiki/LaTeX/Internationalization
Our default LaTeX header is within the fprintf() statements of rlReport::includeHeader()
You may printf() or include() more header definitions and then call
r.beginDocument();
Definition at line 157 of file rlreport.cpp.
| int rlReport::includeImage | ( | const char * | filename, |
| const char * | legend = NULL, |
||
| float | scale = 1.0f |
||
| ) |
Include a graphic into our document.
filename := name.jpg | name.png
legend := NULL | text_describeing_the_image
Definition at line 287 of file rlreport.cpp.
| int rlReport::open | ( | const char * | filename | ) |
| int rlReport::pdflatex | ( | const char * | command = NULL | ) |
Run "pdflatex -interaction=nonstopmode file.tex" if command==NULL or
what you specify by your own command.
Definition at line 308 of file rlreport.cpp.
| int rlReport::printf | ( | const char * | format, |
| ... | |||
| ) |
print text to the output file
Definition at line 53 of file rlreport.cpp.
| int rlReport::spawn | ( | const char * | command | ) |
Run the external "command" and include what is printed by "command" to the output file.
This works as follows:
sprintf(cmd,"%s > %s.temp", command, file.text())
system(cmd);
include(file.text() + ".temp");
Definition at line 296 of file rlreport.cpp.
|
private |
Definition at line 151 of file rlreport.h.
|
private |
Definition at line 150 of file rlreport.h.
1.8.14