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

GetFormFieldPage - Checkbox

 Post Reply Post Reply
Author
Message
waynefulcher View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 Jun 08
Location: United States
Status: Offline
Points: 99
Post Options Post Options   Thanks (0) Thanks(0)   Quote waynefulcher Quote  Post ReplyReply Direct Link To This Post Topic: GetFormFieldPage - Checkbox
    Posted: 23 Apr 19 at 7:20PM
OK, I know you guys are probably tired of hearing from me, but I am hopeful if I can resolve any one of my issues that it may lead to resolving other issues.

I am using FoxIt PhantomPDF 9.4.1 to edit some pdfs. 
In my Delphi 7 app using the QuickPDF 16.x and running the following code to list all the fields in this PDF.

    for FieldIX := 1 to qpdf.FormFieldCount do begin
      sLine := ' Pg: '+IntToStr(qpdf.GetFormFieldPage(FieldIX))+
               ' Ht: '+FloatToStr(qpdf.GetFormFieldBound(FieldIX, PDF_Bound_Height))+
               ' Wd: '+FloatToStr(qpdf.GetFormFieldBound(FieldIX, PDF_Bound_Width));
      
      sortedFields.Add(PadR(qpdf.GetFormFieldTitle(FieldIX), maxFldWidth) + sLine) ;
    end ;

What I am finding is that for every checkbox I added to the form I am getting 0 from the GetFormFieldPage() method. Of course 0 means:
 
The form field could not be found, or the form field does not have valid page
information


I have much logic to ignore fields that return 0 for the Page but this is a valid field.
Here is a snippet of the output from the above code:
LC_DateMaturity                     Pg: 1 Ht: 12.658 Wd: 104.794
LC_InterestMethod_30360or360360_Chk Pg: 0 Ht: 0 Wd: 0
LC_InterestMethod_Actual360_Chk     Pg: 0 Ht: 0 Wd: 0
LC_InterestMethod_Actual365_Chk     Pg: 0 Ht: 0 Wd: 0
LC_InterestRateFixed_Chk            Pg: 0 Ht: 0 Wd: 0
LC_InterestRateFixedRate            Pg: 1 Ht: 10.436 Wd: 42.41
LC_InterestRateVariable_Chk         Pg: 0 Ht: 0 Wd: 0
LC_InterestRateVariableIndexRate    Pg: 1 Ht: 10.4359999999999 Wd: 42.41

All the field names with _Chk are my checkbox fields.

I was gonna upload a screenshot of phantom editor with field highlighted but I can't figure out how to insert image into the post.



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: 23 Apr 19 at 10:07PM
Hi Wayne,

you can upload your sample files and images to drop box or any other file hoster and post the link for us here in the forum.
To your actual issue:
What tool was used to generate the pdf?
Are there already XFA-fields inside?
As far as i understand GetFormFieldPage you can use it this way:
First you check the form field count...
Then you're in a loop working on your form fields...
The GetFormFieldPage(form field number) in the loop returns the page where the current form field is inside.
What i THINK is:
The GetFormFieldPage doesn't know your new checkbox right after creation?

Cheers,
Ingo

Back to Top
waynefulcher View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 Jun 08
Location: United States
Status: Offline
Points: 99
Post Options Post Options   Thanks (0) Thanks(0)   Quote waynefulcher Quote  Post ReplyReply Direct Link To This Post Posted: 23 Apr 19 at 10:24PM
Yes, Yes and No.

What you described is exactly the sample code I pasted before.
But before that, the PDF is being modified by PhantomPDF 9.x.
I am not aware of what XFA-fields are in terms of how I would use them.

So my delphi code is working with an existing PDF, it is not trying to create a pdf just read info from it.

It is looping through based on FormFieldCount.
The fact that it gets the field name of the checkbox with GetFormFieldTitle(FieldIX) tells me it knows the checkbox is there. but then you call GetFormFieldPage(FieldIX) and that returns 0.

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: 23 Apr 19 at 10:32PM
What form fields you or the phantom are creating?
Acro or XFA?
For XFA QuickPDF offers only a small subset of functionalities.
A visible XFA field needs internally always two fields and not one - there could be the reason for your issue.
About the problem acro and xfa there is a kb-article on the Debenu pages.

Cheers,
Ingo

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: 23 Apr 19 at 10:34PM
This isn't the solution for your issue but it will give you an idea about the probs using acro and xfa...

https://www.debenu.com/kb/can-debenu-quick-pdf-library-print-pdf-forms-use-xfa-form-fields/

Cheers,
Ingo

Back to Top
waynefulcher View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 Jun 08
Location: United States
Status: Offline
Points: 99
Post Options Post Options   Thanks (0) Thanks(0)   Quote waynefulcher Quote  Post ReplyReply Direct Link To This Post Posted: 24 Apr 19 at 2:02PM
apparently the only fields in the pdf are the Acro fields:

when I call pdf.GetXFAFormFieldCount() I get back 0
when I call pdf.FormFieldCount I get back 66.

So to simplify the issue is simply why when I call:
pdf.GetFormFieldPage(FieldIX) do I get back a 0?

FieldIX is the incrementer in the following for loop:
    for FieldIX := 1 to pdf.FormFieldCount do begin




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: 24 Apr 19 at 5:54PM
Hi Wayne,

now i've understand ;-)
For my routines it's the same.
Perhaps with checkboxes it's the same but i know it from radio buttons.
Normal form fields have the index on the field itself - form fields with options have the index one level below (please think on my sample with "sex" and "male"/"female").
I think there is functionality as well in the library... the functions with "...kid..." or "...sub..." in the name could be worth a try.
I've helped myself while going through all form fields that a missing form field page number would be filled with the page number from the form field before or after.

Cheers,
Ingo

Back to Top
waynefulcher View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 Jun 08
Location: United States
Status: Offline
Points: 99
Post Options Post Options   Thanks (0) Thanks(0)   Quote waynefulcher Quote  Post ReplyReply Direct Link To This Post Posted: 24 Apr 19 at 8:48PM
ahhhh, sub-fields and kid-fields.... Thanks for the pointer...

Let me research everything I can about that and hopefully I can figure it out and how I should implement it. Then I will comeback and try to explain how its used, when and why for future developers.


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