% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/quarto_post_render.R
\name{quarto_pdf_post_render}
\alias{quarto_pdf_post_render}
\title{Quarto Post-Render: Enrich PDF Files with DOCX Titles}
\usage{
quarto_pdf_post_render(
  output_files = strsplit(Sys.getenv("QUARTO_PROJECT_OUTPUT_FILES"), "\\n")[[1L]]
)
}
\arguments{
\item{output_files}{Character vector of output file paths from Quarto.
Defaults to the \code{QUARTO_PROJECT_OUTPUT_FILES} environment variable
(newline-separated paths set by Quarto during project render). If
that variable is empty, falls back to reading from stdin as provided
by Quarto's post-render hook.}
}
\value{
Invisible \code{NULL}. Called for side effects.
}
\description{
A post-render function for Quarto projects that processes rendered PDF
output files. For each PDF, it checks if a corresponding DOCX file with
the same base name exists, extracts the title from the DOCX document
properties, sets it as the PDF metadata title, and updates the link text
in the accompanying \code{index.html}.
}
\details{
To use as a Quarto post-render script, add to \verb{_quarto.yml}:

\if{html}{\out{<div class="sourceCode yaml">}}\preformatted{project:
  post-render:
    - "Rscript -e 'saros::quarto_pdf_post_render()'"
}\if{html}{\out{</div>}}

\strong{Processing steps for each \code{.pdf} file:}
\enumerate{
\item Checks if a \code{.docx} with the same base name exists in the same directory
\item Extracts the title from the DOCX document properties (via \code{officer})
\item Sets the extracted title as the PDF file's metadata title (requires
Ghostscript)
\item Locates \code{index.html} in the same directory as the PDF
\item Replaces the \verb{<a>} link text for that PDF with the extracted title
}
}
\section{System Requirements}{

Setting PDF metadata title requires Ghostscript to be installed and
available on the system PATH:
\itemize{
\item \strong{Linux/macOS}: \code{gs}
\item \strong{Windows}: \code{gswin64c} or \code{gswin32c}
}

If Ghostscript is not found, a warning is issued and only the HTML link
text update is performed.
}

\examples{
\dontrun{
# Called automatically by Quarto post-render, or manually:
quarto_pdf_post_render(c("_site/report/report.pdf"))
}
}
\seealso{
\code{\link[=extract_docx_title]{extract_docx_title()}} for the DOCX title extraction logic.
}
