From 1129505bea9bb8961016f9aba8776c0d2af5b894 Mon Sep 17 00:00:00 2001 From: Kunal Ray Date: Tue, 7 Apr 2026 14:39:49 +0530 Subject: [PATCH 1/2] Set the thousands separator --- include/tcpdf_static.php | 20 ++++++++++++++++++-- tcpdf.php | 10 ++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) 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..0e0c31afe 100644 --- a/tcpdf.php +++ b/tcpdf.php @@ -2997,6 +2997,16 @@ public function setAllowLocalFiles($allowLocalFiles) { $this->allowLocalFiles = (bool) $allowLocalFiles; } + /** + * Set the thousands separator to use in the number formatting + * + * @param string $separator + * @public + */ + 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. From 6c1c8c9a2ccdc6a84e1dcae183f529dff6558ad0 Mon Sep 17 00:00:00 2001 From: Kunal Ray Date: Tue, 7 Apr 2026 15:27:33 +0530 Subject: [PATCH 2/2] Add the return type in the doc string --- tcpdf.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tcpdf.php b/tcpdf.php index 0e0c31afe..2a1d80b98 100644 --- a/tcpdf.php +++ b/tcpdf.php @@ -3002,6 +3002,7 @@ public function setAllowLocalFiles($allowLocalFiles) { * * @param string $separator * @public + * @return void */ public function setThousandsSeparator($separator) { TCPDF_STATIC::setThousandsSeparator($separator);