mirror of
https://github.com/unidoc/unipdf.git
synced 2025-05-02 22:17:06 +08:00
Parse floating point numbers correctly in content streams e.g. .1 .1 .2 RG
This commit is contained in:
parent
4db1306daf
commit
5e0baec137
@ -544,7 +544,7 @@ func (this *ContentStreamParser) parseObject() (PdfObject, error, bool) {
|
||||
common.Log.Trace("->Array!")
|
||||
arr, err := this.parseArray()
|
||||
return &arr, err, false
|
||||
} else if IsDecimalDigit(bb[0]) || (bb[0] == '-' && IsDecimalDigit(bb[1])) {
|
||||
} else if IsFloatDigit(bb[0]) || (bb[0] == '-' && IsFloatDigit(bb[1])) {
|
||||
common.Log.Trace("->Number!")
|
||||
number, err := this.parseNumber()
|
||||
return number, err, false
|
||||
|
@ -15,6 +15,10 @@ func IsWhiteSpace(ch byte) bool {
|
||||
}
|
||||
}
|
||||
|
||||
func IsFloatDigit(c byte) bool {
|
||||
return ('0' <= c && c <= '9') || c == '.'
|
||||
}
|
||||
|
||||
func IsDecimalDigit(c byte) bool {
|
||||
if c >= '0' && c <= '9' {
|
||||
return true
|
||||
|
Loading…
x
Reference in New Issue
Block a user