FormattedVisualDrawing Class
Represents a formatted VisualDrawing that can be exported to PDF, XPS, image, or be printed.
public sealed class FormattedVisualDrawing
Public NotInheritable Class FormattedVisualDrawing
- Inheritance:
- System.ObjectFormattedVisualDrawing
Properties
Content
Gets the drawing content.
public FrameworkElement Content { get; }
Public ReadOnly Property Content As FrameworkElement
Property Value
- System.Windows.FrameworkElement
The drawing content.
Height
Gets the drawing height in Points.
Property Value
- System.Double
The drawing height in Points.
Width
Gets the drawing width in Points.
Property Value
- System.Double
The drawing width in Points.
Methods
Print()
Prints the drawing to the default printer.
Print(String)
Prints the drawing to the specified printer.
Parameters
printerName
- System.String
Printer name.
Print(String, PrintOptions)
Prints the drawing to the specified printer according to specified options.
public void Print(string printerName, PrintOptions options)
Public Sub Print(printerName As String, options As PrintOptions)
Parameters
printerName
- System.String
Printer name.
options
- PrintOptions
Print options.
Save(Stream, SaveOptions)
Saves the drawing in the specified stream.
public void Save(Stream stream, SaveOptions options)
Public Sub Save(stream As Stream, options As SaveOptions)
Parameters
stream
- System.IO.Stream
The stream in which to save the drawing.
options
- SaveOptions
The saving options which can be used to define settings for save operation.
Remarks
Parameter options
, currently, must be of type PdfSaveOptions, XpsSaveOptions or ImageSaveOptions.
Save(Object, String)
Saves the drawing to a System.Web.HttpResponse or System.Web.HttpResponseBase output stream or a System.Net.Http.HttpResponseMessage and sets appropriate HTTP response headers (Content-Type and Content-Disposition). Use this method in ASP.NET application to send the drawing to a client browser. File format is resolved from fileName
extension. See remarks why httpResponse
parameter is of type System.Object.
public void Save(object httpResponse, string fileName)
Public Sub Save(httpResponse As Object, fileName As String)
Parameters
httpResponse
- System.Object
System.Web.HttpResponse object that can be retrieved through the Response property of the System.Web.HttpApplication, System.Web.HttpContext, System.Web.UI.Page or System.Web.UI.UserControl classes or System.Web.HttpResponseBase object or System.Net.Http.HttpResponseMessage object.
fileName
- System.String
File name that will be presented in client browser when downloading a file.
Remarks
note
Supported only if updating the whole page with a postback and not if doing partial-page updates (when you use UpdatePanel controls to update selected regions of a page).
This method accepts System.Object rather than HttpResponse, HttpResponseBase or HttpResponseMessage because otherwise GemBox.Document assembly would have a dependency on System.Web or System.Net.Http assemblies and could not be used in applications which target Client Profile .NET Framework.
HttpResponse can be retrieved through the Response property of the HttpApplication, HttpContext, Page or UserControl classes.
For supported file extensions, see remarks for Save(String) method.
Exceptions
- System.InvalidOperationException
If file extension is not specified or not supported. If file extension is not recognized, use Save(Object, String, SaveOptions) method overload instead.
Save(Object, String, SaveOptions)
Saves the drawing to a System.Web.HttpResponse or System.Web.HttpResponseBase output stream or a System.Net.Http.HttpResponseMessage and sets appropriate HTTP response headers (Content-Type and Content-Disposition). Use this method in ASP.NET application to send the drawing to a client browser. File format is defined with options
parameter. See remarks why httpResponse
parameter is of type System.Object.
public void Save(object httpResponse, string fileName, SaveOptions options)
Public Sub Save(httpResponse As Object, fileName As String, options As SaveOptions)
Parameters
httpResponse
- System.Object
System.Web.HttpResponse object that can be retrieved through the Response property of the System.Web.HttpApplication, System.Web.HttpContext, System.Web.UI.Page or System.Web.UI.UserControl classes or System.Web.HttpResponseBase object or System.Net.Http.HttpResponseMessage object.
fileName
- System.String
File name that will be presented in client browser when downloading a file.
options
- SaveOptions
The saving options which can be used to define settings for save operation.
Remarks
note
Supported only if updating the whole page with a postback and not if doing partial-page updates (when you use UpdatePanel controls to update selected regions of a page).
This method accepts System.Object rather than HttpResponse, HttpResponseBase or HttpResponseMessage because otherwise GemBox.Document assembly would have a dependency on System.Web or System.Net.Http assemblies and could not be used in applications which target Client Profile .NET Framework.
HttpResponse can be retrieved through the Response property of the HttpApplication, HttpContext, Page or UserControl classes.
Save(String)
Saves the drawing to a file with the specified path. Path must include file extension.
Parameters
path
- System.String
The path to which to save the drawing.
Remarks
File extension that is extracted from the path
is used to create the appropriate SaveOptions derived class instance that is then passed to the Save(String, SaveOptions) method.
Following file extensions are supported:
- Portable Document Format: .pdf
- XML Paper Specification: .xps
- Portable Network Graphics: .png
- Joint Photographic Experts Group: .jpeg, .jpg
- Bitmap: .bmp
- Tagged Image File Format: .tiff, .tif
- Windows Media Photo: .wdp
Exceptions
- System.InvalidOperationException
If file extension is not specified or not supported. If file extension is not recognized, use Save(String, SaveOptions) method overload instead.
Save(String, SaveOptions)
Saves the drawing to a file with the specified path.
public void Save(string path, SaveOptions options)
Public Sub Save(path As String, options As SaveOptions)
Parameters
path
- System.String
The path to which to save the drawing.
options
- SaveOptions
The saving options which can be used to define settings for save operation.
Remarks
Parameter options
, currently, must be of type PdfSaveOptions, XpsSaveOptions or ImageSaveOptions.