diff --git a/include/tcpdf_static.php b/include/tcpdf_static.php index dc1572637..aaedd1dd6 100644 --- a/include/tcpdf_static.php +++ b/include/tcpdf_static.php @@ -106,6 +106,12 @@ class TCPDF_STATIC { */ public static $pageboxes = array('MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox'); + /** + * String thousands separator + * @private static + */ + private static $thousands_separator = '.'; + /** * Array of default cURL options for curl_setopt_array. * @@ -1022,7 +1028,7 @@ public static function getAnnotOptFromJSProp($prop, &$spot_colors, $rtl=false) { * @public static */ public static function formatPageNumber($num) { - return number_format((float)$num, 0, '', '.'); + return number_format((float)$num, 0, '', self::$thousands_separator); } /** @@ -1035,7 +1041,7 @@ public static function formatPageNumber($num) { * @public static */ public static function formatTOCPageNumber($num) { - return number_format((float)$num, 0, '', '.'); + return number_format((float)$num, 0, '', self::$thousands_separator); } /** @@ -2656,6 +2662,16 @@ public static function getPageMode($mode='UseNone') { return $page_mode; } + /** + * Set the thousands separator to use it in the number format. + * @param string $separator + * @return void + * @public static + */ + public static function setThousandsSeparator($separator) { + self::$thousands_separator = $separator; + } + } // END OF TCPDF_STATIC CLASS //============================================================+ diff --git a/tcpdf.php b/tcpdf.php index cffe210d2..2a1d80b98 100644 --- a/tcpdf.php +++ b/tcpdf.php @@ -2997,6 +2997,17 @@ public function setAllowLocalFiles($allowLocalFiles) { $this->allowLocalFiles = (bool) $allowLocalFiles; } + /** + * Set the thousands separator to use in the number formatting + * + * @param string $separator + * @public + * @return void + */ + public function setThousandsSeparator($separator) { + TCPDF_STATIC::setThousandsSeparator($separator); + } + /** * Throw an exception or print an error message and die if the K_TCPDF_PARSER_THROW_EXCEPTION_ERROR constant is set to true.