Accusoft.PdfXpress7.Net
Create & Modify Document Metadata

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:

To add or modify Metadata for an open PDF document, access the DocumentMetadata of the document and do one of the following:

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)
            {
            }
            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)
            {
            }
            finally
            {
                if (null != data)
                {
                    data.Dispose();
                }
                if (null != document)
                {
                    document.Dispose();
                }
                if (null != pdfXpress1)
                {
                    pdfXpress1.Dispose();
                }
            }

 

See Also

 

 


©2018. Accusoft Corporation. All Rights Reserved.

Send Feedback