| 1 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
require_once(HTML2PS_DIR.'pipeline.class.php');
|
|
|
4 |
|
|
|
5 |
class PipelineFactory {
|
|
|
6 |
function &create_default_pipeline($encoding, $filename) {
|
|
|
7 |
$pipeline =& new Pipeline();
|
|
|
8 |
|
|
|
9 |
if (isset($GLOBALS['g_config'])) {
|
|
|
10 |
$pipeline->configure($GLOBALS['g_config']);
|
|
|
11 |
} else {
|
|
|
12 |
$pipeline->configure(array());
|
|
|
13 |
};
|
|
|
14 |
|
|
|
15 |
// if (extension_loaded('curl')) {
|
|
|
16 |
// require_once(HTML2PS_DIR.'fetcher.url.curl.class.php');
|
|
|
17 |
// $pipeline->fetchers[] = new FetcherUrlCurl();
|
|
|
18 |
// } else {
|
|
|
19 |
require_once(HTML2PS_DIR.'fetcher.url.class.php');
|
|
|
20 |
$pipeline->fetchers[] = new FetcherURL();
|
|
|
21 |
// };
|
|
|
22 |
|
|
|
23 |
$pipeline->data_filters[] = new DataFilterDoctype();
|
|
|
24 |
$pipeline->data_filters[] = new DataFilterUTF8($encoding);
|
|
|
25 |
$pipeline->data_filters[] = new DataFilterHTML2XHTML();
|
|
|
26 |
$pipeline->parser = new ParserXHTML();
|
|
|
27 |
$pipeline->pre_tree_filters = array();
|
|
|
28 |
$pipeline->layout_engine = new LayoutEngineDefault();
|
|
|
29 |
$pipeline->post_tree_filters = array();
|
|
|
30 |
$pipeline->output_driver = new OutputDriverFPDF();
|
|
|
31 |
$pipeline->output_filters = array();
|
|
|
32 |
$pipeline->destination = new DestinationDownload($filename, ContentType::pdf());
|
|
|
33 |
|
|
|
34 |
return $pipeline;
|
|
|
35 |
}
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
?>
|