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

Notification

Icon
Error

Options
Go to last post Go to first unread
cristian.hanca@kontron.com  
#1 Posted : Tuesday, July 27, 2021 10:09:29 AM(UTC)
cristian.hanca@kontron.com

Rank: Newbie

Groups: Registered
Joined: 7/27/2021(UTC)
Posts: 1
Austria

Hello,

Our customer has presented us with a problem when opening a PDF, that has been edited using PDFium, in Acrobat Reader. After extensive debugging, we have determined that the cause lies within PDFium and manifests itself under specific circumstances. We are using version "4.54" for our tests.

Attached you will find "TestFile.pdf", which is an altered version of the customer file. Our interest lies in the pre-filled Fields. "Stand vorher" and "Stand nachher" are used to compute "Abgabe (Zahl_Abgabe01)". This field, alongside "Preis / Menge (Preis_Menge01)", are used to compute "Betrag_Prod01", using the following JS:
Code:
var Menge = this.getField("Zahl_Abgabe01").value;<br>var Preis = this.getField("Preis_Menge01").value;<br>var Betrag = (Menge*Preis).toFixed(2);<br>this.getField("Betrag_Prod01").value = Betrag;<br>var a = this.getField("Betrag_Prod01").value;<br>var b = this.getField("Text_Waehrung.8");<br>if (a == 0) {<br>b.display = display.hidden;<br>} else {<br>b.display = display.visible;<br>}

Note that we have removed our debugging alert, whcich you will see in the following screenshots. Computation is triggered when "Stand vorher", "Stand nachher" or "Preis / Menge" is changed. The expected outcome as follows:
Expectation.png (33kb) downloaded 0 time(s).
However, in reality the following is displayed when opening the file in Acrobat Reader:
Reality.png (8kb) downloaded 0 time(s).
Followed by the error our customer reported:
Error.png (7kb) downloaded 0 time(s).

As it can be seen, we narrowed the error down to the "Preis / Menge (Preis_Menge01)" field, which Acrobat wrongly assumes it is a "String". However, the PDFium instance that saved this file, correctly determines the field as "Number":
Expectation-PDFIum.png (52kb) downloaded 0 time(s).

Of note is the fact that the following is the Formatting Function for the problematic Field:
Code:
AFNumber_Format(3, 2, 0, 0, "", true);

And the following Keystroke:
Code:
AFNumber_Keystroke(3, 2, 0, 0, "", true);

Both of which should guarantee that the field stores a Number.
The only way to fix the PDF, is for the user to retype the "Preis / Menge" field...

Attached, you will find the test application alongside the Test File and the Original Customer File (with no debug alert or manipulation on our side to get it there).
TestApp.zip (379kb) downloaded 0 time(s).

We hope to be hearing from you as soon as possible!

Best regards,
on behalf of Kontron Technologies GmBH
Users browsing this topic
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.