Error processing SSI file
LEADTOOLS Svg (Leadtools.Svg assembly)

Show in webframe

SaveToStream Method






Output stream.
Save option. Can be null.
Saves this SvgDocument to a stream.
Syntax
public void SaveToStream( 
   Stream stream,
   SvgSaveOptions options
)
'Declaration
 
Public Sub SaveToStream( _
   ByVal stream As Stream, _
   ByVal options As SvgSaveOptions _
) 
'Usage
 
Dim instance As SvgDocument
Dim stream As Stream
Dim options As SvgSaveOptions
 
instance.SaveToStream(stream, options)
- (BOOL)saveToStream:(LTLeadStream *)stream
             options:(nullable LTSvgSaveOptions *)options
               error:(NSError **)error
            
public void saveToStream(OutputStream stream, SvgSaveOptions options)
public:
void SaveToStream( 
   Stream^ stream,
   SvgSaveOptions^ options
) 

Parameters

stream
Output stream.
options
Save option. Can be null.
Remarks

This method will save this SvgDocument to the output stream as a standard SVG document. Use Version to control the SVG version used.

Example
Copy Code  
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.Drawing
Imports Leadtools.Forms.DocumentWriters
Imports Leadtools.Svg

Public Shared Sub SvgToStreamExample()
   ' Assume the SVG file is located here
   Dim srcFileName As String = Path.Combine(Common.ImagesPath.Path, "Page1.svg")
   Dim stream As New MemoryStream()

   ' Load the SVG from file
   Using document As SvgDocument = SvgDocument.LoadFromFile(srcFileName, Nothing)
      ShowSvgProperties("Original", document)

      ' Set the version and save it to a stream
      document.Version = SvgVersion.v10
      document.SaveToStream(stream, Nothing)
      stream.Position = 0
   End Using

   ' Load the SVG from stream and show its properties
   Using document As SvgDocument = SvgDocument.LoadFromStream(stream, Nothing)
      ShowSvgProperties("Loaded from stream", document)
   End Using

   stream.Dispose()
End Sub

Private Shared Sub ShowSvgProperties(message As String, document As SvgDocument)
   ' 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(message)
   Console.WriteLine(" Version: " + document.Version.ToString())
   Console.WriteLine(" Bounds: " + document.Bounds.Bounds.ToString())
   Console.WriteLine(" Resolution: " + document.Bounds.Resolution.ToString())
End Sub
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Drawing;
using Leadtools.Forms.DocumentWriters;
using Leadtools.Svg;

      
public void SvgToStreamExample()
{
   // Assume the SVG file is located here
   string srcFileName = Path.Combine(ImagesPath.Path, "Page1.svg");
   Stream stream = new MemoryStream();

   // Load the SVG from file
   using (SvgDocument document = SvgDocument.LoadFromFile(srcFileName, null))
   {
      ShowSvgProperties("Original", document);

      // Set the version and save it to a stream
      document.Version = SvgVersion.v10;
      document.SaveToStream(stream, null);
      stream.Position = 0;
   }

   // Load the SVG from stream and show its properties
   using (SvgDocument document = SvgDocument.LoadFromStream(stream, null))
   {
      ShowSvgProperties("Loaded from stream", document);
   }

   stream.Dispose();
}

private static void ShowSvgProperties(string message, SvgDocument document)
{
   // Prepare it
   if (!document.IsFlat)
      document.Flat(null);
   if (!document.Bounds.IsValid)
      document.CalculateBounds(false);

   // Show its properties
   Console.WriteLine(message);
   Console.WriteLine(" Version: " + document.Version);
   Console.WriteLine(" Bounds: " + document.Bounds.Bounds);
   Console.WriteLine(" Resolution: " + document.Bounds.Resolution);
}
Requirements

Target Platforms

See Also

Reference

SvgDocument Class
SvgDocument Members

Error processing SSI file
  Leadtools.Svg requires a Document or Medical toolkit license and unlock key. For more information, refer to: LEADTOOLS Toolkit Features