"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

 

Have more questions? Submit a request

Comments

5 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
  • Avatar

    Zheng Wei

    We use Aspose to create a PDF, then get such an Exception during ABBYY OCR.

    In the PDF file created by Aspose, there is such a XMP

    <xmp:CreateDate>2020-10-21T15:02:00Z</xmp:CreateDate>

    And this CreateDate cause this exception.

    We contact with Aspose and show them this page, however Aspose said that it should be a bug of ABBYY.

    Here it is the answer of Aspose Helpdesk

    https://forum.aspose.com/t/pdf-generated-by-aspose-words-doesnt-have-pdf-2-0-standard-datetime-format-and-cause-exception-during-abbyy-ocr/273003/6

    Here is quote from XMP specification:

    Date
    A date-time value which is represented using a subset of ISO RFC 8601 formatting, as described in
    http://www.w3.org/TR/Note-datetime.html. The following formats are supported:
    YYYY
    YYYY-MM
    YYYY-MM-DD
    YYYY-MM-DDThh:mmTZD
    YYYY-MM-DDThh:mm:ssTZD
    YYYY-MM-DDThh:mm:ss.sTZD

    YYYY = four-digit year
    MM = two-digit month (01=January)
    DD = two-digit day of month (01 through 31)
    hh = two digits of hour (00 through 23)
    mm = two digits of minute (00 through 59)
    ss = two digits of second (00 through 59)
    s = one or more digits representing a decimal fraction of a second
    TZD = time zone designator (Z or +hh:mm or -hh:mm)

    The time zone designator is optional in XMP. When not present, the time zone is unknown, and software should not assume anything about the missing time zone.
    It is recommended, when working with local times, that you use a time zone designator of +hh:mm or
    -hh:mm instead of Z, to aid human readability. For example, if you know a file was saved at noon on
    October 23 a timestamp of 2004-10-23T12:00:00-06:00 is more understandable than
    2004-10-23T18:00:00Z.

    Most likely it is bug in ABBYY, since other PDF consumers and validators considers PDF produced by Aspose.Words as valid.

     

    0

Please sign in to leave a comment.

Recently viewed