←Select platform

Load(string) Method

Summary
Loads this BarcodeOptions from the specified XML file.
Syntax
C#
C++/CLI
Python
public void Load( 
   string fileName 
) 
public: 
void Load(  
   String^ fileName 
)  
def Load(self,fileName): 

Parameters

fileName
The XML file containing the data.

Remarks

The load/save methods are provided as helper methods for the user. The BarcodeEngine, BarcodeWriter and BarcodeWriter do not use these methods internally.

To save a BarcodeWriteOptions to an XML file, use BarcodeWriteOptions.Save(string fileName).

To save and load data to an XML stream, use BarcodeWriteOptions.Save(Stream stream) and BarcodeWriteOptions.Load(Stream stream).

Example
C#
Java
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Barcode; 
using Leadtools.ImageProcessing; 
 
 
public void BarcodeWriteOptions_LoadSaveExample() 
{ 
   string xmlFileName = Path.Combine(LEAD_VARS.ImagesDir, "MyOptions.xml"); 
 
   // Create the options 
   OneDBarcodeWriteOptions options1 = new OneDBarcodeWriteOptions(); 
   // Show its values 
   ShowOptions("Default 1", options1); 
 
   // Change some of the values 
   options1.UseXModule = true; 
   options1.EnableErrorCheck = true; 
   options1.TextPosition = BarcodeOutputTextPosition.None; 
   ShowOptions("New Options 1", options1); 
 
   // Save it to disk 
   options1.Save(xmlFileName); 
 
   // Create new options 
   OneDBarcodeWriteOptions options2 = new OneDBarcodeWriteOptions(); 
   // Show its values 
   ShowOptions("Default 2", options2); 
 
   // Load the previously saved options 
   options2.Load(xmlFileName); 
   // Show its values, should be the same as "New Options 1" 
   ShowOptions("Loaded 2", options2); 
} 
 
private static void ShowOptions(string message, OneDBarcodeWriteOptions options) 
{ 
   // We will only show some of the options in this example 
   Console.WriteLine(message); 
   Console.WriteLine("  UseXModule: {0}", options.UseXModule); 
   Console.WriteLine("  EnableErrorCheck: {0}", options.EnableErrorCheck); 
   Console.WriteLine("  TextPosition: {0}", options.TextPosition); 
   Console.WriteLine("----------------"); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
 
import java.io.Console; 
import java.io.File; 
import java.io.IOException; 
import java.nio.file.Path; 
import java.time.LocalDateTime; 
 
import org.apache.lucene.store.Directory; 
import org.junit.*; 
import org.junit.runner.JUnitCore; 
import org.junit.runner.Result; 
import org.junit.runner.notification.Failure; 
import static org.junit.Assert.*; 
 
import leadtools.*; 
import leadtools.barcode.*; 
import leadtools.codecs.*; 
 
 
// // public void barcodeWriteOptionsSaveExample() { 
// String LEAD_VARS_ImagesDir = "C:\\LEADTOOLS23\\Resources\\Images"; 
// String xmlFileName = combine(LEAD_VARS_ImagesDir, "MyOptions.xml"); 
 
// // Create the options 
// OneDBarcodeWriteOptions options1 = new OneDBarcodeWriteOptions(); 
 
// // Show its values 
// ShowOptions("Default 1", options1); 
 
// // Change some of the values 
// options1.setUseXModule(true); 
// options1.setEnableErrorCheck(true); 
// options1.setTextPosition(BarcodeOutputTextPosition.NONE); 
// ShowOptions("New Options 1", options1); 
 
// // Save it to disk 
// options1.save(xmlFileName); 
 
// // Create new options 
// OneDBarcodeWriteOptions options2 = new OneDBarcodeWriteOptions(); 
// // Show its values 
// ShowOptions("Default 2", options2); 
 
// // Load the previously saved options 
// options2.load(xmlFileName); 
// // Show its values, should be the same as "New Options 1" 
// ShowOptions("Loaded 2", options2); 
// } 
 
// private static void ShowOptions(String message, OneDBarcodeWriteOptions 
// options) { 
// // We will only show some of the options in this example 
// System.out.println(message); 
// System.out.printf(" UseXModule: %s%n", options.getUseXModule()); 
// System.out.printf(" EnableErrorCheck: %s%n", options.getEnableErrorCheck()); 
// System.out.printf(" TextPosition: %s%n", options.getTextPosition()); 
// System.out.println("----------------"); 
// } 
Requirements

Target Platforms

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

Leadtools.Barcode Assembly

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