←Select platform

SchemaValues Property

Summary

Gets the schema item values for this embedded file.

Syntax
C#
C++/CLI
Java
Python
public IDictionary<string, string> SchemaValues {get;} 
public java.util.Map<java.lang.String, 
    java.lang.String> getSchemaValues(); 
public:  
   property IDictionary<String^, String^>^ SchemaValues 
   { 
      IDictionary<String^, String^>^ get() 
   } 
SchemaValues # get  (PDFEmbeddedFile) 

Property Value

The schema item values for this embedded file.

Remarks

If the owner is a PDF portfolio, then the PDFDocument.EmbeddedFilesSchemas collection is populated with the schemas to be used with embedded files.

Each PDFEmbeddedFile will then contain the values for these schemas in the SchemaValues dictionary and the following conditions are true:

  1. The number of items in the dictionary equals the number of items in PDFDocument.EmbeddedFilesSchemas.
  2. The SchemaValues dictionary contains an item with the key equal to one of the PDFSchema.Key values in PDFDocument.EmbeddedFilesSchemas.

Using this information, an application program can find the schema for any embedded file and use it to build the UI to view the PDF document as intended.

Refer to PDFDocument.EmbeddedFiles for more information on using PDFSchema with PDF portfolio and embedded files.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Controls; 
using Leadtools.Pdf; 
using Leadtools.Svg; 
using Leadtools.WinForms; 
 
 
public static void ExtractEmbeddedFiles(string inputFileName, string outputDir) 
{ 
   // Load the source document 
   PDFDocument pdfDocument = new PDFDocument(inputFileName); 
   if (!pdfDocument.HasEmbeddedFiles) 
   { 
      Console.WriteLine("PDF does not have embedded files"); 
      // No embedded files 
      pdfDocument.Dispose(); 
      return; 
   } 
 
   // Read the attachments 
   pdfDocument.ParseDocumentStructure(PDFParseDocumentStructureOptions.EmbeddedFiles); 
 
   if (!Directory.Exists(outputDir)) 
      Directory.CreateDirectory(outputDir); 
 
   foreach (PDFEmbeddedFile embeddedFile in pdfDocument.EmbeddedFiles) 
   { 
      // Show this file information 
      Console.WriteLine($"Number:{embeddedFile.FileNumber}"); 
      Console.WriteLine($"  FileName:{embeddedFile.FileName}"); 
      Console.WriteLine($"  FileSize:{embeddedFile.FileSize}"); 
      Console.WriteLine($"  Description:{embeddedFile.Description}"); 
      Console.WriteLine($"  Created:{embeddedFile.Created}"); 
      Console.WriteLine($"  Modified:{embeddedFile.Modified}"); 
 
      // Extract this attachment to the output directory 
      // Note: FileName of an embedded file is not guaranteed to be unique, therefore, we will append 
      // the file number which is unique to the output name 
      string outputFileName = $"{embeddedFile.FileNumber}-{embeddedFile.FileName}"; 
      Console.WriteLine($"  Extracting to {outputFileName}"); 
      outputFileName = Path.Combine(outputDir, outputFileName); 
      PDFFile.ExtractEmbeddedFile(inputFileName, pdfDocument.Password, embeddedFile.FileNumber, outputFileName); 
   } 
 
   pdfDocument.Dispose(); 
} 
Requirements

Target Platforms

Help Version 22.0.2023.7.10
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Pdf Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.