logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
paleise  
#1 Posted : Thursday, October 26, 2017 1:04:50 AM(UTC)
paleise

Rank: Advanced Member

Groups: Registered
Joined: 10/13/2017(UTC)
Posts: 52
Germany
Location: Freiburg

Thanks: 3 times
Hi,
there is a problem with the attached pdf. The sum works not correct. Please try values greater then 1000 with decimal. I think you have to know that in Germany we have a dot for thousand and a ',' for deciaml 1.234,56
Furthermore the Sum field is locked. But it gets the focus when tab through the pdf

Regards Peter Test.pdf (40kb) downloaded 21 time(s).
paleise  
#2 Posted : Thursday, November 2, 2017 3:21:21 AM(UTC)
paleise

Rank: Advanced Member

Groups: Registered
Joined: 10/13/2017(UTC)
Posts: 52
Germany
Location: Freiburg

Thanks: 3 times
Hi,
the sum problem still not work. The focus is now ok.

Look at the test.pdf. The fields have the format "1.234,56" which we use in Germany.
The sum field only working when input no decimal values to value1 and value2! In Acrobat Reader is it ok.
Do you have a solution?

Thanks so much.
paleise  
#3 Posted : Thursday, November 2, 2017 4:12:11 AM(UTC)
paleise

Rank: Advanced Member

Groups: Registered
Joined: 10/13/2017(UTC)
Posts: 52
Germany
Location: Freiburg

Thanks: 3 times
Perhaps this is the problem: the field shows 2,54 but the pdfForm.Fields[n].value is 2.54.

Regards
Peter
PataAndrey  
#4 Posted : Friday, November 3, 2017 2:56:07 AM(UTC)
PataAndrey

Rank: Member

Groups: Registered
Joined: 11/3/2017(UTC)
Posts: 7

Was thanked: 1 time(s) in 1 post(s)
Hello. Sorry for late reply

Currently result field in pdf file is calculated as follows:
Code:

var wert1 = Number(getField("Value1").value);
var wert2 = Number(getField("Value2").value);
var summe = wert1 + wert2;
if (summe > 0)
{
  getField("Sum").value = summe;
}
else
{
  getField("Sum").value = "";
}


Pdfium uses JavaScript engine V8 (this JS engine used by chrome too).
If you run such script as "Number(12,34)" on JavaScript, then the result output will be NaN.
In other case, script "Number(12.34)" output "12.34". So this, summation work wrong.

pict.PNG (3kb) downloaded 38 time(s).

Adobe Reader use another engine, so it work ok.

So you have two options:
1) Change format of fields "Value1" and "Value2", that delimiter will be dot (".").
2) Replace "Number" on something else. Operator "Number" does not understand comma (",").

Edited by moderator Friday, November 3, 2017 3:34:58 AM(UTC)  | Reason: Not specified

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.