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 - PDF form with possible to save the user data
  FAQ FAQ  Forum Search   Register Register  Login Login

PDF form with possible to save the user data

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


Joined: 17 Oct 09
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote tukutt Quote  Post ReplyReply Direct Link To This Post Topic: PDF form with possible to save the user data
    Posted: 17 Oct 09 at 5:02PM
Hello everybody,

Actually, I am searching a tool to generate some pdf file. I am interesting in your tool because it works nice with PHP.

I search an exemple to generate a PDF file like this file. This file contains some fields and it's possible to save the user data directly in the file. It's exactly what I want !

Before I buy your QuickPDF, I want to verify that it's possible to generate this type of file with your tool.

Thank all.


Edited by tukutt - 17 Oct 09 at 5:03PM
Back to Top
Shotgun Tom View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 Aug 09
Location: Phoenix, AZ
Status: Offline
Points: 53
Post Options Post Options   Thanks (0) Thanks(0)   Quote Shotgun Tom Quote  Post ReplyReply Direct Link To This Post Posted: 18 Oct 09 at 1:26AM
The short answer to your question is "Yes".  I developed a program for a law firm that populates IRS tax forms (they use several dozen) using data from their database.  Then, depending upon the circumstances, the data is either flattened (made unchangeable) or left as editable.  Works great with QuickPDF library.
Back to Top
tukutt View Drop Down
Beginner
Beginner


Joined: 17 Oct 09
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote tukutt Quote  Post ReplyReply Direct Link To This Post Posted: 18 Oct 09 at 9:50AM
Can you post here some sample code ?

Thanks
Back to Top
Shotgun Tom View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 Aug 09
Location: Phoenix, AZ
Status: Offline
Points: 53
Post Options Post Options   Thanks (0) Thanks(0)   Quote Shotgun Tom Quote  Post ReplyReply Direct Link To This Post Posted: 18 Oct 09 at 6:39PM

This is not a trivial task where I can just post a single snippet of code.  What I can tell you is the process and then you'll have to apply it to the programming language and data source you are using.

In the case of the law firm, they use IRS estate PDF tax forms.  There can be a single form or a dozen or more forms that need to be completed and then merged into a single PDF file.
 
1.  In this case all data to be filled in is stored in an Access Database.  I don't know where you are getting the user data from so you'll need to create code to store the user data in variables you pass to QuickPDF.  Each field on the form has a name, so you simply need to match the data to the appropriate field.  Here's a VB6 snippet:
 
     For i = 1 To FieldCount
    
      If ActiveFormField = QP.GetFormFieldTitle(i) Then
       ret = QP.SetFormFieldValue(i, ActiveFormFill)
       QP.UpdateAppearanceStream i
       DoEvents
      End If
         
     Next
 
FieldCount is simply a variable that holds the number of fields in a form.
ActiveFormField is the name of the field that is to be filled
ActiveFormFill is the data that is to be written.
 
This code loops through all the fields in a form, if the ActiveFormField has data then it is written to the PDF.  This loop is for a single form.  If you are combining multiple forms you'll need to loop through each form and save them as a temporary file. 
 
When you've created each form then you need to merge them into a single PDF file.  I do this by creating a file list array that holds the names of each temporary PDF created.  Then when all forms have been completed you merge them:
 
ret = QP.MergeFileList(FileListName, OutPDFFileName)
 
If you want to flatten the fields and data (make them uneditable) then you would need code similar to this:
 
Private Sub FlattenFields()
 
 If QP.LoadFromFile(OutPDFFileName) = 1 Then
 
    Dim ProgCount As Integer
    ProgressBar1.Value = 0
    
     'How many fields to fill?
   
   Dim FieldIndex As Integer
   FieldCount = QP.FormFieldCount()
   ProgressBar1.Max = FieldCount
     Msg = Msg & "Fields to Flatten:" & Str(FieldCount) & "... " & Time & vbCrLf
     txtLogFile.Text = Msg
    
     For i = FieldCount To 1 Step -1
    
      QP.FlattenFormField i
      ProgCount = ProgCount + 1
      ProgressBar1.Value = ProgCount
      DoEvents
     
     Next
    
     If QP.SaveToFile(OutPDFFileName) = 1 Then
      'do nothing
     Else
       MsgBox "Error, file could not be written. - " & OutPDFFileName & vbCrLf
       Msg = Msg & "Field Flattening Failed!" & Time & vbCrLf
       txtLogFile.Text = Msg
     End If
    
       Msg = Msg & "Field Flattening OK: " & Time & vbCrLf
       txtLogFile.Text = Msg
  
   Else
       Msg = Msg & "Could not open merged file!" & Now & vbCrLf
       txtLogFile.Text = txtLogFile.Text & Msg
       MsgBox "Error, merged file not loaded.", vbCritical, "Flattening Error!"
   End If
    
End Sub
 
Like I said, not a trivial task.  I hope this at least points you in the right direction.
 
Back to Top
tukutt View Drop Down
Beginner
Beginner


Joined: 17 Oct 09
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote tukutt Quote  Post ReplyReply Direct Link To This Post Posted: 29 Oct 09 at 2:38PM
Hello,

Thank for your answer.

I'm desesperating because I can do a form (see sample code) but I don't find any function in QuickPdf to activate the mode in acrobat reader to save the date into the pdf. Have you an idea ?

// Set the paper size
$qp->SetPageSize('A4');

// Set the origin to the top-left corner
$qp->SetOrigin(1);

// Set the measurement units to millimetres
$qp->SetMeasurementUnits(1);

// Add the heading font
$qp->AddStandardFont(5);   // Helvetica bold
$qp->SetTextSize(10);
$qp->DrawText(10, 28, 'Name:');
$qp->DrawText(10, 48, 'Surname:');

// Add the font to use for the form fields
$FontID = $qp->AddStandardFont(0);   // Courier

$FieldIndex = $qp->NewFormField('Name', 1);
$qp->SetFormFieldBounds($FieldIndex, 10, 30, 50, 10);
$qp->SetNeedAppearances(0);
$qp->AddFormFont($FontID);
$qp->SetFormFieldFont($FieldIndex, $qp->GetFormFontCount);
$qp->SetFormFieldTextSize($FieldIndex, 12);
$qp->SetFormFieldBorderColor($FieldIndex, 0.5, 0, 0);
$qp->SetFormFieldBorderStyle($FieldIndex, 1, 0, 0, 0);
$qp->SetFormFieldBackgroundColor($FieldIndex, 0.8, 0.8, 0.5);
$qp->SetFormFieldValue($FieldIndex, edtName.Text);

$FieldIndex = $qp->NewFormField('Surname', 1);
$qp->SetFormFieldBounds($FieldIndex, 10, 50, 50, 10);
$qp->SetFormFieldFont($FieldIndex, $qp->GetFormFontCount);
$qp->SetFormFieldTextSize($FieldIndex, 12);
$qp->SetFormFieldBorderColor($FieldIndex, 0.5, 0, 0);
$qp->SetFormFieldBorderStyle($FieldIndex, 1, 0, 0, 0);
$qp->SetFormFieldBackgroundColor($FieldIndex, 0.8, 0.8, 0.5);
$qp->SetFormFieldValue($FieldIndex, edtSurname.Text);

$perm = $qp->EncodePermissions(1, 1, 1, 1, 1, 1, 1, 1);

$result = $qp->SaveToFile($fileName);
Back to Top
Shotgun Tom View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 Aug 09
Location: Phoenix, AZ
Status: Offline
Points: 53
Post Options Post Options   Thanks (0) Thanks(0)   Quote Shotgun Tom Quote  Post ReplyReply Direct Link To This Post Posted: 29 Oct 09 at 3:08PM
Hi:
 
Unfortunately, to save form field data in Adobe Reader the PDF Form has to be flagged with Extended User Rights.  These are called Live Cycle Reader Extensions (RE).  This can only be accomplished by setting those rights in Acrobat Pro (versions 8 or 9 I believe).  Even using Acrobat, Adobe's EULA only allows 500 instances of a form.
 
Adobe has made Reader Extensions proprietary for one reason.  Money.  Applying these extensions may only be done in Acrobat.
 
There are alternatives.  Other free PDF viewers such as FoxIt, PDF-XChange viewer, etc. allows the user to save the PDF form data.  Also, you can create your own form field saving routines using QuickPDF.
 
The biggest problem is that Reader is so ubiquitous it creates a problem for a PDF Form application that is developed for the general populus.  If you have control over who is entering the data then your answer is to have them use something other than Adobe Reader.
 
Tom
 
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: 29 Oct 09 at 3:19PM
Hi!

Like Tom told already ...
It's the money-machine for Adobe ;-)
Take Foxit ...
The problem is:
If you've filled out formfields and saved the form with Foxit
the Adobe Reader will tell you that the form isn't in the
original condition anymore - so if you're using Foxit for the form
you can't change later 'cause the internal adobe protection is
broken.

Cheers, Ingo
Back to Top
jpschubbs View Drop Down
Beginner
Beginner


Joined: 02 Nov 09
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpschubbs Quote  Post ReplyReply Direct Link To This Post Posted: 02 Nov 09 at 4:31AM
Hi Tom,
I'm new to the forum, and only registered when I saw your comment about building a program to merge data from a database to pdf forms.  I own a financial company, and have been looking for exactly that.  We use Filemaker Pro and have about 5-10 pdf forms to merge for each client.  I'd like to have something that allows me to merge either directly from the database or to import the database file.

Is that something your current program would do?  If not, would you be interested in doing it for us?  I'm not very familiar with forums, so if I've broken some rule by asking for services, I'm sorry.

thanks,
Jordan
Back to Top
Shotgun Tom View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 Aug 09
Location: Phoenix, AZ
Status: Offline
Points: 53
Post Options Post Options   Thanks (0) Thanks(0)   Quote Shotgun Tom Quote  Post ReplyReply Direct Link To This Post Posted: 02 Nov 09 at 2:26PM
Hi Jordan:
 
Yes, I believe the program essentially matches your needs.  I may need to make some minor modifications depending upon your requirements.
 
I would like to discuss this further with you and get some samples of the data and PDF forms involved.
 
The best thing is to do this directly and not on the Forum.  Please email me your contact information and the best time to contact you and we can discuss this further.  Email me at tmoran4511@hotmail.com
 
Thanks, Jordan!
 
Tom
Back to Top
DELBEKE View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert
Avatar

Joined: 31 Oct 05
Location: France
Status: Offline
Points: 151
Post Options Post Options   Thanks (0) Thanks(0)   Quote DELBEKE Quote  Post ReplyReply Direct Link To This Post Posted: 04 Nov 09 at 5:00PM
Hi Tom
If you don't like spam, avoid giving your email in a clear way. Thumbs Up
 
Back to Top
dsola View Drop Down
Team Player
Team Player


Joined: 28 Oct 05
Location: Croatia
Status: Offline
Points: 34
Post Options Post Options   Thanks (0) Thanks(0)   Quote dsola Quote  Post ReplyReply Direct Link To This Post Posted: 10 Nov 09 at 2:40PM
Hi
In company where I work we had the similar problem.
Our wish was to enable user to fill pdf form, on save to extract data from form and save data in DB.
We couldn't use local webserver because this vailots Adobe EULA.
So we render image of  PDF form, create form with that image, and create controls for text input....
Regular user won't notice difference and our app has full control.

It's win32 app so I don't know if You can use this idea in php.

D.
registered QuickPDF user
Back to Top
tukutt View Drop Down
Beginner
Beginner


Joined: 17 Oct 09
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote tukutt Quote  Post ReplyReply Direct Link To This Post Posted: 11 Nov 09 at 2:26PM
Finally, we choose QuickPDF to create and read data information and Adobe Pro to enable the advance function for adobe reader. We haven't a lot of form to create but our file contains over 300 questions.
Now, I am searching to insert a table in my pdf.

Thanks to all.
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