i'm using a method to merge pdf document , i dont find a method to generate
a good number of pages on footer, i explain : when i merge pdf files, in my
doc i have original page number and not a good numerotation (from 1 to n
but i have many 1)

sorry for my english, i m frensh man !

''' <summary>Concaténer les FDT pdf générées</summary>
Public Shared Sub Merge(ByVal ListeFichiers As String)
Try
Dim Fichiers() As String
Fichiers = ListeFichiers.Split(CChar(","))

Dim f As Integer = 1
'-- on crée un reader pour le 1er document
Dim reader As New PdfReader(Fichiers(f))
Dim n As Integer = reader.NumberOfPages

'--step 1: création d'un document-object
Dim document As New
Document(reader.GetPageSizeWithRotation(1))
'--step 2: on crée un writer qui écoute le document
Dim writer As PdfWriter = PdfWriter.GetInstance(document, New
FileStream(Fichiers(0), FileMode.Create))
'--step 3: on ouvre le document
document.Open()
Dim cb As PdfContentByte = writer.DirectContent
Dim page As PdfImportedPage
Dim rotation As Integer
'--step 4: on ajoute du contenu
While f < Fichiers.Length
Dim i As Integer = 0
While i < n
i += 1

document.SetPageSize(reader.GetPageSizeWithRotation(i))
document.NewPage()
'document.ResetFooter()
page = writer.GetImportedPage(reader, i)
rotation = reader.GetPageRotation(i)
If rotation = 90 OrElse rotation = 270 Then
cb.AddTemplate(page, 0, -1.0F, 1.0F, 0, 0,
reader.GetPageSizeWithRotation(i).Height)
Else
cb.AddTemplate(page, 1.0F, 0, 0, 1.0F, 0, 0)
End If

'--"ajout de la page " & i)
End While
f += 1
If f < Fichiers.Length Then
reader = New PdfReader(Fichiers(f))
n = reader.NumberOfPages
End If
End While
'--step 5: on ferme le document
document.Close()
Catch e As Exception
OnwardMsg.TechErr(e, e.Message)
End Try
End Sub



      
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
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