[pmwiki-users] Using output of action=print (authenticated) to something like htmldoc

Chris Cox ccox at airmail.net
Mon Aug 1 11:59:33 CDT 2005


Patrick R. Michaud wrote:
> I've gone ahead and rewritten the generatepdf.php script;
> just download a new copy of the script from 
> http://www.pmwiki.org/wiki/Cookbook/GeneratePDF 
> and follow the instructions.  It now understands authorizations.
> 
> One can see the script's results at
> 
>     http://www.pmwiki.org/wiki/Cookbook/GeneratePDF?action=pdf

This worked great!  Thanks.

I'm trying to get my boss to do his month end reports
via the wiki (his team gets to update them prior to submission,
so a wiki is great.. with password of course).

His boss can then get a PDF if he needs to.

> 
> Pm
> 
> On Sat, Jul 30, 2005 at 10:42:13PM -0500, Chris Cox wrote:
>>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