RC4128Security.EncryptMetadata Property

Gets or sets if the document metadata to be encrypted. Valid only when UseCryptFilter property is true.

public bool EncryptMetadata { get; set; }
Public Property EncryptMetadata As Boolean

Property Value

Boolean

Licensing Info

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Examples

This example shows how to encrypt a document using RC4 128 bit encryption excluding metadata.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Imports ceTe.DynamicPDF.Cryptography
Imports ceTe.DynamicPDF.Xmp
     
Module MyModule
     		
    Sub Main()
     
        'Create a PDF Document
        Dim document As Document = New Document

        'Create a Page and add it to the document
        Dim page As Page = New Page
        document.Pages.Add(page)

        'Create a RC4 128 bit security object
        Dim security As RC4128Security = New RC4128Security("owner", "user")

        ' Set UseCryptFilter property to true
        security.UseCryptFilter = True

        ' Set EncryptMetadata property to false
        security.EncryptMetadata = False

        ' Add the security object to the document
        document.Security = security

        'Create and display a label as a reference
        Dim text As String = "This document has been encrypted with RC4 128 bit encryption."
        page.Elements.Add(New Label(text, 50, 50, 400, 100, Font.Helvetica, 18))

        'Create an Xmp Metadata
        Dim xmp As XmpMetadata = New XmpMetadata

        'Dublin Core Schema.
        Dim dc As DublinCoreSchema = xmp.DublinCore
        dc.Contributors.Add("Abc")
        dc.Contributors.Add("Xyz")
        dc.Contributors.Add("Pqrs")
        dc.Coverage = "To test all the attributes of schema's provided"
        dc.Creators.Add("MyProduct")
        dc.Creators.Add("MyCompany")
        dc.Date.Add(DateTime.Now)
        dc.Description.AddLang("en-us", "XMP Schema's test")
        dc.Identifier = "First XMP pdf"
        dc.Publisher.Add("mydomain.com")
        dc.Publisher.Add("MyCompany")
        dc.Relation.Add("test pdf with xmp")
        dc.Rights.DefaultText = "US English"
        dc.Rights.AddLang("en-us", "All rights reserved 2012, MyCompany.")
        dc.Source = "XMP Project"
        dc.Subject.Add("eXtensible Metadata Platform")
        dc.Title.AddLang("en-us", "XMP")
        dc.Title.AddLang("it-it", "XMP - Piattaforma Estendible di Metadata")
        dc.Title.AddLang("du-du", "De hallo Wereld")
        dc.Title.AddLang("fr-fr", "XMP - Une Platforme Extensible pour les M?t?donn?es")
        dc.Title.AddLang("DE-DE", "???? Hallo Welt")
        dc.Type.Add("Pdf file containing xmp metadata")

        'Basic Schema.
        Dim bs As BasicSchema = xmp.BasicSchema
        bs.Advisory.Add("Date")
        bs.Advisory.Add("Contributors")
        bs.Nickname = "xyz"

        'Rights Management Schema.
        Dim rm As RightsManagementSchema = New RightsManagementSchema
        rm.Marked2 = CopyrightStatus.PublicDomain
        rm.Owner.Add("MyCompany")
        rm.UsageTerms.AddLang("en-us", "Contact MyCompany")
        xmp.AddSchema(rm)

        'Basic Job Ticket Schema.
        Dim job As BasicJobTicketSchema = New BasicJobTicketSchema
        job.JobRef.Add("MyCompany", "Xmp Test", New Uri("http://www.mydomain.com/"))
        job.JobRef.Add("MyCompany", "XMP Metadata", New Uri("http://www.mydomain.com/"))
        xmp.AddSchema(job)

        'Paged-Text Schema.
        Dim pt As PagedTextSchema = New PagedTextSchema
        xmp.AddSchema(pt)

        'Add the Xmp Metadata to the document
        document.XmpMetadata = xmp

        ' Save the PDF
        document.Draw(outputPath)
     
    End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
using ceTe.DynamicPDF.Cryptography;
using ceTe.DynamicPDF.Xmp;

public class Example
{
    public static void CreatePDF(string outputPath)
    {
        // Create a PDF Document
        Document document = new Document();

        // Create a Page and add it to the document
        Page page = new Page();
        document.Pages.Add( page );

        // Create a RC4 128 bit security object
        RC4128Security security = new RC4128Security( "owner", "user" );

        // Set UseCryptFilter property to true
        security.UseCryptFilter = true;

        // Set EncryptMetadata property to false
        security.EncryptMetadata = false;

        // Add the security object to the document
        document.Security = security;

        // Create and display a label as a reference
        string text = "This document has been encrypted with RC4 128 bit encryption.";
        page.Elements.Add( new Label( text, 50, 50, 400, 100, Font.Helvetica, 18 ) );

        // Create an Xmp Metadata
        XmpMetadata xmp = new XmpMetadata();

        // Dublin Core Schema.
        DublinCoreSchema dc = xmp.DublinCore;
        dc.Contributors.Add( "Abc" );
        dc.Contributors.Add( "Xyz" );
        dc.Contributors.Add( "Pqrs" );
        dc.Coverage = "To test all the attributes of schema's provided";
        dc.Creators.Add( "MyProduct" );
        dc.Creators.Add( "MyCompany" );
        dc.Date.Add( DateTime.Now );
        dc.Description.AddLang( "en-us", "XMP Schema's test" );
        dc.Identifier = "First XMP pdf";
        dc.Publisher.Add( "mydomain.com" );
        dc.Publisher.Add( "MyCompany" );
        dc.Relation.Add( "test pdf with xmp" );
        dc.Rights.DefaultText = "US English";
        dc.Rights.AddLang( "en-us", "All rights reserved 2012, MyCompany." );
        dc.Source = "XMP Project";
        dc.Subject.Add( "eXtensible Metadata Platform" );
        dc.Title.AddLang( "en-us", "XMP" );
        dc.Title.AddLang( "it-it", "XMP - Piattaforma Estendible di Metadata" );
        dc.Title.AddLang( "du-du", "De hallo Wereld" );
        dc.Title.AddLang( "fr-fr", "XMP - Une Platforme Extensible pour les Métédonnées" );
        dc.Title.AddLang( "DE-DE", "ÄËßÜ Hallo Welt" );
        dc.Type.Add( "Pdf file containing xmp metadata" );
		
        // Basic Schema.
        BasicSchema bs = xmp.BasicSchema;
        bs.Advisory.Add( "Date" );
        bs.Advisory.Add( "Contributors" );
        bs.Nickname = "xyz";
		
        // Rights Management Schema.
        RightsManagementSchema rm = new RightsManagementSchema();
        rm.Marked2 = CopyrightStatus.PublicDomain;
        rm.Owner.Add( "MyCompany" );
        rm.UsageTerms.AddLang( "en-us", "Contact MyCompany" );
        xmp.AddSchema( rm );
		
        // Basic Job Ticket Schema.
        BasicJobTicketSchema job = new BasicJobTicketSchema();
        job.JobRef.Add( "MyCompany", "Xmp Test", new Uri( "http://www.mydomain.com/" ) );
        job.JobRef.Add( "MyCompany", "XMP Metadata", new Uri( "http://www.mydomain.com/" ) );
        xmp.AddSchema( job );

        // Paged-Text Schema.
        PagedTextSchema pt = new PagedTextSchema();
        xmp.AddSchema(pt);           

        // Add the Xmp Metadata to the document
        document.XmpMetadata = xmp;

        // Save the PDF
        document.Draw( outputPath );
    }
}

See Also

RC4128Security
ceTe.DynamicPDF.Cryptography

In this topic