BUG 10746 I added a validate to pdf size SOLVED
I added a validate to pdf size
This commit is contained in:
4
gulliver/thirdparty/html2ps_pdf/box.php
vendored
4
gulliver/thirdparty/html2ps_pdf/box.php
vendored
@@ -88,6 +88,10 @@ function _fix_display_position_float(&$css_state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function &create_pdf_box(&$root, &$pipeline) {
|
function &create_pdf_box(&$root, &$pipeline) {
|
||||||
|
if ( !(@function_exists($root->node_type)) ) {
|
||||||
|
throw new Exception("Pdf not created", 1);
|
||||||
|
}
|
||||||
|
|
||||||
switch ($root->node_type()) {
|
switch ($root->node_type()) {
|
||||||
case XML_DOCUMENT_NODE:
|
case XML_DOCUMENT_NODE:
|
||||||
// TODO: some magic from traverse_dom_tree
|
// TODO: some magic from traverse_dom_tree
|
||||||
|
|||||||
@@ -137,7 +137,9 @@ define('HTML2PS_VERSION_MINOR', 0);
|
|||||||
define('HTML2PS_SUBVERSON', 16);
|
define('HTML2PS_SUBVERSON', 16);
|
||||||
|
|
||||||
define('MAX_UNPENALIZED_FREE_FRACTION', 0.25);
|
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_HEIGHT_PENALTY', 10000);
|
||||||
define('MAX_PAGE_BREAK_PENALTY', 1000000);
|
define('MAX_PAGE_BREAK_PENALTY', 1000000);
|
||||||
define('FORCED_PAGE_BREAK_BONUS', -1000000);
|
define('FORCED_PAGE_BREAK_BONUS', -1000000);
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class DOMTree {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function node_type() {
|
function node_type() {
|
||||||
return $this->domelement->nodeType;
|
return @$this->domelement->nodeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
function &parent() {
|
function &parent() {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class TreeBuilder {
|
|||||||
// Second - object-oriented interface
|
// Second - object-oriented interface
|
||||||
// Third - pure PHP XML parser
|
// Third - pure PHP XML parser
|
||||||
if (function_exists('domxml_open_mem')) { return domxml_open_mem($xmlstring); };
|
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')) {
|
if (file_exists(HTML2PS_DIR.'/classes/include.php')) {
|
||||||
require_once(HTML2PS_DIR.'classes/include.php');
|
require_once(HTML2PS_DIR.'classes/include.php');
|
||||||
import('org.active-link.xml.XML');
|
import('org.active-link.xml.XML');
|
||||||
|
|||||||
@@ -1110,11 +1110,20 @@ class OutputDocument extends BaseOutputDocument
|
|||||||
}
|
}
|
||||||
|
|
||||||
copy($sPath . $sFilename . '.html', PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.html');
|
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);
|
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');
|
copy(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf', $sPath . $sFilename . '.pdf');
|
||||||
unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf');
|
unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf');
|
||||||
unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.html');
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user