#include "dlfcn.h"
#ifndef _MSC_VER
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
char *
cb_date(void *tag, size_t r, size_t c) {
static char buf[64];
time_t t = time(NULL);
ctime_r(&t, buf);
return buf;
} else {
return "Wed May 4 19:01:01 2022";
}
}
char *
cb_content(void *tag, size_t r, size_t c) {
static char buf[32];
snprintf(buf, sizeof buf, "Content %02zu x %02zu", r, c);
return buf;
}
char *
cb_labels(void *tag, size_t r, size_t c) {
static char buf[32];
if (0==r && 0==c) {
snprintf(buf, sizeof buf, "Date created:");
} else {
snprintf(buf, sizeof buf, "Label %zux%zu:", r, c);
}
return buf;
}
#ifndef _MSC_VER
#pragma GCC diagnostic pop
#endif
void
create_table_ex30(HPDF_Doc pdf_doc, HPDF_Page pdf_page) {
const size_t num_rows = 2;
const size_t num_cols = 2;
char *table_title = "tut_ex30: Table with dynamic callbacks";
HPDF_REAL height = 0;
}
int hpdftbl_use_labelgrid(hpdftbl_t t, _Bool use)
Shorter vertical line to mark labels.
Definition: hpdftbl.c:687
int hpdftbl_use_labels(hpdftbl_t t, _Bool use)
Enable/Disable the use of cell labels.
Definition: hpdftbl.c:666
hpdftbl_t hpdftbl_create_title(size_t rows, size_t cols, char *title)
Create a new table with title top row.
Definition: hpdftbl.c:326
int hpdftbl_stroke(HPDF_Doc pdf, const HPDF_Page page, hpdftbl_t t, const HPDF_REAL xpos, const HPDF_REAL ypos, const HPDF_REAL width, HPDF_REAL height)
Stroke the table.
Definition: hpdftbl.c:1682
#define TRUE
Boolean truth value.
Definition: hpdftbl.h:47
#define FALSE
Boolean false value.
Definition: hpdftbl.h:52
#define A4PAGE_HEIGHT_CM
Standard A4 paper height in cm.
Definition: hpdftbl.h:198
#define hpdftbl_cm2dpi(c)
Convert cm to dots using the default resolution (72 DPI)
Definition: hpdftbl.h:256
int hpdftbl_set_label_dyncb(hpdftbl_t, const char *)
Specify dynamic (late) loading callback for table label function.
Definition: hpdftbl_callback.c:370
int hpdftbl_set_content_dyncb(hpdftbl_t, const char *)
Specify dynamic (late) loading callback content function.
Definition: hpdftbl_callback.c:285
int hpdftbl_set_cell_content_dyncb(hpdftbl_t, size_t, size_t, const char *)
Specify dynamic (late) loading callback cell content function.
Definition: hpdftbl_callback.c:551
Core table handle.
Definition: hpdftbl.h:470
Common functions for all unit-test/examples.
_Bool run_as_unit_test
For the case when we use this example as a unit/integration test we do not want data such as dates,...
Definition: unit_test.inc.h:35
#define TUTEX_MAIN(_tbl_, _showgrid_)
Macro to create a main() function to call the table creation function for each example....
Definition: unit_test.inc.h:322