Use PdfCopyFields.
Paulo
-----Original Message-----
From: kpgraci [mailto:[email protected]]
Sent: Wednesday, September 08, 2010 4:34 PM
To: [email protected]
Subject: [iText-questions] Acro Fields not copied to duplicate pages
I am merging several PDF files that each have acrofields on them. It works
when the PDFs are unique, that is, none of the pdfs are the same. If,
however, I try to merge two of the same pdf files the form fields only
appear on the last copy of the page.
So if I have a pdf file and I merge it to itself the acrofields will appear
on page 2 only and not on page 1 and 2 like they should. Page 1 is copied
but without the fields.
How can I fix that? I want the aerofields to appear on each page as in the
original documents. I assume then when data is entered on one it will
appear on the other...this may be the problem...I don;t know if that is
legal in a pdf file, having 2 of the same acrofield. In that case, I would
like to rename the fields so they can appear on both forms and not be linked
together - In fact, that's probably the best thing anyway.
So... 2 questions:
Q1: How to make the identical fields appear on each page of the merged copy
Q2: How to change the names of the fields during the merge so they are now
unique.
I can see uses for both of theses situations.
Thanks!
Here is the asp.vb code (not mine) I am using to combine multiple forms with
acrofields:
Like I said, it workks great if anyonw needs it, but does not create
duplicate acrofileds as desired.
Public Shared Function CombineMultiplePDFs(ByVal filenames() As String)
As Byte()
Dim doc As Document = Nothing
Dim writer As PdfCopy = Nothing
Dim myStream As New System.IO.MemoryStream()
For f As Int16 = 0 To filenames.Length - 1
If File.Exists(filenames(f)) Then
Dim reader As PdfReader = New PdfReader(filenames(f))
reader.ConsolidateNamedDestinations()
Dim n As Integer = reader.NumberOfPages
If f = 0 Then
doc = New Document(reader.GetPageSizeWithRotation(1))
writer = New PdfCopy(doc, myStream)
doc.Open()
End If
For i As Int16 = 1 To n
If writer IsNot Nothing Then
Dim page As PdfImportedPage =
writer.GetImportedPage(reader, i)
writer.AddPage(page)
End If
Next
Dim form As PRAcroForm = reader.AcroForm
If form IsNot Nothing And writer IsNot Nothing Then
writer.CopyAcroForm(reader)
End If
Else
'error: file not found!
End If
Next f
If doc IsNot Nothing Then
doc.Close()
End If
Return myStream.ToArray
End Function
--
View this message in context:
http://itext-general.2136553.n4.nabble.com/Acro-Fields-not-copied-to-duplicate-pages-tp2531514p2531514.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:
Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
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/
Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter
informação confidencial ou legalmente protegida. A incorrecta transmissão desta
mensagem não significa a perca de confidencialidade. Se esta mensagem for
recebida por engano, por favor envie-a de volta para o remetente e apague-a do
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de
usar, revelar ou distribuir qualquer parte desta mensagem.
Disclaimer:
This message is destined exclusively to the intended receiver. It may contain
confidential or legally protected information. The incorrect transmission of
this message does not mean the loss of its confidentiality. If this message is
received by mistake, please send it back to the sender and delete it from your
system immediately. It is forbidden to any person who is not the intended
receiver to use, distribute or copy any part of this message.
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:
Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
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/