Merging output of Print.module's printpdf with existing PDFs
I hacked print_pdf.pages.inc to merge PDFs after creation based on the existence of a filefield:

Starting at line 209, in function _print_pdf_dompdf();

    $node = $print['node']; 
    if ($node-&gt;field_pdf[0]) {
        $meas_pdf = $dompdf-&gt;output();
        file_put_contents($base_path . 'sites/default/files/pdf_temp.pdf', $meas_pdf);
        include $base_path . 'sites/all/libraries/PDFMerger/PDFMerger.php';
        $newpdf = new PDFMerger;
        $newpdf-&gt;addPDF($base_path . 'sites/default/files/pdf_temp.pdf', 'all');    
        foreach ($node-&gt;field_pdf as $attach) {
        $newpdf-&gt;addPDF($base_path . $attach['filepath'], 'all');
        }
        $newpdf-&gt;merge('download', 'measurements.pdf');
    }
    else {$dompdf-&gt;stream($filename, array('Attachment' =&gt; ($print_pdf_content_disposition == 2))); }
}


It'd be great to write a module that undefines Print.module's private _print_pdf_dompdf(); function and replaces it with my own (so I'm not hacking a contrib module); any idea how I'd go about that?