Example T828522
Visible to All Users

PDF Document API - Access and Modify Custom Document Properties

This sample project uses the PdfDocument.CustomProperties property to obtain the collection of document's custom properties. You can add and delete custom properties or change associated names or values.

[!Important]
The Universal Subscription or an additional Office File API Subscription is required to use this example in production code. For pricing information, please refer to the DevExpress Subscription page.

Files to Review

C# Visual Basic
Program.cs Program.vb

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

Example Code

pdf-custom-properties/Program.cs(vb)
C#
using DevExpress.Pdf; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; namespace pdf_custom_properties { class Program { static void Main(string[] args) { using (PdfDocumentProcessor pdfProcessor = new PdfDocumentProcessor()) { pdfProcessor.LoadDocument("PageDeletion.pdf"); ModifyCustomProperties(pdfProcessor.Document); pdfProcessor.SaveDocument("Result.pdf"); Process.Start(new ProcessStartInfo("Result.pdf") { UseShellExecute = true }); } } private static void ModifyCustomProperties(PdfDocument document) { //Add new property document.CustomProperties.Add("NumberOfCopies", "3"); //Modify the CompanyEmail property value: if (document.CustomProperties.ContainsKey("CompanyEmail")) document.CustomProperties["CompanyEmail"] = "clientservices@devexpress.com"; //Remove the HasImages property: document.CustomProperties.Remove("HasImages"); } } }

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.