翻譯|行業(yè)資訊|編輯:胡濤|2024-06-24 10:57:39.827|閱讀 79 次
概述:在 Spire.PDF 3.6.135 及以上版本中,我們添加了一個新功能,可以從 XML 文檔中讀取、設(shè)置和加載現(xiàn)有的 XMP 數(shù)據(jù)。本文介紹如何在創(chuàng)建 PDF 文檔時設(shè)置 XMP 元數(shù)據(jù)。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
XMP 是一種文件標(biāo)簽技術(shù),可讓您在內(nèi)容創(chuàng)建過程中將元數(shù)據(jù)嵌入文件本身。借助支持 XMP 的應(yīng)用程序,您的工作組可以以團(tuán)隊以及軟件應(yīng)用程序、硬件設(shè)備甚至文件格式易于理解的格式捕獲有關(guān)項目的有意義的信息(例如標(biāo)題和說明、可搜索的關(guān)鍵字以及最新的作者和版權(quán)信息)。
Spire.PDF for .NET 是一款獨立 PDF 控件,用于 .NET 程序中創(chuàng)建、編輯和操作 PDF 文檔。使用 Spire.PDF 類庫,開發(fā)人員可以新建一個 PDF 文檔或者對現(xiàn)有的 PDF 文檔進(jìn)行處理,且無需安裝 Adobe Acrobat。
E-iceblue 功能類庫Spire 系列文檔處理組件均由中國本土團(tuán)隊研發(fā),不依賴第三方軟件,不受其他國家的技術(shù)或法律法規(guī)限制,同時適配國產(chǎn)操作系統(tǒng)如中科方德、中標(biāo)麒麟等,兼容國產(chǎn)文檔處理軟件 WPS(如 .wps/.et/.dps 等格式
Spire.PDF for.net下載 Spire.PDF for java下載
在 Spire.PDF 3.6.135 及以上版本中,我們添加了一個新功能,可以從 XML 文檔中讀取、設(shè)置和加載現(xiàn)有的 XMP 數(shù)據(jù)。本文介紹如何在創(chuàng)建 PDF 文檔時設(shè)置 XMP 元數(shù)據(jù)。
代碼片段:
步驟 1:初始化 PdfDocument 類的新實例。
PdfDocument doc = new PdfDocument();
第 2 步:從 PDF 文檔獲取 XMP 元數(shù)據(jù)。
XmpMetadata meta = doc.XmpMetaData;
步驟3:將作者、創(chuàng)作數(shù)據(jù)、創(chuàng)建者、關(guān)鍵詞等設(shè)置為元數(shù)據(jù)。
meta.SetAuthor("E-iceblue"); meta.SetCreateDate(DateTime.Now); meta.SetCreator("Spire.PDF"); meta.SetCustomProperty("Field", "NewValue"); meta.SetKeywords("XMP"); meta.SetProducer("E-icenlue Co,.Ltd"); meta.SetSubject("XMP Metadata"); meta.SetTitle("Set XMP Metadata in PDF");
步驟 4:保存文件。
doc.SaveToFile("XMP.pdf", FileFormat.PDF);
輸出:
要查看 PDF 文檔中的元數(shù)據(jù),請使用 Acrobat 或 Acrobat Reader 打開它,然后在文件菜單中選擇“文檔屬性”。
完整代碼:
[C#]
using Spire.Pdf; using Spire.Pdf.Xmp; using System; namespace SetXMPMetadata { class Program { static void Main(string[] args) { PdfDocument doc = new PdfDocument(); XmpMetadata meta = doc.XmpMetaData; meta.SetAuthor("E-iceblue"); meta.SetCreateDate(DateTime.Now); meta.SetCreator("Spire.PDF"); meta.SetCustomProperty("Field", "NewValue"); meta.SetKeywords("XMP"); meta.SetProducer("E-icenlue Co,.Ltd"); meta.SetSubject("XMP Metadata"); meta.SetTitle("Set XMP Metadata in PDF"); doc.SaveToFile("XMP.pdf", FileFormat.PDF); } } }
[VB.NET]
Imports Spire.Pdf Imports Spire.Pdf.Xmp Namespace SetXMPMetadata Class Program Private Shared Sub Main(args As String()) Dim doc As New PdfDocument() Dim meta As XmpMetadata = doc.XmpMetaData meta.SetAuthor("E-iceblue") meta.SetCreateDate(DateTime.Now) meta.SetCreator("Spire.PDF") meta.SetCustomProperty("Field", "NewValue") meta.SetKeywords("XMP") meta.SetProducer("E-icenlue Co,.Ltd") meta.SetSubject("XMP Metadata") meta.SetTitle("Set XMP Metadata in PDF") doc.SaveToFile("XMP.pdf", FileFormat.PDF) End Sub End Class End Namespace
歡迎下載|體驗更多E-iceblue產(chǎn)品
獲取更多信息請咨詢 ;技術(shù)交流Q群(767755948)
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn