ModDate Property

Hi,


It seems that when i call Document.Save, the ModDate property is changed (to the current date & time).

Is it possible to prevent this from happening?

Thanks,
Vadim

Hi Vadim,


Thanks for your inquiry. I am afraid we cannot modify ModDate, it is by design.

Please feel free to contact us for any further assistance.

Best Regards,

By who’s design?


When i use Save(stream) or Save(filename), it works fine - i set the ModDate and CreationDate programatically to UTC+3 (current time, or any other time), and it works just fine.

This apparently was fixed: Change PDF CreationDate and ModDate

When i use Save() it (Aspose) modifies it to a UTC datetime - i set both ModDate and CreationDate (like for the above), and Aspose modify ModDate to the current UTC datettime. It does not change CreationDate.


Hi Vadim,


Thanks for your feedback. My apologies I mixed the CreationDate and ModDate with Producer field. you may keep ModDate of document using DocumentInfo class as following. Hopefully it will help you to accomplish the task

Document doc = new
Document(myDir+“HelloWorld.pdf”);

DocumentInfo docinfo = new DocumentInfo(doc);

DateTime moddate = docinfo.ModDate;

doc.Pages[1].Rotate = Rotation.on90;

docinfo.ModDate = moddate;

//docinfo.CreationDate = DateTime.Today.AddDays(-1);

doc.Save(myDir+"output_datechange.pdf");

Please feel free to contact us for any further assistance.


Best Regards,

As i said, in my comment above, this:

using (Document doc = new Document("HelloWorld.pdf"))
{

DocumentInfo docinfo = new DocumentInfo(doc);

docinfo.ModDate = DateTime.Now.AddDays(-1);

doc.Save();

}


doesn't work.


I must use the Save() to save the PDF inplace, with an incremental update.

vadimkuras:
As i said, in my comment above, this:

using (Document doc = new Document(“HelloWorld.pdf”))
{

DocumentInfo docinfo = new DocumentInfo(doc);

docinfo.ModDate = <o:p></o:p>DateTime.Now.AddDays(-1);

doc.Save();

}


doesn’t work.


I must use the Save() to save the PDF inplace, with an incremental update.

Hi Vadim,

I have tested the scenario using above stated code and I am afraid I am getting A first chance exception of type ‘System.ArgumentException’ at System.IO.BinaryWriter…ctor(Stream output, Encoding encoding, Boolean leaveOpen). However when using following code snippet, I am able to see the Modify Date is being set to current date time and it is correct behavior. The API adds current system date/time stamp over which the document is modified.

[C#]

using (FileStream stream = new FileStream(“c:/pdftest/test
(1).pdf”
, FileMode.OpenOrCreate))<o:p></o:p>

{

var doc = new Document(stream);

DocumentInfo docinfo = new DocumentInfo(doc);

docinfo.ModDate = DateTime.Now.AddDays(-1);

doc.Save();

}

Hi Vadim,

vadimkuras:
As i said, in my comment above, this:

using (Document doc = new Document("HelloWorld.pdf"))
{

DocumentInfo docinfo = new DocumentInfo(doc);

docinfo.ModDate = DateTime.Now.AddDays(-1);

doc.Save();

}


doesn't work.


I must use the Save() to save the PDF inplace, with an incremental update.


Thanks for your feedback. Your suggested code throws exception. However if we pass document as stream for incremental save exception does not occurs. But ModDate is not updated, we have logged an investigation ticket as PDFNEWNET-37430 for further investigation and resolution. We will keep you updated about the issue resolution progress.

We are sorry for the inconvenience caused.

Best Regards,
-

The issues you have found earlier (filed as PDFNEWNET-37430) have been fixed in Aspose.Pdf for .NET 9.8.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.