[pmwiki-users] Using output of action=print (authenticated) to something like htmldoc
Chris Cox
ccox at airmail.net
Sat Jul 30 22:42:13 CDT 2005
Patrick R. Michaud wrote:
> On Sat, Jul 30, 2005 at 09:35:20PM -0500, Chris Cox wrote:
>>I need a way of using the print skin output (HTML) as the input
>>to a program (via markup).
>>
>>generatepdf uses print, but via an external call to getting
>>the page... it (htmldoc) can take input from stdin, so if I could
>>get the print output (authenticated), I could run that into a slightly
>>modified generatepdf function.
>>
>>Is there a way to get the ouput that would be produced by
>>action=print for a page with the benefits of being password
>>authenticated (normal simple password auth)?
>
> You should be able to set $action='print'; and then call HandleBrowse.
> This is the way PmWiki does it, anyway.
>
> If I knew a little bit more about how generatepdf works we could
> probably fix this...
>
It's pretty simple.. by using a shell_exec the htmldoc pulls in the
page with an action=print, but obviously isn't authenticated (no
session):
function HandlePDF($pagename) {
global $PDF_Location, $PDF_Url_Location, $Htmldoc_Location;
$filename_to_write = $PDF_Location . $pagename . '.pdf';
$url = $PDF_Url_Location . $pagename . '.pdf';
$output = shell_exec($Htmldoc_Location . ' -f ' . $filename_to_write .
' --webpage http://localhost/pmwiki/pmwiki.php?n=' . $pagename .
'?action=print');
header("Refresh: 0; URL=" . $url);
}
#
# This function overrides the $HandleActions variable array in pmwiki.php
#
$HandleActions['pdf'] = 'HandlePDF';
More information about the pmwiki-users
mailing list