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!
![]() |
PDF form with possible to save the user data |
Post Reply ![]() |
Author | |
tukutt ![]() Beginner ![]() Joined: 17 Oct 09 Status: Offline Points: 4 |
![]() ![]() ![]() ![]() ![]() 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 |
|
![]() |
|
Shotgun Tom ![]() Senior Member ![]() ![]() Joined: 14 Aug 09 Location: Phoenix, AZ Status: Offline Points: 53 |
![]() ![]() ![]() ![]() ![]() |
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.
|
|
![]() |
|
tukutt ![]() Beginner ![]() Joined: 17 Oct 09 Status: Offline Points: 4 |
![]() ![]() ![]() ![]() ![]() |
Can you post here some sample code ?
Thanks |
|
![]() |
|
Shotgun Tom ![]() Senior Member ![]() ![]() Joined: 14 Aug 09 Location: Phoenix, AZ Status: Offline Points: 53 |
![]() ![]() ![]() ![]() ![]() |
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.
|
|
![]() |
|
tukutt ![]() Beginner ![]() Joined: 17 Oct 09 Status: Offline Points: 4 |
![]() ![]() ![]() ![]() ![]() |
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); |
|
![]() |
|
Shotgun Tom ![]() Senior Member ![]() ![]() Joined: 14 Aug 09 Location: Phoenix, AZ Status: Offline Points: 53 |
![]() ![]() ![]() ![]() ![]() |
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
|
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
jpschubbs ![]() Beginner ![]() Joined: 02 Nov 09 Status: Offline Points: 1 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
Shotgun Tom ![]() Senior Member ![]() ![]() Joined: 14 Aug 09 Location: Phoenix, AZ Status: Offline Points: 53 |
![]() ![]() ![]() ![]() ![]() |
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
|
|
![]() |
|
DELBEKE ![]() Debenu Quick PDF Library Expert ![]() ![]() Joined: 31 Oct 05 Location: France Status: Offline Points: 151 |
![]() ![]() ![]() ![]() ![]() |
Hi Tom
If you don't like spam, avoid giving your email in a clear way.
![]() |
|
![]() |
|
dsola ![]() Team Player ![]() Joined: 28 Oct 05 Location: Croatia Status: Offline Points: 34 |
![]() ![]() ![]() ![]() ![]() |
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
|
|
![]() |
|
tukutt ![]() Beginner ![]() Joined: 17 Oct 09 Status: Offline Points: 4 |
![]() ![]() ![]() ![]() ![]() |
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. |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store