I changed my merge to PDFCopy and it did retain the stamp.
Unfortunately I use the previously referenced code to place page numbers
on the files before merging them. When I created the page number code
that wasn't possible with PDFCopy. So I am still faced with the stamp
falling off if I want to add a page number.
Dim memoryStream As New System.IO.MemoryStream
Dim strCurrentDocumetID As String
Dim intTotalCount As Integer = 0
Dim f As Integer = 0
Dim reader As New PdfReader(New
RandomAccessFileOrArray(sourceFiles(f).ToArray), Nothing)
Dim n As Integer = reader.NumberOfPages
Dim document As New
document(reader.GetPageSizeWithRotation(1))
Dim writer As PdfWriter = PdfWriter.GetInstance(document,
memoryStream)
document.Open()
Dim cb As PdfContentByte = writer.DirectContent
Dim page As PdfImportedPage
Dim rotation As Integer
helv = pdf.BaseFont.CreateFont(pdf.BaseFont.HELVETICA,
"ASCII", False)
While f < sourceFiles.Length
Dim i As Integer = 0
While i < n
If strCurrentDocumetID <>
strArrayOfDocumetIDNumbers(f) Then
intTotalCount = 0
strCurrentDocumetID =
strArrayOfDocumetIDNumbers(f)
End If
i += 1
document.SetPageSize(reader.GetPageSizeWithRotation(i))
document.NewPage()
page = writer.GetImportedPage(reader, i)
rotation = reader.GetPageRotation(i)
'Page # Logic
'=====================================================================
'' compose the footer
Dim [text] As [String] = "Page " + (intTotalCount +
1).ToString + " of " + n
intTotalCount += 1
Dim textSize As Single = helv.GetWidthPoint([text],
10)
Dim textBase As Single = cb.PdfDocument.Bottom() -
25
cb.BeginText()
cb.SetFontAndSize(helv, 10)
cb.SetTextMatrix(cb.PdfDocument.Right() - 30,
textBase)
cb.ShowText([text])
cb.EndText()
'=====================================================================
If rotation = 90 Or 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
End While
writer.FreeReader(reader)
f += 1
If f < sourceFiles.Length Then
If sourceFiles(f) Is Nothing Then Exit While
reader = New PdfReader(New
RandomAccessFileOrArray(sourceFiles(f).ToArray), Nothing)
n = reader.NumberOfPages
End If
If f < sourceFiles.Length Then sourceFiles(f).Close()
End While
document.Close()
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
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