diff options
author | Adrian Johnson <ajohnson@redneon.com> | 2021-08-18 19:41:26 +0930 |
---|---|---|
committer | Adrian Johnson <ajohnson@redneon.com> | 2021-08-22 13:43:34 +0930 |
commit | 0ce4c0fc29230a15c12e66571dba2dbfa428285c (patch) | |
tree | 96ee813d5a8a25d7d563f92efaba22aad74e3966 /src/cairo-pdf-surface.c | |
parent | 2dec76ddfe9499b5a6efc1ccc8e52536a314543b (diff) | |
download | cairo-0ce4c0fc29230a15c12e66571dba2dbfa428285c.tar.gz |
Add cairo_pdf_surface_set_custom_metadata()
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 3c9d12471..a19bb8aca 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. |