diff --git a/gulliver/thirdparty/html2ps_pdf/box.php b/gulliver/thirdparty/html2ps_pdf/box.php index 758b4baa5..7d6390c47 100755 --- a/gulliver/thirdparty/html2ps_pdf/box.php +++ b/gulliver/thirdparty/html2ps_pdf/box.php @@ -88,6 +88,10 @@ function _fix_display_position_float(&$css_state) { } function &create_pdf_box(&$root, &$pipeline) { + if ( !(@function_exists($root->node_type)) ) { + throw new Exception("Pdf not created", 1); + } + switch ($root->node_type()) { case XML_DOCUMENT_NODE: // TODO: some magic from traverse_dom_tree diff --git a/gulliver/thirdparty/html2ps_pdf/config.inc.php b/gulliver/thirdparty/html2ps_pdf/config.inc.php index f3931d104..a056ae4da 100755 --- a/gulliver/thirdparty/html2ps_pdf/config.inc.php +++ b/gulliver/thirdparty/html2ps_pdf/config.inc.php @@ -137,7 +137,9 @@ define('HTML2PS_VERSION_MINOR', 0); define('HTML2PS_SUBVERSON', 16); define('MAX_UNPENALIZED_FREE_FRACTION', 0.25); -define('MAX_FREE_FRACTION', 0.5); +if (!defined('MAX_FREE_FRACTION')) { + define('MAX_FREE_FRACTION', 0.5); +}; define('MAX_PAGE_BREAK_HEIGHT_PENALTY', 10000); define('MAX_PAGE_BREAK_PENALTY', 1000000); define('FORCED_PAGE_BREAK_BONUS', -1000000); diff --git a/gulliver/thirdparty/html2ps_pdf/dom.php5.inc.php b/gulliver/thirdparty/html2ps_pdf/dom.php5.inc.php index 841c56067..f356d074c 100755 --- a/gulliver/thirdparty/html2ps_pdf/dom.php5.inc.php +++ b/gulliver/thirdparty/html2ps_pdf/dom.php5.inc.php @@ -64,7 +64,7 @@ class DOMTree { } function node_type() { - return $this->domelement->nodeType; + return @$this->domelement->nodeType; } function &parent() { diff --git a/gulliver/thirdparty/html2ps_pdf/treebuilder.class.php b/gulliver/thirdparty/html2ps_pdf/treebuilder.class.php index f3b243860..5261041a6 100755 --- a/gulliver/thirdparty/html2ps_pdf/treebuilder.class.php +++ b/gulliver/thirdparty/html2ps_pdf/treebuilder.class.php @@ -16,7 +16,7 @@ class TreeBuilder { // Second - object-oriented interface // Third - pure PHP XML parser if (function_exists('domxml_open_mem')) { return domxml_open_mem($xmlstring); }; - if (class_exists('DOMDocument')) { return DOMTree::from_DOMDocument(DOMDocument::loadXML($xmlstring)); }; + if (class_exists('DOMDocument')) { return @DOMTree::from_DOMDocument(DOMDocument::loadXML($xmlstring)); }; if (file_exists(HTML2PS_DIR.'/classes/include.php')) { require_once(HTML2PS_DIR.'classes/include.php'); import('org.active-link.xml.XML'); diff --git a/workflow/engine/classes/model/OutputDocument.php b/workflow/engine/classes/model/OutputDocument.php index 546466559..0203823d5 100755 --- a/workflow/engine/classes/model/OutputDocument.php +++ b/workflow/engine/classes/model/OutputDocument.php @@ -1110,11 +1110,20 @@ class OutputDocument extends BaseOutputDocument } copy($sPath . $sFilename . '.html', PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.html'); - $status = $pipeline->process(((isset($_SERVER['HTTPS']))&&($_SERVER['HTTPS']=='on') ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . '/files/' . $_SESSION['APPLICATION'] . '/outdocs/' . $sFilename . '.html', $g_media); - - copy(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf', $sPath . $sFilename . '.pdf'); - unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf'); - unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.html'); + try { + $status = $pipeline->process(((isset($_SERVER['HTTPS']))&&($_SERVER['HTTPS']=='on') ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . '/files/' . $_SESSION['APPLICATION'] . '/outdocs/' . $sFilename . '.html', $g_media); + copy(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf', $sPath . $sFilename . '.pdf'); + unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf'); + unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.html'); + } catch (Exception $e) { + if ($e->getMessage() == 'Pdf not created') { + include_once ("classes/model/AppDocument.php"); + list($sFileUID,$docVersion) = explode('_',$sFilename); + $oAppDocument = new AppDocument (); + $oAppDocument->remove($sFileUID,$docVersion); + G::SendTemporalMessage (G::loadTranslation("ID_OUTPUT_NOT_GENERATE"), "Error"); + } + } } /**