PDF Xpress™ supports creating, reading, and modifying general information about a PDF document, called Metadata. Metadata is stored in the document information dictionary and can include information such as the document's author, title, and keywords.
To read Metadata for an open PDF document, access the DocumentMetadata of the document and do one of the following:
- Read specific property values such as Author, Title, CreationDate, ModificationDate, Subject, Creator or Producer.
- Invoke GetItemProperty to obtain the value of a specific entry.
To add or modify Metadata for an open PDF document, access the DocumentMetadata of the document and do one of the following:
- Modify specific property values such as Author, Title, Subject, Creator or Producer.
- Invoke SetItemProperty to alter the value of a specific entry.
PDF Xpress does not permit direct modification of CreationDate or ModDate Metadata. |
Create Document Metadata
C# Example | Copy Code |
---|---|
// This code demonstrates how to create document Metadata Accusoft.PdfXpressSdk.PdfXpress pdfXpress1 = null; Accusoft.PdfXpressSdk.Document document = null; Accusoft.PdfXpressSdk.DocumentMetadata data = null; try { pdfXpress1 = new PdfXpress(); pdfXpress1.Initialize(); document = new Document(pdfXpress1, "C:\ mynewfile.pdf"); data = document.DocumentMetadata; data. SetItemProperty ( "Author", "New Author"); data.SetItemProperty("CreationDate","031508"); data.SetItemProperty("Creator", "NewCreator"); data.SetItemProperty("ModificationDate","031608"); } catch (System.Exception ex) { } finally { if ( null != data) data.Dispose( ); if ( null != document ) document.Dispose( ); if ( null != pdfXpress1 ) pdfXpress1.Dispose( ); } |
Modify Document Metadata
C# Example | Copy Code |
---|---|
// This code demonstrates how to modify document Metadata Accusoft.PdfXpressSdk.PdfXpress pdfXpress1 = null; Accusoft.PdfXpressSdk.Document document =null; Accusoft.PdfXpressSdk. DocumentMetadata data = null; try { pdfXpress1 = new PdfXpress(); pdfXpress1.Initialize(); document = new Document(pdfXpress1, "C:\ mynewfile.pdf"); data = document.DocumentMetadata; data. Author = "New Author"; } catch (System.Exception ex) { } finally { if ( null ! = data)data.Dispose(); if ( null != document ) document.Dispose( ); if ( null != pdfXpress1 ) pdfXpress1.Dispose( ); } |