VintaSoft Imaging .NET SDK 12.4: Documentation for .NET developer
Vintasoft.Imaging.Codecs.ImageFiles.Png Namespace / PngPage Class / SetTextualInformation(Dictionary<String,String>) Method
Syntax Example Requirements SeeAlso
In This Topic
    SetTextualInformation(Dictionary<String,String>) Method (PngPage)
    In This Topic
    Sets a textual information of this page.
    Syntax

    Parameters

    information
    The new textual information
    Example

    Here is an example that shows how to change the creation date of PNG file:

    
    ''' <summary>
    ''' Sets the creation time of PNG file.
    ''' </summary>
    ''' <param name="filename">The filename.</param>
    ''' <param name="creationDate">The creation date of file.</param>
    Public Shared Sub SetCreationTime(filename As String, creationDate As System.DateTime)
        ' open PNG file
        Using pngFile As New Vintasoft.Imaging.Codecs.ImageFiles.Png.PngFile(filename)
            Dim page As Vintasoft.Imaging.Codecs.ImageFiles.Png.PngPage = pngFile.Page
    
            ' get the textual information of image
            Dim textualInformation As System.Collections.Generic.Dictionary(Of String, String) = page.GetTextualInformation()
    
            ' add the creation date to the textual information
            textualInformation("Creation Time") = creationDate.ToString("yyyy:MM:dd hh:mm:ss", System.Globalization.CultureInfo.InvariantCulture)
            ' set textual information of image
            page.SetTextualInformation(textualInformation)
    
            ' save changes in PNG file
            pngFile.SaveChanges()
        End Using
    End Sub
    
    
    
    /// <summary>
    /// Sets the creation time of PNG file.
    /// </summary>
    /// <param name="filename">The filename.</param>
    /// <param name="creationDate">The creation date of file.</param>
    public static void SetCreationTime(string filename, System.DateTime creationDate)
    {
        // open PNG file
        using (Vintasoft.Imaging.Codecs.ImageFiles.Png.PngFile pngFile = 
            new Vintasoft.Imaging.Codecs.ImageFiles.Png.PngFile(filename))
        {
            Vintasoft.Imaging.Codecs.ImageFiles.Png.PngPage page = pngFile.Page;
    
            // get the textual information of image
            System.Collections.Generic.Dictionary<string, string> textualInformation = page.GetTextualInformation();
            
            // add the creation date to the textual information
            textualInformation["Creation Time"] = creationDate.ToString("yyyy:MM:dd hh:mm:ss", 
                System.Globalization.CultureInfo.InvariantCulture);
            // set textual information of image
            page.SetTextualInformation(textualInformation);
    
            // save changes in PNG file
            pngFile.SaveChanges();
        }
    }
    
    

    Requirements

    Target Platforms: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    See Also