Creates an SvgDocument object from data saved in a memory buffer.
public static SvgDocument LoadFromMemory(
byte[] buffer,
int offset,
int length,
SvgLoadOptions options
)
Public Shared Function LoadFromMemory( _
ByVal buffer() As Byte, _
ByVal offset As Integer, _
ByVal length As Integer, _
ByVal options As Leadtools.Svg.SvgLoadOptions _
) As Leadtools.Svg.SvgDocument
- (nullable instancetype)initWithData:(NSData *)data
options:(nullable LTSvgLoadOptions *)options
error:(NSError **)error
public static SvgDocument loadFromMemory(byte[] buffer, int offset, int length, SvgLoadOptions options)
public:
static Leadtools.Svg.SvgDocument^ LoadFromMemory(
array<byte>^ buffer,
int offset,
int length,
Leadtools.Svg.SvgLoadOptions^ options
)
buffer
Buffer containing the SVG data.
offset
0-based offset into the buffer where the data begins.
length
Number of bytes to read.
options
Options to use during load. If this parameter is null, then a default SvgLoadOptions object will be used.
The SvgDocument object this method creates.
To get and set information about the document's bounds and resolution, refer to SVG Size, Bounds and Flat.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Drawing;
using Leadtools.Forms.DocumentWriters;
using Leadtools.Svg;
using LeadtoolsExamples.Common;
public void SvgLoadFromMemoryExample()
{
// Assume the SVG file is located here
string srcFileName = Path.Combine(ImagesPath.Path, "Page1.svg");
// Load the file into memory
byte[] data = File.ReadAllBytes(srcFileName);
// Load the SVG
using (SvgDocument document = SvgDocument.LoadFromMemory(data, 0, data.Length, null))
{
// Prepare it
if (!document.IsFlat)
document.Flat(null);
if (!document.Bounds.IsValid)
document.CalculateBounds(false);
// Show its properties
Console.WriteLine("Bounds: " + document.Bounds.Bounds);
Console.WriteLine("Resolution: " + document.Bounds.Resolution);
}
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.Drawing
Imports Leadtools.Forms.DocumentWriters
Imports Leadtools.Svg
Public Shared Sub SvgLoadFromMemoryExample()
' Assume the SVG file is located here
Dim srcFileName As String = Path.Combine(Common.ImagesPath.Path, "Page1.svg")
' Load the file into memory
Dim data() As Byte = File.ReadAllBytes(srcFileName)
' Load the SVG
Using document As SvgDocument = SvgDocument.LoadFromMemory(data, 0, data.Length, Nothing)
' Prepare it
If Not document.IsFlat Then
document.Flat(Nothing)
End If
If Not document.Bounds.IsValid Then
document.CalculateBounds(False)
End If
' Show its properties
Console.WriteLine("Bounds: " + document.Bounds.Bounds.ToString())
Console.WriteLine("Resolution: " + document.Bounds.Resolution.ToString())
End Using
End Sub
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.