文檔首頁>>Aspose.PDF使用教程>>Aspose.Pdf使用教程:設(shè)置PDF文件信息
Aspose.Pdf使用教程:設(shè)置PDF文件信息
Aspose.Pdf允許你設(shè)置PDF文件的特定信息,比如作者、創(chuàng)建日期、主題和標(biāo)題等。進(jìn)行著些信息設(shè)置,您需要?jiǎng)?chuàng)建一個(gè)DocumentInfo對(duì)象并單獨(dú)設(shè)置這些屬性的值。一旦這些屬性值完成設(shè)置,你就僅僅需要使用文檔對(duì)象的save方法保存更新后的文檔。
下面是使用Aspose.Pdf設(shè)置PDF文件信息的示例代碼
C#
//open document Document pdfDocument = new Document("input.pdf"); //specify document information DocumentInfo docInfo = new DocumentInfo(pdfDocument); docInfo.Author ="Aspose"; docInfo.CreationDate =DateTime.Now; docInfo.Keywords ="Aspose.Pdf, DOM, API"; docInfo.ModDate =DateTime.Now; docInfo.Subject ="PDF Information"; docInfo.Title ="Setting PDF Document Information"; //save output document pdfDocument.Save("output.pdf");
VB.NET
'open document Dim pdfDocument As New Document("input.pdf") 'specify document information Dim docInfo As New DocumentInfo(pdfDocument) docInfo.Author = "Aspose" docInfo.CreationDate = DateTime.Now docInfo.Keywords = "Aspose.Pdf, DOM, API" docInfo.ModDate = DateTime.Now docInfo.Subject = "PDF Information" docInfo.Title = "Setting PDF Document Information" 'save output document pdfDocument.Save("output.pdf")