PDF Rendering and Form Fields
Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1148
Printed Date: 13 Nov 24 at 6:45AM Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com
Topic: PDF Rendering and Form Fields
Posted By: Jack
Subject: PDF Rendering and Form Fields
Date Posted: 14 Jul 09 at 5:54PM
In my application, I use the QuickPDF library to fill in the fields on government forms. Unfortunately, when I tried RenderPageToStream to copy the form to an image and view the filled in form, the fields are not included. So I tried using this code to flatten the fields and check the results:
for iField := 1 to FQP.FormFieldCount do begin iSuccess := FQP.FlattenFormField(iField); end; FQP.SaveToFile('C:\Documents and Settings\Jack\Desktop\Test Output 2.pdf'); FQP.RenderPageToStream(iDPI, iPage, iOptions, FMS);
Only some of the fields get flattened and those that do get flattened are the ones that show up. I suspect that some of the fields might be "child" fields but I never got my head around why people use those or how to deal with them.
So, I have two questions. First is whether it might be possible for the library to support form fields in the rendering functions and second is failing the first, do you have any ideas how I might get all the fields to flatten so they will show up in my viewer.
Any help is very much appreciated.
Jack
|
Replies:
Posted By: Jack
Date Posted: 14 Jul 09 at 6:27PM
Just a quick update. None of the fields are child fields. Of the first half-dozen or so fields, the first, fourth, fifth and eighth fields were flattened, while, the second, third, sixth and seventh were not. The overall appearance of the form and the flattened fields in the preview is very good. Flattening the fields would seem to work just fine for my purposes.
|
Posted By: Ingo
Date Posted: 15 Jul 09 at 6:13AM
Hi Jack!
It would be helpful to see your pdf form but ... It's possible to set form field properties like "not printable" or "not visible"... Perhaps this is the answer to your questions?
ffc := QP.FormFieldCount; if ( ffc < 1 ) Then Exit;
// . . .
for i := 1 to ffc do begin
// . . .
ffname := QP.GetFormFieldTitle(i); ffprt := IntToStr(QP.GetFormFieldPrintable(i)); ffvis := IntToStr(QP.GetFormFieldVisible(i));
// . . .
Cheers, Ingo
|
Posted By: Jack
Date Posted: 15 Jul 09 at 8:45PM
Thanks for your input, Ingo. Following your suggestion, I started testing to see if I could isolate the problem. It is taking a while. I will get back with results.
Jack
|
Posted By: Jack
Date Posted: 16 Jul 09 at 1:39AM
Ingo, I followed up on your suggestion. I continued to get only partial flattening of the fields and I could see no difference between the fields that got flattened and those that did not. Then, it dawned on me that there WAS a pattern to the way the fields were getting flattened and that was that every other field got flattened. So, when a field gets flattened, it is no longer a field and the fields above that field move down one and if you increment your pointer, you will skip every other field.
I changed my loop to a downto loop and the problem was solved.
Thanks for your help.
|
Posted By: Michel_K17
Date Posted: 16 Jul 09 at 4:21AM
Hi,
You are not the first one to experience this. Congratulations on figuring it out. You are absolutely write: flattening a field reduces the field count by one.
Cheers!
Michel
------------- Michel
|
Posted By: Ingo
Date Posted: 16 Jul 09 at 6:17AM
Hi!
So it's the best to get the FormFieldCount first in a separate variable and then doing the flattenloop with these variable...
@Jack: It looks like you can be a help for others here very soon ;-)
Cheers, Ingo
|
|