Commit 4a6fe6ff authored by davescriven's avatar davescriven
Browse files

Added custom entity support to SvgHandler.

parent 4c059047
......@@ -69,13 +69,18 @@ namespace Svg
/// <returns>An <see cref="SvgDocument"/> with the contents loaded.</returns>
/// <exception cref="FileNotFoundException">The document at the specified <paramref name="path"/> cannot be found.</exception>
public static SvgDocument Open(string path)
{
return Open(path, null);
}
public static SvgDocument Open(string path, Dictionary<string, string> entities)
{
if (!File.Exists(path))
{
throw new FileNotFoundException("The specified document cannot be found.", path);
}
return Open(File.OpenRead(path));
return Open(File.OpenRead(path), entities);
}
public static SvgDocument Open(Stream stream)
......
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Threading;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Web;
namespace Svg.Web
......@@ -111,7 +113,15 @@ namespace Svg.Web
{
try
{
SvgDocument document = SvgDocument.Open(this._state._context.Request.PhysicalPath);
Dictionary<string, string> entities = new Dictionary<string, string>();
NameValueCollection queryString = this._state._context.Request.QueryString;
for (int i = 0; i < queryString.Count; i++)
{
entities.Add(queryString.Keys[i], queryString[i]);
}
SvgDocument document = SvgDocument.Open(this._state._context.Request.PhysicalPath, entities);
using (Bitmap bitmap = document.Draw())
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment