"The creation date ... cannot be written in the document. Please specify the date in the correct format" error in FineReader Engine 12

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 formatD: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

 

Was this article helpful?

4 out of 8 found this helpful

Have more questions? Submit a request

Comments

4 comments

  • Avatar

    Prabhakar Manne

    Hi can you give a sample code to detect problem and fix them same which is stated above

    0
  • Avatar

    Prabhakar Manne

    And when i convert the pdf exporting parameters like below I am not getting any WriteCreateDate method

     

    For few of the documents I am getting error while exporting to pdf like invalid creation date. how can I avoid that, and what should be my code snippet for exporting as a pdf with standard?

    similarly will it cause for modification date as well?

     

    0
  • Avatar

    Alexei Siuzeu

    Prabhakar Manne, try this

     pdfParams.PDFFeatures.MetaDataWritingParams.WriteCreationDate = WriteDateEnum.WD_No;
    -1
  • Avatar

    Gary Waddell

    I think you meant:

    pdfParams.getPDFFeatures().getMetaDataWritingParams().

    but there is no setter for 

    setWriteCreationDate

    Any more input as to why this happens?  We are experiencing the same problem.

    0

Please sign in to leave a comment.