Skip to content

Commit

Permalink
Add metadata support.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Dec 10, 2024
1 parent 4b29c9a commit a39b01e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions examples/md2pdf.c
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ main(int argc, // I - Number of command-line arguments
docdata_t dd; // Document data
docfont_t fontface; // Current font
mmd_t *doc; // Markdown document
const char *value; // Metadata value


// Get the markdown file from the command-line...
Expand Down Expand Up @@ -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)
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...
for (fontface = DOCFONT_REGULAR; fontface < DOCFONT_MAX; fontface ++)
{
Expand Down

0 comments on commit a39b01e

Please sign in to comment.