I am attempting to convert a PDF document to an accessible/tagging format, but upon calling what I believe is the recommended code and then saving the PDF document it unfortunately cannot be tagged. Below is the code that is being used to load the PDF document from disk into a PDF object and then convert it to the desired format and then save it out to a stream.
// Load the converted PDF into an Aspose PDF Document
Aspose.Pdf.Document pdfDoc2 = new Aspose.Pdf.Document(conversionFilePath + “.pdf”);
var pdfVersion = GetPdfOutputVersion(tenantConfig.PdfVersion.Trim()); // Returns Aspose.Pdf.PdfFormat.Tagged_PDF as the format
// Create dummy log file for the conversion file
string formatConversionLog = conversionFilePath + “.log”;
File.Create(formatConversionLog).Dispose();
// Convert the loaded PDF to the specified type
pdfDoc2.Convert(formatConversionLog, pdfVersion, Aspose.Pdf.ConvertErrorAction.Delete);
// Save the PDF document to the output stream
pdfDoc2.Save(pdfOutStream);
When the converted PDF is saved to the stream or back to disk it says that it has been locked since it is associated with a format that can be tagged, but when the tagging test is performed in Adobe Preflight it fails.
Are there any steps I might be missing in the conversion or saving process to get tagging working and Preflight to pass?