I’m having trouble getting Date/Time values for Annotations that correspond to values reported by other products (Adobe/Nuance etc). For the First example, check the following test PDF
Now obviously there’s some issue with the time zone, however the the “kind” is Unspecified. I have noticed that for the Document Created/Modified Date there’s a CreationTimeZone and ModTimeZone property which I use for the Created/Modified like so:
To accurately retrieve the date and time values for annotations in a PDF using Aspose.PDF, you need to consider the time zone discrepancies that may arise. While you have successfully managed the document’s creation and modification dates by using the ModTimeZone property, annotations do not provide explicit time zone information.
Here’s a suggested approach to handle the date and time for annotations:
Retrieve the Modified Date: Use the Modified property of the annotation to get the date and time.
Adjust for Time Zone: Since annotations do not have a specific time zone, you can apply the document’s modification time zone to the annotation’s modified date. However, as you’ve noted, this may not yield consistent results across different documents.
Here’s a code snippet that demonstrates how to adjust the annotation’s modified date:
// Assuming 'aspPdfAnnotation' is your annotation object
DateTime annotationModifiedDate = aspPdfAnnotation.Modified;
// Adjust for the document's modification time zone
DateTime adjustedDate = annotationModifiedDate.Subtract(aspPdfDocument.Info.ModTimeZone);
// Output the adjusted date
Console.WriteLine("Adjusted Annotation Modified Date: " + adjustedDate);
If you find that this adjustment varies from document to document, it may be necessary to implement additional logic to handle specific cases or discrepancies. Unfortunately, without explicit time zone information for annotations, achieving a universally accurate result may require some trial and error.
If you continue to experience issues, consider checking the documentation or exploring similar forum posts for additional insights or solutions that other users may have discovered.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): PDFNET-58966
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.