After going the examples in section 6 of IText in Action (v.2) I have
written a routine to create multiple copies of a single pdf  form. The
following code snippet :

 

Do While reader2.Read

                        Dim reader As New PdfReader(filename)

                        Dim baos As New System.IO.MemoryStream()

                        Dim stamper As New PdfStamper(reader, baos)

                        Dim acroFields As AcroFields =
stamper.AcroFields

                        Dim i As Integer = 1

                        Do While (i <= num3)

                            If IsDBNull(reader2.GetValue(i)) Then

                                fieldvalue = ""

                            Else

                                fieldvalue = reader2.GetValue(i)

                            End If

                            acroFields.SetField(reader2.GetName(i),
Conversions.ToString(fieldvalue))

                            i += 1

                        Loop

                        stamper.FormFlattening = True

                        stamper.Close()

                        Dim newreader As New PdfReader(baos.ToArray)

                        copy.AddPage(copy.GetImportedPage(newreader, 1))

                        pagecount += 1

                        MsgBox(pagecount)

                    Loop

 

Produces an error - 'the given key was not present in the dictionary' -
when the copy.AddPage(copy.GetImportedPage(newreader, 1)) line is
executed.

 

I'd really appreciate if someone could shed some light on what might be
causing this error.

 

Thanks!

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to