https://www.dropbox.com/s/uhohmejiqcoh49b/testinput.pdf?dl=0" rel="nofollow - 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;
|