some PDFs hard-code format to "a3 landscape", overriding default PDF format
Disclaimer: this is something of an edge case, as I'm only encountering this by calling civicrm/event/participant?reset=1&id=N&snippet=3
to print Event Participant Listings to PDF.
Problem: It appears that PDFs generated by some code execution pathways will always be size=A3 and orientation=landscape, no matter what is specified for PDF formats anywhere in the UI settings. This seems undesirable, unless you live in a place where everybody normally keeps A3 paper in the printer.
Consider this line of code from https://github.com/civicrm/civicrm-core/blob/master/CRM/Core/Page.php#L214:
if ($this->_print == CRM_Core_Smarty::PRINT_PDF) {
CRM_Utils_PDF_Utils::html2pdf($content, "{$this->_name}.pdf", FALSE,
['paper_size' => 'a3', 'orientation' => 'landscape']
);
}
Proposed solution: Would it be acceptable to simply remove this ['paper_size' => 'a3', 'orientation' => 'landscape']
array from this call? It appears (per CRM_Utils_PDF_Utils::html2pdf()
) that doing so would simply cause such PDFs to use whatever is returned by CRM_Core_BAO_PdfFormat::getDefaultValues()
.