我从Web上拉取图像并将其添加到FixedDocument页面。我拉的图像的尺寸大小为1200像素×1500像素。但是在FixedDocument中,图像显示为小缩略图(请参阅屏幕截图)。FixedDocument页面大小
下面给出的是代码片段。
FixedDocument fd = new FixedDocument();
BitmapImage bi = new BitmapImage();
bi.BeginInit();
bi.UriSource = new Uri(@"http://www.example.com/image.jpg", UriKind.Absolute);
bi.EndInit();
Image i = new Image();
i.Source = bi;
FixedPage fixedPage = new FixedPage();
fixedPage.Children.Add(i);
PageContent pageContent = new PageContent();
(pageContent as IAddChild).AddChild(fixedPage);
fd.Pages.Add(pageContent);
我需要按照其尺寸显示图像,而不是缩略图。请有人告诉我需要做什么来显示图像的大小?
非常感谢。
您的代码对我来说很适合[this](http://upload.wikimedia.org/wikipedia/commons/c/cd/RathausBremen-01-2.jpg)大图。您可以在[BitmapSource.DownloadCompleted](http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.bitmapsource.downloadcompleted.aspx)事件处理程序中交叉检查图像大小,以查看是否你有你想要的。 – Clemens 2012-02-29 12:06:45
@Clemens:谢谢。请将您的评论作为答案,我会接受它。正如您指出的,在DownloadCompleted事件处理程序中检查高度和宽度显示了问题。高度和宽度分别显示为150px X 225px。为什么会这样?您的评论中的链接图像已打开到完美的大小,这是服务器问题吗? – 2012-02-29 13:36:57