Background
During my development last week I was working on a Silverlight based XPS viewer. During this viewer we came to a situation in which an XPS was made from power point slide. In that PPT two images were shown during rendering the images present in it.
The problem is that Silverlight doesn’t have any viewport or viewbox support. Along with these problems, the font files need to be downloaded externally so that we can render them in our XPS Viewer
Using the code
Now i have replace path into Image element, remove 1st image and change left and top to 2nd image plus increase hight.
var viewbox = new Rect(Convert.ToDouble(tempviewbox[0]), Convert.ToDouble(tempviewbox[1]),
Convert.ToDouble(tempviewbox[2]), Convert.ToDouble(tempviewbox[3]));
var viewport = new Rect(Convert.ToDouble(tempviewPort[0]), Convert.ToDouble(tempviewPort[1]),
Convert.ToDouble(tempviewPort[2]), Convert.ToDouble(tempviewPort[3]));
Image img = new Image();
img.Source = bitmapImage;
img.Stretch = Stretch.Fill;
img.Height = viewport.Height + Convert.ToDouble(vp[3]);
img.SetValue(Canvas.LeftProperty, Convert.ToDouble(vp[0]));
img.SetValue(Canvas.TopProperty, Convert.ToDouble(vp[1]));
var parent = path.Parent as Canvas;
var index = parent.Children.IndexOf(path);
parent.Children.Insert(index, img);
var stream = Application.GetResourceStream(_streamResourceInfo, ConvertPartName(glyphs.FontUri.ToString())).Stream;
glyphs.FontSource = new FontSource(stream);