@nowhowmartin
We would like to share with you that the ticket has been resolved. We have changed the code snippet as below in order to generate a correct document and we hope it may help you as well:
[Test(Description = "Cross reference table is split into separate subsections")]
public void PDFNET_50579()
{
string inFile = dataDir + "test.pdf";
string outFile = dataDir + "test_out.pdf";
using (var fs = new FileStream(inFile, FileMode.Open))
{
var pdfFile = new byte[fs.Length];
fs.Read(pdfFile, 0, (int)fs.Length);
var convertedPdfA = ConvertPdfFileToPdfA(pdfFile);
using (var fsConverted = new FileStream(outFile, FileMode.Create))
{
fsConverted.Write(convertedPdfA, 0, convertedPdfA.Length);
}
}
}
public static byte[] ConvertPdfFileToPdfA(byte[] pdfFile)
{
if (pdfFile == null)
{
throw new ArgumentNullException(nameof(pdfFile));
}
using (MemoryStream stream = new MemoryStream(pdfFile))
{
var document = new Aspose.Pdf.Document(stream);
//Der Log-Stream wird nicht benötigt.
using (MemoryStream logStream = new MemoryStream())
{
//konvertieren
document.Convert(logStream, Aspose.Pdf.PdfFormat.PDF_A_3A, Aspose.Pdf.ConvertErrorAction.Delete);
}
using (MemoryStream pdfStream = new MemoryStream())
{
document.IsXrefGapsAllowed = false;
document.Save(pdfStream);
return pdfStream.ToArray();
}
}
}
Main difference is the use of the property: IsXrefGapsAllowed = false, before saving. Please note that when the document is converted, the signatures would be broken which is expected behavior.