语法
c#
VB
objective - c
c++
Java
(可空instancetype) initWithData:(NSData *)数据
选择:(nullable LTSvgLoadOptions *)选项
错误:错误(NSError * *)
公共静态SvgDocument loadFromMemory (字节[]缓冲,int抵消,int长度,SvgLoadOptions选项)
参数
返回值
的SvgDocument这个方法创建对象。
例子
使用Leadtools;
使用Leadtools.Codecs;
使用Leadtools.Drawing;
使用Leadtools.Forms.DocumentWriters;
使用Leadtools.Svg;
使用LeadtoolsExamples.Common;
公共无效SvgLoadFromMemoryExample ()
{
/ /假设SVG文件位于这里
字符串srcFileName = Path.Combine (ImagesPath.Path,“Page1.svg”);
/ /文件加载到内存中
字节[]data = File.ReadAllBytes (srcFileName);
/ /加载SVG
使用(= SvgDocument SvgDocument文档。LoadFromMemory(数据、0 data.Length零))
{
/ /准备它
如果(document.IsFlat !)
document.Flat (零);
如果(document.Bounds.IsValid !)
document.CalculateBounds (假);
/ /显示其属性
Console.WriteLine (”界限:“+ document.Bounds.Bounds);
Console.WriteLine (解析:“+ document.Bounds.Resolution);
}
}
进口Leadtools
进口Leadtools.Codecs
进口Leadtools.Drawing
进口Leadtools.Forms.DocumentWriters
进口Leadtools.Svg
公共共享子SvgLoadFromMemoryExample ()
“假设SVG文件位于这里
昏暗的srcFileName作为字符串= Path.Combine (Common.ImagesPath.Path“Page1.svg”)
文件加载到内存中
昏暗的数据()作为字节= File.ReadAllBytes (srcFileName)
SVG的加载
使用文档作为SvgDocument = SvgDocument。LoadFromMemory (data, 0, data.Length,没有什么)
“准备它
如果不document.IsFlat然后
document.Flat (没有什么)
结束如果
如果不document.Bounds.IsValid然后
document.CalculateBounds (假)
结束如果
“显示其属性
Console.WriteLine (”界限:“+ document.Bounds.Bounds.ToString ())
Console.WriteLine (解析:“+ document.Bounds.Resolution.ToString ())
结束使用
结束子