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

Free Support Forum - aspose.com

Problem saving PDF with empty CreationDate MetaData

Hi,

I have a problem with PDF created by some HP scanning application. When I convert it to PDF/A and then I try to save it I get this exception:

The added or subtracted value results in an un-representable DateTime.

Parameter name: value at System.DateTime.AddTicks(Int64 value)
at .›•e.a(‹a )
at ..Save(•a , ‹a )
at ‚a.–.Save()
at ‚a.ŸŒ.Save(Stream )
at .›•.Save(Stream )
at Aspose.Pdf.Document.Save(Stream output)
at ConvertToPDFA.PdfToPDFA.ConvertToPDFA(Byte[] Bytes)
at ConvertToPDFA.PdfToPDFA.ConvertToPDFA(String Path)
at AABase.ConvertToPDFA_Aspose.ConvertFileToPDFA(String FileName)

I found out that the PDF has empty CreationDate and CreationDate–Text value in PdfDocument.Info collection and also empty pdf:CreationDate–Text in Metadata collection. I handled it by Removing the (pdf:)CreationDate–Text from both collections and filling the CreationDate with ModDate value. But I don’t think this is the best solution. Could you please check it and try to handle it somehow in the save method?

Thanks pilscom

Hi,


Thanks for using our API’s.

The problem appears to be related to the source/input PDF file which you are using, so we request you to please share your source file, so that we can test the scenario in our environment. We are sorry for this inconvenience.

Here it is. But I am not sure it preserved all the metadata problems described before. As I removed pages with customer data from it. Though still raises the exception without correcting the metadata.

Hi,


Thanks for contacting support.

I have tested the scenario of PDF to PDF/A_1b conversion using latest release of Aspose.Pdf for .NET 11.0.0 and I am unable to notice any issue. For your reference, I have also attached the resultant file generated over my end.

[C#]

Document doc = new
Document(@“C:\pdftest\CreationDate2.pdf”);<o:p></o:p>

doc.Convert(@"C:\pdftest\CreationDate2.txt", PdfFormat.PDF_A_1B, ConvertErrorAction.Delete);

doc.Save(@“C:\pdftest\CreationDate2_PDF-A1b.pdf”);