Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
Values being set to the wrong fields |
Post Reply |
Author | |
waynefulcher
Senior Member Joined: 23 Jun 08 Location: United States Status: Offline Points: 99 |
Post Options
Thanks(0)
Posted: 07 May 19 at 10:55PM |
I have found yet another bug in the latest QPL 16.12.
I have already reported the bug to FoxIt but was wondering if anyone else has had the same issue and if there is a workaround. So I have a PDF with the following text fields: PaymentAmount01 PaymentAmount02 PaymentAmount03 PaymentAmount04 if I loop through fields and display the index of each field they are: PaymentAmount01 - 28 PaymentAmount02 - 24 PaymentAmount03 - 26 PaymentAmount04 - 29 if call PDF.SetFormFieldValue(24, 'abc') then save the pdf to temp.pdf and open it, all 4 fields contain the text 'abc'. I have also tried the following line of code: PDF.SetFormFieldValueByTitle('PaymentAmount03', 'xyz') ; then all 4 fields have the text 'xyz' This didn't happen in version 8.x. Because we have literally 1000's of PDFs and many of them have fields with similar names like this, changing the field names is not an option. I am guessing unless they fix this soon my only option will be to roll back one version of the library at a time till I find one that does not have this bug. TIA |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi Wayne,
is it possible to have a look into these pdf-file? I fear you don't have used the complete form field name? I'm pretty sure the reason for this issue is on your side ;-) It's important to know the type of form. Is it an acro form or an xfa form? For acro forms this code of mine works always: QP.SetNeedAppearances(1); QP.SetFormFieldValueByTitle(FieldName, FieldValue); nresult := QP.FindFormFieldByTitle(FieldName); QP.UpdateAppearanceStream(nresult); |
|
Cheers,
Ingo |
|
waynefulcher
Senior Member Joined: 23 Jun 08 Location: United States Status: Offline Points: 99 |
Post Options
Thanks(0)
|
I would love to send you the PDF to test with but I have enever been able to figure out how to share any pics or files on this fourm
|
|
waynefulcher
Senior Member Joined: 23 Jun 08 Location: United States Status: Offline Points: 99 |
Post Options
Thanks(0)
|
Well I did just type a field name to illustarate the issue not thinking the name could be the issue since this works just fine on the previous library. So the actual field names would be "PS_AmountOfPayments##" where ## is 01 - 04
I just dropped a button on my form and put your code in the click event which I pasted below and I get the problem still:
FieldName := 'PS_AmountOfPayments02' ; FieldValue := 'abc' ; pdfNewName := 'c:\temp\temp.pdf' ; myPDF.SetNeedAppearances(1); myPDF.SetFormFieldValueByTitle(FieldName, FieldValue); index := myPDF.FindFormFieldByTitle(FieldName); myPDF.UpdateAppearanceStream(index); myPDF.SaveToFile(pdfNewName) ; ShellExecute(Application.Handle, PChar('open'), PChar(pdfNewName), nil, PChar(ExtractFilePath(pdfNewName)), SW_SHOW); |
|
waynefulcher
Senior Member Joined: 23 Jun 08 Location: United States Status: Offline Points: 99 |
Post Options
Thanks(0)
|
Oh yeah, one more thing, I only have acro fields in the PDF
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi Wayne,
just upload your file anywhere on a free file hoster and post the link here. |
|
Cheers,
Ingo |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi Wayne,
are the form fields still form fields after saving or not? It depends on what you're doing - it can be that the form field index can be modified with each maintained and flattened form field... Again: I'm testing with a new tool of mine to set and get all form fields - so i could try with your file... Edited by Ingo - 08 May 19 at 6:53PM |
|
Cheers,
Ingo |
|
waynefulcher
Senior Member Joined: 23 Jun 08 Location: United States Status: Offline Points: 99 |
Post Options
Thanks(0)
|
https://www.dropbox.com/s/uhohmejiqcoh49b/testinput.pdf?dl=0
If my link above works then hopefully you can get the actual PDF. All I know is it has become very frustrating trying to figure out what triggers the value to be duplicated to other fields. If you use this pdf you will notice the value will be duplicated to the following fields: (Again ## = 01 - 04) PS_DateOfPayments## PS_AmountOfPayments## but does not duplicate for: PS_NumberOfPayments## I have tried every combination of flatten, don't flatten, setting needappearance or not, none of that matters. Here is the even stranger thing, I can use PhantomPDF editor and change the names and the problem seems to go away, so you would think if I changed the names back to the original name then the problem would come back again, but it does not. What I did to quickly try all combinations of fields, and other settings was add a lot of checkboxes to my delphi test program so I could optionally set things. You will see what I am saying when you see the code I am posting below. For my own sanity I am setting the value to the field index and the current minutes and seconds so each time I preview the output pdf I will know it actually updated with the new value. procedure TfrmMain.btnTestPDFClick(Sender: TObject); var FieldName: String ; FieldValue: String ; title: String ; index: Integer ; value: String ; myPDF: TQuickPDF ; pdfNameIn: String ; pdfNameOut: String ; UnlockResult: Integer; begin pdfNameIn := 'c:\temp\testinput.pdf' ; pdfNameOut := 'c:\temp\testoutput.pdf' ; // FieldName := 'PS_AmountOfPayments02' ; // FieldName := 'PS_NumberOfPayments02' ; // FieldName := 'PS_DateOfPayments02' ; // combo lets me select which field name to test with FieldName := Trim(cmbField.Text) ; myPDF := TQuickPDF.Create; try UnlockResult := myPDF.UnlockKey(PDF_Unlock_Key); if UnlockResult <> 1 then begin MessageDlg('Invalid QuickPDF license key.', mtError, [mbOK], 0); Exit ; end ; if (myPDF.LoadFromFile(pdfNameIn, '') <> 1) then begin MessageDlg('Error opening '+pdfNameIn+': '+IntToStr(myPDF.LastErrorCode), mtError, [mbOK], 0); Exit ; end ; index := myPDF.FindFormFieldByTitle(FieldName); FieldValue := IntToStr(index)+' - '+FormatDateTime('nn:ss', now); if cbNeedAppearance.Checked then myPDF.SetNeedAppearances(1) else myPDF.SetNeedAppearances(0); if cbSetByTitle.Checked then myPDF.SetFormFieldValueByTitle(FieldName, FieldValue); if cbSetByIndex.Checked then myPDF.SetFormFieldValue(index, FieldValue); if cbUpdateAppearance.Checked then myPDF.UpdateAppearanceStream(index); if cbFlatten.Checked then myPDF.FlattenAllFormFields(0); myPDF.SaveToFile(pdfNameOut) ; finally myPDF.Free ; end ; ShellExecute(Application.Handle, PChar('open'), PChar(pdfNameOut), nil, PChar(ExtractFilePath(pdfNameOut)), SW_SHOW); end; |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
What i can tell already is:
I've maintained three lines with numbers, amounts and dates. The fourth line remains free. INSIDE there are the correct actual maintained values. I can be sure cause i've extracted all form field content after maintaining. All pdf readers are showing the correct numbers. Amounts and dates will be displayed correct with an actual adobe reader. In Sumatra amounts and dates will be displayed nearly correct but the values from the third line are on the (empty) fourth line as well. Foxit 8.2 shows the second line with amounts and dates on all four lines BUT when i click on the single values, the correct values appear temporary. It's very strange. I think more that the problem is the designed pdf form itself... I need more investigation ... perhaps on the weekend. |
|
Cheers,
Ingo |
|
waynefulcher
Senior Member Joined: 23 Jun 08 Location: United States Status: Offline Points: 99 |
Post Options
Thanks(0)
|
What I have just found is if I use PhantomPDF editor and change the name by adding an x in front of the name, click off the field and then click back on the field and remove the x I just added, leaving the field name the same as the original. Repeat for all 4 fields, then save the pdf. The problem goes away.
The person who originally edited the pdf I think was using Adobe Acrobat. I am currently writing some code in delphi to open a pdf, change all field names, then change them all back then save the pdf and see if that would also fix the issue. If so I may call it good and move on to the memo comparability issue. Thanks for all your help. (let me know where to mail the check to ;-) |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions 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 |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store