Hello,
We are not merging existing PDF documents, we are scanning documents with a scanner. Then, we do this:
for each .... 'bucle to add pages to ceteDocument
Dim arrayBytes As Byte()
Dim ms As New MemoryStream
'this line save the document into the ms memorystream
ltCodecs.Save(ImageList.Image, ms, RasterImageFormat.CcittGroup4, 1, 1, 1, 1, CodecsSavePageMode.Overwrite)
arrayBytes = ms.ToArray
CType(ms, IDisposable).Dispose()
Dim cetePagina As Page = ImageData.GetImage(arrayBytes).GetPage
ceteDocumentoPDF.Pages.Add(cetePagina)
next
After this, we add XMP metadata and sign the document:
ceteDocumentoPDF.XmpMetadata = ceteMetadatosXmp
ceteDocumentoPDF.Sign(oConfiguracion.ConCertificadodig, oCerFirma, True)
And then we save the document:
Try ceteDocumentoPDF.Draw(Path.Combine(sRutaImagenes, sNombreImagen))
Catch ex As Exception
End Try
This is mostly our code. Its important to know that the error does not always occurs with the same document.
Thanks very much,
Pablo L.G.