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 - FormFields
  FAQ FAQ  Forum Search   Register Register  Login Login

FormFields

 Post Reply Post Reply
Author
Message
Detlev View Drop Down
Beginner
Beginner
Avatar

Joined: 28 Jan 10
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Detlev Quote  Post ReplyReply Direct Link To This Post Topic: FormFields
    Posted: 25 Mar 10 at 3:36PM

Hi,

I use PDF-template with form fields and fill them with values from SQL query fields with the same name. If I need more than one page, all fields we be flatten, the page will be saved and added to a mergelist, and the new template will be loaded.

This is the loop:

for i := ffc downto 1 do
begin
Name := PDFLibrary.GetFormFieldTitle(i);
   if qArchiv.FindField(Name) <> Nil then
      PDFLibrary.SetFormFieldValue
         (i, VarToStr(qArchiv.FieldByName(Name).Value));
   PDFLibrary.FlattenFormField(i);
end; 

The problem is, that it happens that values will be placed somewhere on the page or the values of one field will be placed in another field too. For a given set of data the behaviour is repeatable. But I cannot find any reason for this. A page more or less and the situation is quiet different.

Has anybody any idea what is going wrong and how to debug this?

Detlev

Back to Top
Jack View Drop Down
Team Player
Team Player
Avatar

Joined: 03 Jun 09
Location: Lompoc, CA
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote Jack Quote  Post ReplyReply Direct Link To This Post Posted: 25 Mar 10 at 4:38PM
It sounds like you are attempting to do pretty much what I am doing.  Because Acrobat fills in all fields that have the same name as the field you want to fill in with the data you supply for that field you have to accommodate that in your routine.  For my purposes, I have to fill in forms that will have "details".  Like for instance, I do forms for employer state taxes that have 7 employees per form.  When I set up the form, I name the first field something like EmployeeName_01, the next one EmployeeName_02 and so on.  Then I append that to the name of the SQL field as I am setting the data. 

Because I will have about 20 pages of this kind of data, I also have to prepend the page name to the field name and change the names of the fields on the form in this process so that I am actually sending data to fields named something like 001_EmployeeName_01 and so on. 

Finally, it has been a long time since I did this and I am working from memory but I think I had a problem with my SQL field names being all upper case and my wanting my form field names to be more understandable, so I had a mismatch because I think QuickPDF was case sensitive.  So when I bring in each template, I read all the field names and indexes into a StringList which I can set to be non-case sensitive and then I set the field data by field index.

As much as I really like QuickPDF, I don't want to have to deal with their concept of PDFs in the middle of my program, so I wrap QuickPDF up in a class that's a lot easier for me to use.
Back to Top
Detlev View Drop Down
Beginner
Beginner
Avatar

Joined: 28 Jan 10
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Detlev Quote  Post ReplyReply Direct Link To This Post Posted: 25 Mar 10 at 7:42PM

Hi Jack,

in my case all form fields have unique names (I did it like you: blabla_01 ...). Some have names all uppercase (these can directly been filled with database field values), others mixed-case (these with a special preprocessing). The problem is with uppercase fields, thats true. I give it a chance with renamed fields.

But what about text, which stands at a position where never any form field has been defined? These imaginary positions have some kind of intrinsic systematic: if this problem occur, the text is placed at 1 out of 3 senseless positions.

Back to Top
Jack View Drop Down
Team Player
Team Player
Avatar

Joined: 03 Jun 09
Location: Lompoc, CA
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote Jack Quote  Post ReplyReply Direct Link To This Post Posted: 25 Mar 10 at 9:50PM
I don't do anything with drawing text, but it looks like it should work.  How do you do that in your program?  
Back to Top
Detlev View Drop Down
Beginner
Beginner
Avatar

Joined: 28 Jan 10
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Detlev Quote  Post ReplyReply Direct Link To This Post Posted: 26 Mar 10 at 7:58AM

This is my workflow:

  • Given a PDF file (template) with form fields with known names (designed with Acrobat)
  • Reading in the template and doing the loop from my first post
  • Saving
  • Creating a new empty page and doing some GDI operations
  • Merging the two, capture page 1 and draw captured page on the page left
  • Saving and delivering via HTTP ResponseInfo.WriteContent

Meanwhile I think it has to do with CapturePage and DrawCapturedPage. If I flatten form fields before CapturePage the assigned text appears in the resulting PDF as expected, with the exception of the wrong placed once. If I don't flatten before CapturePage, all fields are empty on the final PDF. The PDF reader (Acrobat, Foxit, it doesn't matter) indicates existence of form fields (they aren't flattened), but they won't be shown. A really inconsistent state.

Back to Top
Detlev View Drop Down
Beginner
Beginner
Avatar

Joined: 28 Jan 10
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Detlev Quote  Post ReplyReply Direct Link To This Post Posted: 26 Mar 10 at 9:55AM
Good news: upgrade to version 7.18 solved the problem.
Back to Top
Jack View Drop Down
Team Player
Team Player
Avatar

Joined: 03 Jun 09
Location: Lompoc, CA
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote Jack Quote  Post ReplyReply Direct Link To This Post Posted: 26 Mar 10 at 2:24PM
I'm glad that solved the problem.  Somewhere down the line I may want to make use of what you are doing to do something like put a logo on a form otherwise drawn from some standard source.
Back to Top
Detlev View Drop Down
Beginner
Beginner
Avatar

Joined: 28 Jan 10
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Detlev Quote  Post ReplyReply Direct Link To This Post Posted: 03 Apr 10 at 6:25PM

Bad news: in Delphi I use compiler directives to either use library version 7.17 or 7.18. The problem discussed above is solved in version 7.18. But now a new problem comes up.

When filling some fields, which aren't different from others (besides the name and the order of processing), an exception is raised. I cannot recognize any systematic which fields or which values are affected. Setting the same text values to other form fields works fine.

Any idea would be appreciated.

Back to Top
Detlev View Drop Down
Beginner
Beginner
Avatar

Joined: 28 Jan 10
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Detlev Quote  Post ReplyReply Direct Link To This Post Posted: 08 Apr 10 at 8:43AM

Sorry, once again. In a few days I have a presentation, and my form field error still exists. This is one of the strings, which caused SetFormFieldValueByTitle to fail (keep in mind: only in ONE PDF formular, the same form field copied and pasted in another PDF works fine, copied and pasted back also works, but than the NEXT field fails ???).

AUP 2002/2003 des Kreises Aachen, Grube Diepenlinchen Industriestr. 15

Geotechnischer Bericht über Baugrund und Gründung, Stich, Eschweiler

In the first line I replaced the dot with the german "aße", and it works. In the second lines removing the comma and the umlaut "ü" doesn't help.

This string don't fail:

Gutachten zur Untersuchung der Bebaubarkeit des Grundstücks in Stolberg, Flur 68, "In der Dell"

Sometimes  

ffName := PDFLibrary.GetFormFieldTitle(i);

results to "." and the program fails. For a given dataset and a given PDF with form fields this behaviour is reproducable. Under different conditions something different happens. I tried the DLL version 7.17, 7.18 and the Delphi version 7.18.

Please, has anybody any idea, what could be the reason for these unexpected results?

Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 08 Apr 10 at 9:11AM
Hi!

You should use the official support page in this case:
http://www.quickpdflibrary.com/support/support-query.php
Please upload the specific form and test data, too.

Cheers, Ingo

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