Update PDF Title and Creation Date

I’m unable to update the PDF Title, Author, or Creation Date for a new PDF using Aspose PDF for .NET 20.12.0. I can set the DocumentInfo properties, and the Document.Info properties but after doing a Document.Save the resulting PDF file and Document.Info properties are blank.

What am I doing wrong?

thanks, Mike

@MikeSchmidt

We tested the scenario in our environment using following code snippet and were unable to notice any issue:

Document doc = new Document();
doc.Pages.Add();
DocumentInfo Info = new DocumentInfo(doc);
Info.Author = "";
Info.Keywords = "";
Info.ModDate = DateTime.Now;
Info.Subject = "";
Info.Title = "Aspose Pty Ltd";
Info.CreationDate = DateTime.Now;
doc.Save(dataDir + "info.pdf");

info.pdf (1.4 KB)

Please try to use above code snippet and let us know if you still face any issue.

Ran the code snippet above (using PowerShell / .NET on Server 2016). Author and Title did not populate.

Blockquote
#Load Aspose PDF for .NET DLL
[System.Reflection.Assembly]::LoadFrom(“E:\Program Files (x86)\Aspose\Aspose.Pdf for .NET\Bin\net4.0\Aspose.PDF.dll”)

#Load Aspose License File
$License = New-Object Aspose.PDF.License
$License.SetLicense(“E:\Scripts\Aspose\Aspose.Pdf.lic”)

$MyDoc = New-Object Aspose.PDF.Document
$MyDoc.Pages.Add()

#Set PDF Info
$DocInfo = New-Object Aspose.PDF.DocumentInfo($MyDoc)
$DocInfo.CreationDate = Get-Date
$DocInfo.ModDate = Get-Date
$DocInfo.Author = “Travel Pay Processing”
$DocInfo.Title = “Just a Test PDF”

#Save PDF
$MyDoc.Save("$($MergeDir)mypdf.pdf")

Blockquote

thanks, Mikemypdf.pdf (1.3 KB)

@MikeSchmidt

While running the scenario in PowerShell script, we were able to notice the issue. We have logged it as PDFNET-49182 in our issue tracking system for further investigation. We will look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

Thanks for looking into this, look forward to a solution! thanks, Mike

1 Like