Hello,
Recently I started to use Aspose library instead Pdf2PdfAPI for converting PADES (signed pdf) to PDFA. Actually, I know, that it is no way to correct converting signatures to pdfA, so before it was used like pdf as it is was converted to pdfA, and original pades (signed pdf) was attached as ordinary attachment (see source.pdf). In library Pdf2PdfAPI it was converted without any problems (see output_correct.pdf). Unfortunately, via Aspose I am able to attach original attachment and convert to PDFA, but as result I see converted to pdfA file only, but without attachments (output_incorrect.pdf). And file is much bigger as when it was converted by Pdf2PdfAPI.
Below is my step-by-step for PDFA producing from PADES. Could you please provide me how I can achive the same result as in output_correct.pdf, which was created by Pdf2PdfAPI.
PdfFileSignature pdfSign = new PdfFileSignature();
// Open PDF document
pdfSign.BindPdf(streamInput);
// Get list of signature names
var names = pdfSign.GetSignNames();
// Remove all the signatures from the PDF file
for (int index = 0; index < names.Count; index++)
{
pdfSign.RemoveSignature((string)names[index]);
}
// Save updated PDF file
pdfSign.Save(stream);
var memoryStream = new MemoryStream();
memoryStream.Write(content, 0, content.Length);
memoryStream.Position = 0L;
FileSpecification fspec = new FileSpecification(memoryStream, originalName);
pdfDocument.EmbeddedFiles.Add(fspec);
if (pdfDocument.Convert(msLogOutput, pdfFormatEnum, ConvertErrorAction.Delete))
{
using (var outputStream = new MemoryStream())
{
pdfDocument.Save(outputStream);
outputStream.Position = 0;
result.Content = outputStream.ToArray();
result.Success = true;
}
}
Thank you,
Denis.
output_incorrect.pdf (381.1 KB)
output_correct.pdf (106.3 KB)
source.pdf (305.9 KB)