Adding a hook to a contrib module I am trying to hook into the Print module after to call a custom function after the pdf is generated. I've got this working by simply patching a call back on the wkhtmltopdf.pages.inc:

 if (!empty($pdf)) {
  _callback_for_pdf();
  return $pdf;
}


This is pretty nasty. So ideally I would like to try and extend this contrib module to have a hook for this functionality. 

How do I go about adding a hook to something to then use in a custom module?
Check out this documentation: https://www.drupal.org/docs/7/creating-custom-modules/creating-drupal-7-hooks

For your case, the simplest may work

So lets say your hook you want to be hook_pdf_generated()

module_invoke_all('pdf_generated');

in your custom module, have a function YOURMODULE_pdf_generated()

If you wanted to be able to alter the $pdf variable, use a _alter() hook

So in that code you posted, add:

drupal_alter('pdf_generated', $pdf);

and in your custom module you'd have YOURMODULE_pdf_generated_alter(&amp;$pdf)