Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions include/tcpdf_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand Down Expand Up @@ -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

//============================================================+
Expand Down
11 changes: 11 additions & 0 deletions tcpdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down