Symptoms
The "The creation date ... cannot be written in the document. Please specify the date in the correct format." error message appears during the document export.
Cause
The declared error is related to the PDF export, which is expected in case of incorrect dates. In FineReader Engine 12 R3 and newer, the creation and modification dates can be viewed and changed. For that, only the dates in correct format can be written into the documents. In case of the error, the date should be specified in a correct format or the writing mode should be changed (WriteCreationDate property of the DocumentContentInfoWritingParams Object).
The output document must have valid format: D:YYYYMMDDHHmmSSOHH'mm, as specified by the PDF 2.0 standard. Additional information could be found in the FineReader Engine Developer's Help file: Specifications >What's new > Export.
Resolution
This issue could be resolved either by using WD_Current or WD_No options for WriteCreationDate Property of the MetaDataWritingParams Object, or by parsing a document's date to a correct format. You can modify the dates of the input PDF via DocumentContentInfo Object (CreationDate and ModificationDate Properties).
To set the CreationDate of a document to WD_Current please refer to the following code snippet:
FREngine.PDFExportParams pdfParams = engineLoader.Engine.CreatePDFExportParams();
pdfParams.PDFFeatures.MetaDataWritingParams.WriteCreationDate = FREngine.WriteDateEnum.WD_Current;
document.Export( Path.Combine( FreConfig.GetSamplesFolder(), @"SampleImages\Demo.pdf" ),
FREngine.FileExportFormatEnum.FEF_PDF, pdfParams );
C# code snippet
If you want to parse the document's date to a correct format:
string DocumentDate = document.DocumentContentInfo.CreationDate;
...
//DocumentDate modifications
//example of a document date in the correct format: "D:20200730035035Z"
...
document.DocumentContentInfo.CreationDate = DocumentDate ;
C# code snippet