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!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - SetFormFieldValue
  FAQ FAQ  Forum Search   Register Register  Login Login

SetFormFieldValue

 Post Reply Post Reply
Author
Message
HMArnold View Drop Down
Beginner
Beginner


Joined: 03 Jun 09
Location: Texas
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote HMArnold Quote  Post ReplyReply Direct Link To This Post Topic: SetFormFieldValue
    Posted: 03 Jun 09 at 12:48AM
When I run the following code, I get a count of 19 fields available, but after I run it I get a new PDF but the fields have no data:
 
procedure TForm1.ScanButtonClick(Sender: TObject);
var Fields, x                             : integer;
    ExptFile                              : string;
    PDF                                   : TQuickPDF0712;
begin
  ExptFile := 'Test.pdf';
  PDF := TQuickPDF0712.Create;
  try
    if PDF.UnlockKey('xx') <> 1
      then Raise EInvalidOp.Create('invalid unlock code');
    if PDF.LoadFromFile(MasterPDF) <> 1
      then Raise EInvalidOp.Create('unable to open PDF file : '+MasterPDF);
    PDF.SetNeedAppearances(1);
    Fields := PDF.FormFieldCount;
    ListBox1.Items.Add('Form Fields : '+IntToStr(Fields));
    for x := 1 to Fields do
      begin
        if PDF.SetFormFieldValue (x,'Test '+IntToStr(x)) = 1 then ListBox1.Items.Add('ok');
        PDF.UpdateAppearanceStream(x);
      end;
    if PDF.SaveToFile(ExptFile) <> 1
      then Raise EInvalidOp.Create('unable to save PDF file : '+ExptFile);
    ListBox1.Items.Add('File saved : '+ExptFile);
    except Raise EInvalidOp.Create('PDF operation error');
  end;
end;
Does anyone have example code?
 
Thanks
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3530
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 03 Jun 09 at 6:17AM
Hi!

With your code the values are inside the formfields ... but not visible.
If you want to make formfield-content visible you have to change the content to text.
Please read about the function "FlattenFormField" that's what you need.

Cheers, Ingo

Back to Top
HMArnold View Drop Down
Beginner
Beginner


Joined: 03 Jun 09
Location: Texas
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote HMArnold Quote  Post ReplyReply Direct Link To This Post Posted: 03 Jun 09 at 12:43PM

I saw that in an earlier post of your and had tried that with no effect.

After I checked the encyption status I saw the original PDF was protected, so I used the DecryptFile function first, and that allowed me to change the fields.
 
Thanks for your help!
 
Hank
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store