Add metadata support.

This commit is contained in:
Michael R Sweet 2024-12-10 18:53:51 -05:00
parent 4b29c9a1c2
commit a39b01ec9c
No known key found for this signature in database
GPG Key ID: BE67C75EC81F3244

View File

@ -572,6 +572,7 @@ main(int argc, // I - Number of command-line arguments
docdata_t dd; // Document data docdata_t dd; // Document data
docfont_t fontface; // Current font docfont_t fontface; // Current font
mmd_t *doc; // Markdown document mmd_t *doc; // Markdown document
const char *value; // Metadata value
// Get the markdown file from the command-line... // Get the markdown file from the command-line...
@ -610,6 +611,20 @@ main(int argc, // I - Number of command-line arguments
if ((dd.pdf = pdfioFileCreateOutput(output_cb, /*output_cbdata*/NULL, /*version*/NULL, /*media_box*/NULL, /*crop_box*/NULL, /*error_cb*/NULL, /*error_data*/NULL)) == NULL) if ((dd.pdf = pdfioFileCreateOutput(output_cb, /*output_cbdata*/NULL, /*version*/NULL, /*media_box*/NULL, /*crop_box*/NULL, /*error_cb*/NULL, /*error_data*/NULL)) == NULL)
return (1); return (1);
if ((value = mmdGetMetadata(doc, "author")) != NULL)
pdfioFileSetAuthor(dd.pdf, value);
if ((value = mmdGetMetadata(doc, "keywords")) != NULL)
pdfioFileSetKeywords(dd.pdf, value);
if ((value = mmdGetMetadata(doc, "subject")) != NULL)
pdfioFileSetSubject(dd.pdf, value);
else if ((value = mmdGetMetadata(doc, "copyright")) != NULL)
pdfioFileSetSubject(dd.pdf, value);
if (dd.title)
pdfioFileSetTitle(dd.pdf, dd.title);
// Add fonts... // Add fonts...
for (fontface = DOCFONT_REGULAR; fontface < DOCFONT_MAX; fontface ++) for (fontface = DOCFONT_REGULAR; fontface < DOCFONT_MAX; fontface ++)
{ {