I now have this working but several problems needed to be overcome;
The required ghostscript and html2ps were not installed on my server so I had to get them and install them (without 'jasper', whatever that is).
Once installed I got the execution errors and noticed that default path in the class file was wrong - they installed to /usr/local/bin/ (not /usr/bin/) so I had to edit the class file.
Despite fixing this I still got the "not executable" errors, this was quickly traced to php open_basdir kicking in and preventing apache from accessing the binaries - so I had to update php settings.
Once all this was done, the pdf conversion started to work - however, I was only getting one page, not the whole thread. This took a bit of degugging, during which I found some unnecessary code in the threadtopdf.php file. Having removed the unnecessary perpage stuff from the file, I found that even though the code was building the whole thread, once I used it properly, the pdf file was still only one page, with the perpage stuff I had removed.
After much head scratching about how this was impossible I did some packet tracing to see what was going on and found the culprit - VBSEO. I had Rewrite Printthread URLs set to 'Yes' and this was somehow interferring with the way the this mod works, causing the pdf output to be built from printthread.php, and not threadtopdf.php - once I disabled the url rewrite on print threads, the mod started outputting the pdf correctly.
I still have one minor issue - the header image is missing from the threads, but this is not important.
FYI; I removed the following code in threadtopdf.php as perpage stuff is not needed ;
PHP Code:
$vbulletin->input->clean_array_gpc('r', array(
'perpage' => TYPE_UINT,
'pagenumber'=> TYPE_UINT
));
PHP Code:
// split thread over pages if necessary
$countposts = $db->query_first_slave("
SELECT COUNT(*) AS total
FROM " . TABLE_PREFIX . "post AS post
WHERE threadid=$threadinfo[threadid] AND visible=1
");
$totalposts = $countposts['total'];
$vbulletin->GPC['perpage'] = sanitize_maxposts($totalposts);
$maxperpage = sanitize_maxposts(-1);
if ($vbulletin->GPC['pagenumber'] < 1)
{
$vbulletin->GPC['pagenumber'] = 1;
}
$startat = ($vbulletin->GPC['pagenumber'] - 1) * $vbulletin->GPC['perpage'];
$pagenav = construct_page_nav($vbulletin->GPC['pagenumber'], $vbulletin->GPC['perpage'], $totalposts, 'threadtopdf.php?' . $vbulletin->session->vars['sessionurl'] . "t=$threadinfo[threadid]", '&pp=' . $vbulletin->GPC['perpage']);
// end page splitter
I also edited the SQL to this ;
PHP Code:
$posts = $db->query_read_slave("
SELECT post.*,post.username AS postusername,user.username
FROM " . TABLE_PREFIX . "post AS post
LEFT JOIN " . TABLE_PREFIX . "user AS user USING(userid)
WHERE post.threadid=$threadid AND post.visible=1
ORDER BY dateline $postorder
");
There is also a premissions problem - you cannot pdf threads unless they are viewable by guests, and also a slight error in the url build as well.
I think I have fixed these problems locally, but need to test them, and I have to go out now for a few hours.