Я пытаюсь объединить несколько документов PDFA в один файл, используя iTextSharp 5.1.3, используя следующий код:
Try
Dim f As Integer = 0
Dim outFile As String = destinationFile
Dim document As iTextSharp.text.Document = Nothing
Dim writer As PdfSmartCopy = Nothing
While f < sourceFiles.Length
' Create a reader for a certain document
Dim reader As New PdfReader(sourceFiles(f))
' Retrieve the total number of pages
Dim n As Integer = reader.NumberOfPages
If f = 0 Then
document = New iTextSharp.text.Document(reader.GetPageSizeWithRotation(1))
writer = New PdfSmartCopy(document, New FileStream(outFile, FileMode.Create))
document.Open()
End If
Dim page As PdfImportedPage
Dim i As Integer = 0
While i < n
i += 1
page = writer.GetImportedPage(reader, i)
writer.AddPage(page)
End While
Dim form As PRAcroForm = reader.AcroForm
If form IsNot Nothing Then
writer.CopyAcroForm(reader)
End If
f += 1
End While
document.Close()
Catch generatedExceptionName As Exception
End Try
Если я открою любой из входных файлов в Acrobat Reader X, я получу сообщение о том, чточто они действительно являются PDFA, но нет, если я открою выходной файл, который создает приведенный выше код.Поэтому может показаться, что мой недавно созданный составной PDF-документ не соответствует PDFA.
Я попытался установить для свойства writer.PDFXConformance значение PdfWriter.PDFA1A, но это не помогает.
Кто-нибудь знает, возможно ли добиться того, что я пытаюсь сделать?