1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* Layout JSON -> transparent overlay PDF -> qpdf merge. */
#ifndef SIGNET_RENDER_H
#define SIGNET_RENDER_H
#include <stddef.h>
#include "yyjson.h"
struct render_ctx {
const char *asset_dir;
const char *default_font;
const char *date_format;
const char *serial; /* NULL if the document has no series */
const char *doc_date; /* YYYY-MM-DD */
const char *tmpdir; /* scratch space, same filesystem as `out` */
};
/* Displayed page dimensions in points; validates that the page exists. */
int render_page_size(const char *pdf, int page, double *w, double *h);
/* Expand a series pattern: {date:<strftime>} and {seq:<min digits>}. */
int series_expand(const char *pattern, const char *ymd, int seq, char *out,
size_t outsz);
int render_stamp(const struct render_ctx *, yyjson_val *layout,
const char *src_pdf, const char *out_pdf, char *err, size_t errsz);
/* Stamp consumes only server-frozen layout/asset references. */
/* `body`: stamped copy; `out` = body + one audit page listing `lines`. */
int render_release(const struct render_ctx *, const char *body,
const char *out, const char *const *lines, int nlines, char *err,
size_t errsz);
/* Overlay a facsimile at natural-pixel coords in the supplied reference frame. */
int render_sign(const struct render_ctx *, const char *body,
const char *out, const char *png, int page, double x, double y,
double w, double h, double ref_w, double ref_h, char *err, size_t errsz);
#endif