0

One pdf is generated and I am adding link of website in some text of pdf using aspose and below code,

var link = new Aspose.Pdf.Annotations.LinkAnnotation(document.Pages[t.p], userSignRect)
{
    Action = new Aspose.Pdf.Annotations.GoToURIAction(requestHostAddress.Replace("http://", "https://") + "/document-details/" + documentId)
};

Now I want to append pdf's modified date run time in hyperlink.

Example : https://document-details/documentId/ ModifiedDateofPdfRuntime

Please help me/guide me how to do that.

Edit: I do not want current modified date. Usecase : We have generated pdf and given to user with our basic hyperlink url in pdf.(which is a happy scenario)

But if someone is altering my pdf then i won't know and pdf's url will still route to my website.

To overcome same i want to append PDF's modified date object in url which will fetch pdf info and get date.

something like this, is it possible ?

Shahzad Latif
  • 1,408
  • 12
  • 29

3 Answers3

0

I guess you are looking for something like this

   DateTime creation = File.GetCreationTime(@"C:\test.txt");
   DateTime modification = File.GetLastWriteTime(@"C:\test.txt");

and then you can add checks to check if file is modified or not. code is copied from here.

Aneeq Azam Khan
  • 992
  • 1
  • 10
  • 23
0

This should work.

Action = new Aspose.Pdf.Annotations.GoToURIAction(requestHostAddress
     .Replace("http://", "https://") + "/document-details/" + documentId + "_" + DateTime.Now.ToString())
kame
  • 20,848
  • 33
  • 104
  • 159
0

You need to use ModDate property from PdfFileInfo class:

using Aspose.Pdf.Facades;

//...

var fileInfo = new PdfFileInfo(dataDir + "GetFileInfo.pdf");
var modificationDate = fileInfo.ModDate;

Hope it helps. Otherwise, feel free to ask me.

Note: I am working as Developer Evangelist at Aspose.

  • Thanks, But this will give me current modified date of pdf. What i want is pdf is generated and some has altered pdf or modified it. Now when they will click on pdf URL, it comes on my website. which i do not want. So I want to get current modified pdf date appended in url runtime to check. – Urmi_VV_Developer Jun 19 '19 at 09:01