Table of contents
No headers

    

First download ActivePerl and Ghostscript.

Then, make sure that the PATH environment variable includes the path to gswin32c.exe (located in D:\gs\gs8.53\bin in my case).

The attached zip file contains two batch scripts called html2ps.bat and ps2pdf.bat that will be called by the Deki Wiki pdf export function. The pdf export uses stdin / stdout streams, so the bat files need to use the windows version of dd for redirection to temporary files

Contents of html2ps.bat

EDIT by docbeat (added randomnr)

@ECHO OFF

Set /a randomnr=%random%

CD /D %~dp0

dd of=tmp_html_%randomnr%.html > NUL

c:\perl\bin\perl.exe html2ps tmp_html_%randomnr%.html > tmp_html_%randomnr%.ps
dd if=tmp_html_%randomnr%.ps 2> NUL

del tmp_html_%randomnr%.html
del tmp_html_%randomnr%.ps

c:\perl\bin needs to be replaced with your ActivePerl install folder.

Contents of ps2pdf.bat

EDIT by docbeat (added randomnr)

@ECHO OFF

Set /a randomnr=%random%

CD /D %~dp0

dd of=tmp_ps_%randomnr%.ps > NUL

call "d:\gs\gs8.53\lib\ps2pdf.bat" tmp_ps_%randomnr%.ps tmp_ps_%randomnr%.pdf
dd if=tmp_ps_%randomnr%.pdf 2> NUL

del tmp_ps_%randomnr%.ps
del tmp_ps_%randomnr%.pdf

d:\gs\gs8.53\lib needs to be replaced with your Ghostscript installation folder.

Then edit your mindtouch.deki.startup.xml configuration file and add the following keys :

<html2ps-path>D:\Deki_Wiki\web\bin\filters\html2ps.bat</html2ps-path>
<ps2pdf-path>D:\Deki_Wiki\web\bin\filters\ps2pdf.bat</ps2pdf-path>

Where D:\Deki_Wiki\web\bin\filters needs to be replaced with the location of the two batch files.

The zip file also contains dd.exe and the html2ps perl script (version 1.0b5), which need to be in the same folder.

EDIT by docbeat:

If you have any problems, see "Common Problems" here http://www.rustyparts.com/scripts/HTML_ToPDF/README

- Do this changes in the html2ps perl script:

          After this line (around 497):
          ($scr=$tmpname)=~/\w+$/;
          Add this:
          $scr='D:\Deki_Wiki\web\bin\filters\scratch';

          Change line 3582 (or thereabouts) from:
          $_[1]=`$geturl '$url'`;
          to:
          $_[1]=`$geturl $url`;

  

Where D:\Deki_Wiki\web\bin\filters needs to be replaced with the location of the two batch files.

- For inline-images I had to set "libwww-perl: 1;" in the html2ps perl script.

- For images in restrictes areas, I had to add a valid username and password:

           Change lines 3570-3572 (or thereabouts) from:
           if($package{'libwww-perl'} || $package{'jfriedl'}) {
            warn "\n";
            &gu();
           to:
           if($package{'libwww-perl'} || $package{'jfriedl'}) {
            warn "\n";
            &gu("your_wiki_user","your_wiki_password");
Tag page

Files 1

FileSizeDateAttached by 
 save2pdf.zip
html2ps.bat and ps2pdf.bat
224.07 kB21:51, 31 Mar 2008lch77Actions
Viewing 1 of 1 comments: view all
This is working fine using http://localhost but if I connect remotely, I don't see the pop-up.
My Apache Log show a result of 200 for the GET request but I don't see a save dialog.
Posted 12:44, 1 May 2008
Viewing 1 of 1 comments: view all
You must login to post a comment.