Welcome Guest Search | Active Topics | Sign In | Register

PDF Fields with children Options
Chris Sidney
Posted: Wednesday, March 28, 2012 11:43:44 AM
Rank: Newbie
Groups: Member

Joined: 3/28/2012
Posts: 5
I have created a form-fill PDF document that I need to populate programatically (and then save) with bank account details collected online

Some fields need to be shown with digits in individual boxes so I have created an accountno field that has 8 children.

I can see these in the page object model and can update the values in my code, but when I save the document the fields are not populated. All the fields without children have the correct value.

Can somone tell me the correct way of updating pdffield children values?

I have tried several way of doing this using standard coding methods. This is a sample.

For pos As Integer = 0 To Value.Length - 1

Dim Child As EO.Pdf.PdfField = Field.Children(pos)

Child.Value = Value.Substring(pos, 1)
Field.Children(pos) = Child

Next

eo_support
Posted: Wednesday, March 28, 2012 11:58:16 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

The following line is not necessary:

Field.Children(pos) = Child

The rest of your code looks correct, so we are not sure why it doesn't work for you. You can check whether you have the latest build first (DLL version number 3.0.120.2). If you already have the latest version, then it might be a bug. In that case please try to create a small test project demonstrating the problem and send the test project to us. Let us know when you have that and we will PM you as to where to send it.

Thanks!
Chris Sidney
Posted: Wednesday, March 28, 2012 12:04:27 PM
Rank: Newbie
Groups: Member

Joined: 3/28/2012
Posts: 5

Thanks for the quick response,

I have 3.0.79.2 (downloaded a few months ago).

I'll get the latest version and try it again. Then I'll send you some code and the form if it's still a problem.

Thanks
Chris Sidney
Posted: Wednesday, March 28, 2012 2:59:33 PM
Rank: Newbie
Groups: Member

Joined: 3/28/2012
Posts: 5
Having populated my PDF form with bank account details, can I then save this as a "flat" PDF without form-fill info?

If I save the form as it is and then open in Adobe Reader (in a web page) the user cannot save the file, but can make changes and print. I don't want this to be possible.

Is using form-fill the best way to achieve this?

There is an obscure save option in Acrobat that will allow the form to be saveable in adobe reader but I really want all the form-fill fields removed and just be left with the data that was added.

Thanks.

eo_support
Posted: Wednesday, March 28, 2012 3:16:37 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

You can not flat out the form with EO.Pdf.

Thanks
Chris Sidney
Posted: Thursday, March 29, 2012 4:15:32 AM
Rank: Newbie
Groups: Member

Joined: 3/28/2012
Posts: 5
That's a shame. A flatten option would be REALLY useful.

I'm looking at using iTextSharp.PDFStamper object to achieve this but haven't managed to get it working yet.
Chris Sidney
Posted: Thursday, March 29, 2012 5:29:14 AM
Rank: Newbie
Groups: Member

Joined: 3/28/2012
Posts: 5
The good news is that upgrading to the latest version of the .dll resolved the problem with the children fields.

This is my solution for flattening the file using iTextSharp.

I would loved to have been able to pass the file from eo to the pdfReader in a memory stream by the PdfReader complains that the Header is invalid.

Load pdf and make changes then ...

eoDoc.Save(TempPath)

'flatten the file using itextsharp.pdfstamper
Dim fs As New System.IO.FileStream(DocumentPath, FileMode.Create)

Dim reader As New iTextSharp.text.pdf.PdfReader(TempPath)
Dim stamper As New iTextSharp.text.pdf.PdfStamper(reader, fs)

stamper.FormFlattening = True
stamper.Close()
reader.Close()


This is the code that didn't work to pass the document in a memory stream (just in case anyone has any ideas)

Dim ms As New System.IO.MemoryStream
eoDoc.Save(ms)
Dim reader As New iTextSharp.text.pdf.PdfReader(ms)


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.