diff options
author | Adrian Johnson <ajohnson@redneon.com> | 2021-09-16 20:47:50 +0000 |
---|---|---|
committer | Adrian Johnson <ajohnson@redneon.com> | 2021-09-16 20:47:50 +0000 |
commit | 4c520fea2124f1d2d200ca86045f1de138809148 (patch) | |
tree | 80cbfd049ca8e97a83ed6a1134448f0e18f6ec48 /src/cairo-pdf-surface.c | |
parent | ffa2374b0521836a1da5e7bf1e0ae0a711a88a8e (diff) | |
parent | 0ce4c0fc29230a15c12e66571dba2dbfa428285c (diff) | |
download | cairo-4c520fea2124f1d2d200ca86045f1de138809148.tar.gz |
Merge branch 'custom-metadata' into 'master'
Add cairo_pdf_surface_set_custom_metadata()
See merge request cairo/cairo!240
Diffstat (limited to 'src/cairo-pdf-surface.c')
-rw-r--r-- | src/cairo-pdf-surface.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c index ab666fa9a..07fe5dffc 100644 --- a/src/cairo-pdf-surface.c +++ b/src/cairo-pdf-surface.c @@ -908,6 +908,42 @@ cairo_pdf_surface_set_metadata (cairo_surface_t *surface, } /** + * cairo_pdf_surface_set_custom_metadata: + * @surface: a PDF #cairo_surface_t + * @name: The name of the custom metadata item to set (utf8). + * @value: The value of the metadata (utf8). + * + * Set custom document metadata. @name may be any string except for + * the following names reserved by PDF: "Title", "Author", "Subject", + * "Keywords", "Creator", "Producer", "CreationDate", "ModDate", + * "Trapped". + * + * If @value is NULL or an empty string, the @name metadata will not be set. + * + * For example: + * <informalexample><programlisting> + * cairo_pdf_surface_set_custom_metadata (surface, "ISBN", "978-0123456789"); + * </programlisting></informalexample> + * + * Since: 1.18 + **/ +void +cairo_pdf_surface_set_custom_metadata (cairo_surface_t *surface, + const char *name, + const char *value) +{ + cairo_pdf_surface_t *pdf_surface = NULL; /* hide compiler warning */ + cairo_status_t status; + + if (! _extract_pdf_surface (surface, &pdf_surface)) + return; + + status = _cairo_pdf_interchange_set_custom_metadata (pdf_surface, name, value); + if (status) + status = _cairo_surface_set_error (surface, status); +} + +/** * cairo_pdf_surface_set_page_label: * @surface: a PDF #cairo_surface_t * @utf8: The page label. |