Mark,

 

Thanks for the response.  Not sure if you saw the attached that explains
that my error was the result of an itext bug.

 

Regards

 

From: Mark Storer [mailto:[email protected]] 
Sent: Monday, April 12, 2010 11:57 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] Error using pdfsmartcopy

 

Do you have an actual stack trace from the exception?

 

--Mark Storer

  Senior Software Engineer

  Cardiff.com

 

import legalese.Disclaimer;

Disclaimer<Cardiff> DisCard = null;

 

________________________________

From: John Polley [mailto:[email protected]] 
Sent: Friday, April 09, 2010 11:07 AM
To: [email protected]
Subject: [iText-questions] Error using pdfsmartcopy

 

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!

No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.801 / Virus Database: 271.1.1/2786 - Release Date: 04/08/10
23:32:00

--- Begin Message ---
That's a porting bug introduced with the generics. It's fixed in the SVN.
 
Paulo

        ----- Original Message ----- 
        From: John Polley <mailto:[email protected]>  
        To: [email protected] 
        Sent: Friday, April 09, 2010 7:07 PM
        Subject: [iText-questions] Error using pdfsmartcopy


        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/

--- End Message ---
------------------------------------------------------------------------------
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