Hi, sorry for this unspecific Error report, but we have a hard time reproducing it ourselves:
Using this Code to convert a PDF-Document to PDF-A results in the subsequent Exception, but only in high-Load Situations. Maybe you can give us a hint what we should change:
public static byte[] ConvertDocumentToPdfA(Document pdfDocument, PdfFormat pdfFormat, ITrace trace = null)
{
byte[] pdfConversionLogBytes;
bool convert;
using (var pdfConversionLogOutputStream = new MemoryStream())
{
convert = pdfDocument.Convert(pdfConversionLogOutputStream, pdfFormat, ConvertErrorAction.Delete);
pdfConversionLogBytes = pdfConversionLogOutputStream.ToArray();
}
string pdfConversionLog;
using (var ms = new MemoryStream(pdfConversionLogBytes, false))
{
var xElement = XElement.Load(ms);
pdfConversionLog = xElement.ToString();
}
if (!string.IsNullOrEmpty(pdfConversionLog))
{
trace?.Info("Messages from conversion of 'PDF' to '{3}' (Aspose.Pdf.Document.Convert() returned: '{0}'):{1}{2}{1}",
convert, Environment.NewLine, pdfConversionLog, pdfFormat);
}
using (var pdfOutputStream = new MemoryStream())
{
pdfDocument.Save(pdfOutputStream);
return pdfOutputStream.ToArray();
}
}
This is the Exception that happens sometimes when we generate more than 50 Documents:
An exception occured generating pdf-document ‘Key Information Document (PDF)’
Aspose.Pdf.EmptyValueException: ModDate value is empty
at [1] .[1]
()
at .1
at
. [1]( [1],
)
at [1] . [1](Stream [1])
at . [1](Stream [1])
at Aspose.Pdf.Document.Save(Stream output)
at Lpa.DocFramework.AsposeWrapper.PdfUtils.ConvertDocumentToPdfA(Document pdfDocument, PdfFormat pdfFormat, ITrace trace) in AsposeWrapper\PdfUtils.cs:line 60 which is the pdfDocument.Save(pdfOutputStream); Command at the End of our code.
Do you have a tip what we could change to avoid this spurious problem?
Best regards…
Matthias