←Select platform

Version Property

Gets or sets the SVG version of the document.
public SvgVersion Version { get; set; } 
@property (nonatomic, assign) LTSvgVersion version; 
public SvgVersion getVersion() 
public void setVersion(SvgVersion version) 
property SvgVersion Version { 
   SvgVersion get(); 
   void set (    SvgVersion ); 
Version # get and set (SvgDocument) 

Property Value

The SVG version of the document


The initial version of Version depends on the original data and read from the SVG data directly.

Setting the value to a different value will be used when saving the document using SaveToFile or to SaveToStream.


This example will convert an SVG file from version any version to 1.1

using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Drawing; 
using Leadtools.Forms.DocumentWriters; 
using Leadtools.Svg; 
using Leadtools.Document.Writer; 
public void SvgVersionExample() 
   // Assume the SVG file is located here 
   string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Page1.svg"); 
   string dstFileName = Path.Combine(LEAD_VARS.ImagesDir, "Page1Version11.svg"); 
   // Load the SVG from file 
   using (SvgDocument document = SvgDocument.LoadFromFile(srcFileName, null)) 
      // Show the version 
      Console.WriteLine("Original version is: " + document.Version); 
      if (document.Version != SvgVersion.v11) 
         // Convert it 
         document.Version = SvgVersion.v11; 
      // Save it 
      document.SaveToFile(dstFileName, null); 
   // Check it 
   using (SvgDocument document = SvgDocument.LoadFromFile(dstFileName, null)) 
      Console.WriteLine("New version is: " + document.Version); 
static class LEAD_VARS 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
import java.io.ByteArrayInputStream; 
import java.io.ByteArrayOutputStream; 
import java.io.File; 
import java.io.FileInputStream; 
import java.io.FileOutputStream; 
import java.io.IOException; 
import java.io.ObjectInputStream; 
import java.io.ObjectOutputStream; 
import java.io.PrintStream; 
import java.nio.file.FileVisitOption; 
import java.nio.file.Files; 
import java.nio.file.Path; 
import java.nio.file.Paths; 
import java.util.stream.Stream; 
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.codecs.*; 
import leadtools.document.writer.*; 
import leadtools.svg.*; 
public void svgDocumentVersionExample() { 
   String LEAD_VARS_ImagesDir = "C:\\LEADTOOLS23\\Resources\\Images"; 
   // Assume the SVG file is located here 
   String srcFilePath = combine(LEAD_VARS_ImagesDir, "Leadtools_pdf.svg"); 
   String dstFilePath = combine(LEAD_VARS_ImagesDir, "Leadtools_pdf_version11.svg"); 
   // Load the SVG from file 
   SvgDocument document = SvgDocument.loadFromFile(srcFilePath, null); 
   // Show the version 
   System.out.println("Original version is: " + document.getVersion()); 
   if (document.getVersion() != SvgVersion.V11) { 
      // Convert it 
   // Save it 
   document.saveToFile(dstFilePath, null); 
   // Check it 
   SvgDocument document2 = SvgDocument.loadFromFile(dstFilePath, null); 
   System.out.println("New version is: " + document2.getVersion()); 
   assertTrue(document2.getVersion() == SvgVersion.V11); 

Target Platforms

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

Leadtools.Svg Assembly

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