summaryrefslogtreecommitdiff
path: root/src/pdf.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/pdf.h')
-rw-r--r--src/pdf.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/pdf.h b/src/pdf.h
new file mode 100644
index 0000000..c6f95ac
--- /dev/null
+++ b/src/pdf.h
@@ -0,0 +1,27 @@
+#ifndef BOKF_PDF_H
+#define BOKF_PDF_H
+
+#include <stddef.h>
+
+struct pdf;
+
+/* One-page A4 (595x842 pt) PDF 1.4 writer. Coordinates are in points with a
+ top-left origin; pdf_text's baseline is measured from the top. Colours are
+ "#rrggbb". Fonts are the base-14 Helvetica ("H") and Helvetica-Bold ("HB")
+ with WinAnsiEncoding; UTF-8 input is converted to WinAnsi. */
+
+struct pdf *pdf_new(void);
+int pdf_page(struct pdf *p);
+void pdf_fill_rect(struct pdf *p, double x, double y, double w, double h,
+ const char *rgb);
+void pdf_line(struct pdf *p, double x1, double y1, double x2, double y2,
+ double width, const char *rgb);
+void pdf_text(struct pdf *p, double x, double baseline, const char *font,
+ double size, const char *rgb, const char *utf8);
+double pdf_text_width(const char *font, double size, const char *utf8);
+double pdf_font_ascent(const char *font, double size);
+void pdf_path(struct pdf *p, const char *path, double x, double y,
+ const char *rgb);
+unsigned char *pdf_finish(struct pdf *p, size_t *len);
+
+#endif