Fermer2
AdobeLe 11/09/2012 à 15:53
Is there a way to convert html file (generated by Sphinx) to a pdf with table of contents?

I'm on kubuntu 12.04, I've downloaded the lib, move files to html dir, and have modified example00.php:

<?php
/**
* HTML2PDF Librairy - example
*
* HTML => PDF convertor
* distributed under the LGPL License
*
* @author Laurent MINGUET <webmaster@html2pdf.fr>
*
* isset($_GET['vuehtml']) is not mandatory
* it allow to display the result in the HTML format
*/

// get the HTML
ob_start();
include(dirname(__FILE__).'/index.html');
$content = ob_get_clean();

// convert in PDF
require_once(dirname(__FILE__).'/html2pdf.class.php');
try
{
$html2pdf = new HTML2PDF('P', 'A4', 'en');
// $html2pdf->setModeDebug();
$html2pdf->setDefaultFont('Arial');
$html2pdf->writeHTML($content, isset($_GET['vuehtml']));
$html2pdf->Output('index.pdf');
}
catch(HTML2PDF_exception $e) {
echo $e;
exit;
}

(I've also renamed the file to index.php) Then I run it with

php5 index.php

It gave me:

PHP Notice: Undefined variable: kPathUrl in /home/boris/pst/wordy/edu/MolDynOfMicroBioSystems/_build/singlehtml/_class/tcpdfConfig.php on line 80
<strong>TCPDF ERROR: </strong>Could not include font definition file: arial

I don't know what to do next. I'm not a php programmer (but I know python, elisp, bash).