That's the direction but just worry for now about the actual formatting, 
getting the js is trivial.

Paulo
  ----- Original Message ----- 
  From: John Polley 
  To: Post all your questions about iText here 
  Sent: Saturday, April 10, 2010 3:45 PM
  Subject: Re: [iText-questions] Error using pdfsmartcopy


  Paulo,

   

  Much thanks!!! After checking out the updates using tortoise I was able to 
build a new release version of itextsharp and the error has disappeared. Now I 
need to try and resolve my issue with the text field formatting.

   

  Could you please confirm that this is the direction in which I should be 
heading:

   

  Getting the script isn’t all that hard:

   

  1) Get the field’s dictionary

  2) From that, get the Action dictionary (PdfName.AA)

  3) From THAT, get the formatting action (which has always been a JS action up 
to this point), from the PdfName.F key.

  4) Get the script from the JS action.

   

  The script can be stored as a PdfString or a PdfStream, either way it’ll be 
under the PdfName.JS key.

   

  I just whipped up a number-formatted field in Acrobat 9.x and the script 
looks like this:

  AFNumber_Format(2, 0, 1, 0, "\u0024", true);

   

  I suspect your best bet will be to parse out the parameters, whip up your own 
equivalent functions (in java/c#) and get your results that way.  I didn’t find 
anything containing the string AFNumber_Format in the Acrobat folder, leading 
me to believe they’re embedded as munged resources or not JS at all, but native 
functions exposed to their JS environment.

   

  Thanks!

   

  From: Paulo Soares [mailto:[email protected]] 
  Sent: Saturday, April 10, 2010 9:02 AM
  To: Post all your questions about iText here
  Subject: Re: [iText-questions] Error using pdfsmartcopy

   

  See http://sourceforge.net/scm/?type=svn&group_id=72954. The easiest way is 
to download tortoise svn (http://tortoisesvn.net/downloads) and checkout the 
repository at 
https://itextsharp.svn.sourceforge.net/svnroot/itextsharp/trunk/src/core.

   

  Paulo

    ----- Original Message ----- 

    From: John Polley 

    To: Post all your questions about iText here 

    Sent: Saturday, April 10, 2010 1:47 PM

    Subject: Re: [iText-questions] Error using pdfsmartcopy

     

    Paulo,

     

    I apologize but, I do not know what you mean by SVN or how/if I can get the 
fix.

     

    Thanks!

     

    From: Paulo Soares [mailto:[email protected]] 
    Sent: Saturday, April 10, 2010 8:43 AM
    To: Post all your questions about iText here
    Subject: Re: [iText-questions] Error using pdfsmartcopy

     

    That's a porting bug introduced with the generics. It's fixed in the SVN.

     

    Paulo

      ----- Original Message ----- 

      From: John Polley 

      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/

Reply via email to