Doesn't seem to work for me, which fonts did you copy exacly? On Wed, 2006-08-30 at 18:18 +0300, Heikko Ellermaa wrote: > Ah, bugger, this require line is not needed. Always introduce yourself > with buggy code, right ;-) Sorry, my bad and thanks. Corrected file is > attached. > > This is my configuration: > // Path to Ghostscript executable > define('GS_PATH','/usr/bin/gs'); > > // Path to font metric files (AFM files). > // NOTE: Trailing backslash required > define('TYPE1_FONTS_REPOSITORY',HTML2PS_DIR."/fonts"); > > The afm files were already present there, additionally I copied > according ttf font files manually to the same folder. Seemed to work. > But overall, to get the html2pdf library working, try first with the > /demo/index.php script supplied by them. It has a web form where you can > fiddle with different options and so... > > br, > Heikko > > Guy Sheffer wrote: > > Hi Heikko, > > I tried here to fiddle about with this code, > > > > for a start the script "destination.prodownload.class.php" > > doesn't seem to be present. I only found > > "destination.download.class.php". > > > > I seem to have got it all running with the folowing configuration in the > > config file: > > > > // Path to Ghostscript executable > > define('GS_PATH','/usr/bin/gs'); > > > > // Path to font metric files (AFM files). > > // NOTE: Trailing backslash required > > define('TYPE1_FONTS_REPOSITORY',"/usr/share/fonts/type1/gsfonts/"); > > > > > > However it only returned a blank pdf page. > > > > Guy > > > > On Wed, 2006-08-30 at 12:18 +0300, Heikko Ellermaa wrote: > > > >> Hi! > >> > >> I created a simple (well, more or less) solution to get the wiki > >> > > content > > > >> into a pdf file. Now I'm asking for comments, suggestions and a > >> > > second > > > >> opinion. > >> > >> Here's what worked for me: > >> 1) I donwloaded the "html2ps and html2pdf" PHP library from > >> http://www.tufat.com/script19.htm. It worked amazingly vell for > >> > > almost > > > >> every html page I tested it with (has image support, loads of options > >> and so on) > >> > >> 2) Based on the samples in html2pdf I created the attached > >> > > url2pdf.php > > > >> script into 'samples' directory of html2pdf and configured the whole > >> thing work in my webserver. > >> > >> 3) Now we reach the connection to dokuwiki. In the main.php I added > >> manually a PDF button (I really could not find a way to create the > >> button automagically with dokuwiki scripts as these allowed only > >> > > posting > > > >> to dokuwiki itself). So here's the listing of the PDF button code > >> > > which > > > >> I placed right after the History button: > >> > >> <form class="button" method="get" > >> action="http://localhost/html2pdf/samples/url2pdf.php";><div > >> class="no"><input type="hidden" name="url" value="<?= > >> > >> > > "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] ?>" /><input > > > >> type="submit" value="Save as PDF" class="button" title="ALT+F" > >> accesskey="f" /></div></form> > >> > >> 4) The result - I have button which prompts me of saving the page as > >> PDF. Very useful. And quite clean. > >> > >> So it's kind of a hack, and I am writing because if there's a better > >> > > way > > > >> to create the button and to know the _real_ _absolute_ url for the > >> current wiki page then please let me know. If you find it any other > >> > > way > > > >> useful or someone can import this to be a dokuwiki feature then this > >> would be even nicer. > >> > >> > >> best regards, > >> Heikko > >> > >> > >> > >> IMPORTANT: The contents of this email and any attachments are > >> > > confidential. They are intended for the named recipient(s) only. > > > >> If you have received this email in error, please notify the system > >> > > manager or the sender immediately and do not disclose the contents to > > anyone or make copies thereof. > > > >> *** PineApp scanned this email for viruses, vandals, and malicious > >> > > content. *** > > > >> > >> HTML document attachment (url2pdf.php) > >> 'print', 'renderimages' => true, > >> 'renderforms' => true, 'renderlinks' => true, > >> 'mode' => 'html', 'debugbox' => false, > >> 'draw_page_border' => false ); $media = > >> Media::predefined('A4'); $media->set_landscape(false); > >> $media->set_margins(array('left' => 10, > >> 'right' => 10, 'top' => 10, > >> 'bottom' => 10)); $media->set_pixels(1024); $g_px_scale = > >> mm2pt($media->width() - $media->margins['left'] - > >> $media->margins['right']) / $media->pixels; $g_pt_scale = $g_px_scale > >> * 1.43; $pipeline = new Pipeline; $pipeline->fetchers[] = new > >> FetcherURL; $pipeline->data_filters[] = new DataFilterDoctype(); > >> $pipeline->data_filters[] = new DataFilterUTF8(""); > >> $pipeline->data_filters[] = new DataFilterHTML2XHTML; > >> $pipeline->parser = new ParserXHTML; > >> $pipeline->pre_tree_filters = array(); $pipeline->layout_engine = new > >> LayoutEngineDefault; $pipeline->post_tree_filters = array(); > >> $pipeline->output_driver = new OutputDriverFPDF(); $time = time(); > >> $pipeline->destination = new DestinationDownload($url); > >> $pipeline->process($url, $media); $message = sprintf(" > >> Processing of '%s' completed in %u seconds", $url, time() - $time); > >> error_log($message); flush(); $time = time(); ?> > >> > > > IMPORTANT: The contents of this email and any attachments are confidential. > They are intended for the named recipient(s) only. > If you have received this email in error, please notify the system manager or > the sender immediately and do not disclose the contents to anyone or make > copies thereof. > *** PineApp scanned this email for viruses, vandals, and malicious content. > *** > > > HTML document attachment (url2pdf.php) > 'print', 'renderimages' => true, > 'renderforms' => true, 'renderlinks' => true, > 'mode' => 'html', 'debugbox' => false, > 'draw_page_border' => false ); $media = > Media::predefined('A4'); $media->set_landscape(false); > $media->set_margins(array('left' => 10, > 'right' => 10, 'top' => 10, > 'bottom' => 10)); $media->set_pixels(1024); $g_px_scale = > mm2pt($media->width() - $media->margins['left'] - > $media->margins['right']) / $media->pixels; $g_pt_scale = $g_px_scale > * 1.43; $pipeline = new Pipeline; $pipeline->fetchers[] = new > FetcherURL; $pipeline->data_filters[] = new DataFilterDoctype(); > $pipeline->data_filters[] = new DataFilterUTF8(""); > $pipeline->data_filters[] = new DataFilterHTML2XHTML; > $pipeline->parser = new ParserXHTML; > $pipeline->pre_tree_filters = array(); $pipeline->layout_engine = new > LayoutEngineDefault; $pipeline->post_tree_filters = array(); > $pipeline->output_driver = new OutputDriverFPDF(); $time = time(); > $pipeline->destination = new DestinationDownload($url); > $pipeline->process($url, $media); $message = sprintf(" > Processing of '%s' completed in %u seconds", $url, time() - $time); > error_log($message); flush(); $time = time(); ?> -- 42