I use these lines of code in my VSTO C# AddIn to export the current document as PDF/A.
//Create path for PDF
String pathPDF = DocumentHandler.Document.FullName;
pathPDF = System.IO.Path.ChangeExtension(pathPDF, ".pdf");
if (System.IO.File.Exists(pathPDF))
{
System.IO.File.Delete(pathPDF);
}
//Save as PDF (ISO19005_1 -> PDF/A-1)
DocumentHandler.Document.ExportAsFixedFormat(OutputFileName: pathPDF, ExportFormat: WdExportFormat.wdExportFormatPDF, UseISO19005_1: true, OptimizeFor: WdExportOptimizeFor.wdExportOptimizeForOnScreen);
log.Info($"PDF successfully exported to {pathPDF}");
Most of the time this works but in some cases since a few weeks “ExportAsFixedFormat” fails with this exception:
System.Runtime.InteropServices.COMException (0x80004005): c. Das Dokument konnte nicht für den Export vorbereitet werden.
//(in English this would be roughly: The document could not be prepared for export.)
What could be the cause?
(these errors happen in MS365, Word Version 2406 (Build 17726.20160 Click-to-run), in a virtual environment and with a lot of antivirus running)
we have noticed that this error has also been occurring recently when saving the document:
System.Runtime.InteropServices.COMException (0x800A14CA): Unzureichender Arbeitsspeicher oder nicht genügend Speicherplatz. Die gewünschte Schriftart kann von Word nicht angezeigt werden.
//(in English this would be roughly: Insufficient memory or not enough storage space. Word cannot display the desired font.)
we suspect that the second error is related to Aptos as the new standard font, but this is just a guess…
many thanks in advance, help would be greatly appreciated!
Leon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1