-
Notifications
You must be signed in to change notification settings - Fork 394
Description
Discussed in #4424
Originally posted by fuhrmanator February 18, 2023
My publishing requirements ask me to generate a PDF that is PDF/A (archive) compliant. I did some googling, and found a great explanation at https://www.mathstat.dal.ca/~selinger/pdfa/. However, I wasn't able to get the metadata into the PDF file according to the documented process. I realized it's because it's hard to know exactly what the .tex file is named when pdflatex is invoked in Quarto. In my case, it's a book project, so I think the file was index.tex, even though the keep-tex results in a file with the name of the title of my book. I suppose it's something else when you write an article, etc.
Anyway, I read the docs for the pdfx package and found that you can embed the metadata into the .tex source, with a vanilla file name that "always" works. I tried it using header-includes: and it works well (or seems to). I see the metadata in the PDF, and Acrobat says my PDF is indeed PDF/A when I open it. I haven't fully validated the result with a real validation tool. But it's an encouraging start. Here's what I put in my _quarto.yml for a book project.
format:
pdf:
header-includes: |
\usepackage[a-1b]{pdfx}
\begin{filecontents*}[overwrite]{\jobname.xmpdata}
\Title{Baking through the ages}
\Author{A. Baker\sep C. Kneader}
\Language{en-GB}
\Keywords{cookies\sep muffins\sep cakes}
\Publisher{Baking International}
\end{filecontents*}The first line loads the pdfx package, and the following lines create (overwrite) the metadata file, which is magically created temporarily in the pdflatex pipeline (so you don't need to worry about the exact filename, and it stays with your document).
Of course, you must duplicate some of the XMP info that is defined in other Quarto fields, e.g., Title, Author, etc. Maybe one day Quarto can make this happen automagically (in partials), but for now I'm happy I don't have to do a separate conversion step.