We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Unable to clear Properties unless ModDate is also cleared

When attempting to clear the properties on PDF files (attached a sample), the cleared value will not commit unless the ModificationDate is also cleared.


fileInfo.Creator = String.Empty;
fileInfo.Author = String.Empty;
fileInfo.Keywords = String.Empty;
fileInfo.Subject = String.Empty;
fileInfo.Title = String.Empty;

//this only works if the ModDate is also cleared
fileInfo.ModDate = String.Empty;

Hi,


Thanks for contacting support.

I have tested the scenario using Aspose.Pdf for .NET 9.0.0 where I have used the following code snippet and I am unable to notice any problem. The MetaData is properly being removed from PDF file.

[C#]

PdfFileInfo fileInfo = new PdfFileInfo();<o:p></o:p>

fileInfo.BindPdf("c:/pdftest/Metadata+Removal+Test.pdf");

fileInfo.Creator = String.Empty;

fileInfo.Author = String.Empty;

fileInfo.Keywords = String.Empty;

fileInfo.Subject = String.Empty;

fileInfo.Title = String.Empty;

//this only works if the ModDate is also cleared

// fileInfo.ModDate = String.Empty;

fileInfo.SaveNewInfo("c:/pdftest/InformationUpdated.pdf");

Sorry–my code example was incorrect. You have to act on a file more than once:


private void clearData2()
{
System.Windows.Forms.DialogResult dlgResult = openFileDialog1.ShowDialog();

for (int i = 1; i < 3; i++)
{

Aspose.Pdf.Facades.PdfFileInfo fileInfo = new Aspose.Pdf.Facades.PdfFileInfo();
fileInfo.BindPdf(openFileDialog1.FileName);
fileInfo.Creator = String.Empty;
fileInfo.Author = String.Empty;
fileInfo.Keywords = String.Empty;
fileInfo.Subject = String.Empty;
fileInfo.Title = String.Empty;

//this only works if the ModDate is also cleared
// fileInfo.ModDate = String.Empty;
string fileName = string.Format(@“C:\temp\output{0}.pdf”, i.ToString());
fileInfo.SaveNewInfo(fileName);
}
}

Hi,


Thanks for sharing the code snippet.

I have tested the scenario and have observed that properties are not being removed on subsequent calls. However the data/information is being removed on first attempt. For the sake of correction, I have logged this problem
as PDFNEWNET-36598 in our issue tracking system. We will further
look into the details of this problem and will keep you updated on the status
of correction. Please be patient and spare us little time. We are sorry for
this inconvenience.

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

For further details, you may check this blog post.


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