Aspose 11.0.0: Error in CreationDate property

There seems to be an error in Aspose v. 11.0.0.


DocumentInfo.CreationDate property always returns an exception “CreationDate value is empty” when trying to set the property. The exception appears even when inspecting the property before we try to set it. Se picture below (This does not happen to ModifiedDate property).

This happens at least when pressing button Ready for Approval in Travel invoice – both for the main travel invoice pdf, but also for the travel invoice attachment (originally a png).

By googling the problem I found this link, but no solution.

For the time being I comment out line 207.


Hi Bjornar,


Thanks for contacting support.

I have tested the scenario using following code snippet and I am unable to notice any issue. Can you please share your source file and the code snippet, so that we can again try replicating the issue in our environment. We are sorry for this inconvenience.

[C#]

Aspose.Pdf.Document
doc = new Aspose.Pdf.Document();<o:p></o:p>

doc.Pages.Add();

DocumentInfo docinfo = new DocumentInfo(doc);

docinfo.CreationDate = DateTime.Now;

// doc.Optimize();

doc.Save(“c:/pdftest/InfoUpdated.pdf”);

Hi again,

Just tried the same with ASpose 11.2.0. Still an issue.

Here is the sample code to reproduce this error in C#:

var pdf = new Aspose.Pdf.Generator.Pdf();

//Instantiate License class and call its SetLicense method to use the license


var license = new Aspose.Pdf.License();


license.SetLicense(“Binaries\Aspose.Pdf.lic”);

//Add a section into the pdf document


var section = pdf.Sections.Add();

//Add a text paragraph into the section


section.Paragraphs.Add(new Aspose.Pdf.Generator.Text(“Hello World”));


var file = txtDirectory.Text + @“TestingAspose.Pdf”;

pdf.Save(file);

var doc = new Document(file);


var di = new DocumentInfo(doc);


di.ModDate = DateTime.Now;

di.CreationDate = DateTime.Now; // EmptyValueException is thrown



Hi Bjornar,


Thanks for sharing the details.

When using above stated code snippet, I have managed to reproduce the same issue. However as you are using both legacy Aspose.Pdf.Generator and new DOM approach, so we recommend using only new DOM approach of Aspose.Pdf namespace and during my testing with following code snippet, I am unable to notice any issue.

[C#]

var doc = new Document();<o:p></o:p>

doc.Pages.Add();

Aspose.Pdf.Text.TextFragment fragment = new TextFragment("Hello World...");

doc.Pages[1].Paragraphs.Add(fragment);

var di = new DocumentInfo(doc);

di.ModDate = DateTime.Now;

di.CreationDate = DateTime.Now; // no more exception

doc.Save(“c:/pdftest/CreateDateIssue.pdf”);