Well, there should be a way and although I have not explored it more in depth, I hope this inspires someone else (I will have my go at it if I find some time).
As mentioned on this page http://www.fpdf.org/en/script/script36.php, it's possible to inject some javascript (to open a print dialog). Now this extension is for FPDF, and not for the HTML2PDF library.
Maybe there is, or will be an HTML2PDF extension written, but my hunch is, that it will be easier to just do it in plain PHP after document creation.
As described here, it should be straight forward:
take an existing PDF, open it in a text editor and find /Catalog and insert the boilerplate after the /Pages reference, and put in your code
(src: http://bililite.com/blog/2012/06/06/adding-javascript-to-pdf-files/)
I will update if I have more information or a proof of concept (using HTML2PDF).
Edit
I just tested the concept, and it works just fine. Like in the examples, insert this script right after /Catalog and a new line.
/Names << % the Javascript entry
/JavaScript <<
/Names [
(EmbeddedJS)
<<
/S /JavaScript
/JS (
print(true);
)
>>
]
>>
>> % end of the javascript entry
Beware though, this will only work in Adobe Reader or Acrobat Pro and may not in other PDF readers (like the preview app in OSX did not work, but the build in reader in Chrome worked fine)
EDIT 2 - Proof of concept using the HTML2PDF library
$printCommand = <<<EOF
/Type /Catalog
/Names <<
/JavaScript <<
/Names [
(EmbeddedJS)
<<
/S /JavaScript
/JS (
print(true);
)
>>
]
>>
>>
EOF;
// Using the output method like this, you will get
// the raw ouput back to manipulate
$bin = $html2pdf->Output('', true);
// When the /Names block shows up somewhere later in
// in PDF code, it will override your script and will do nothing.
// This is just for proof of concept, you want to use regex here
if (strpos($bin, '/Names << >>') === false) {
$bin = str_replace('/Type /Catalog', $printCommand, $bin);
} else {
$printCommand = str_replace('/Type /Catalog', '', $printCommand);
$bin = str_replace('/Names << >>', $printCommand, $bin);
}
// Since we don't use the output function from HTML2PDF,
// you have to set the headers manually
header('Content-Type: application/pdf');
header('Cache-Control: public, must-revalidate, max-age=0');
header('Pragma: public');
header('Expires: Sat, 29 Jun 1985 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Content-Disposition: inline; filename="your-pdf-title";');
echo $bin;
exit;