2010-05-03 29 views
2

我需要使用WPF查看多頁TIFF。我需要在WPF應用程序中查看多頁TIFF

目前,我有以下幾點:

<FlowDocumentReader> 
    <FlowDocument> 
     <BlockUIContainer> 
      <Image x:Name="DocImg" Source="test1752158790.tif" />   
     </BlockUIContainer> 
    </FlowDocument> 
</FlowDocumentReader> 

我只能查看第一頁。

有沒有辦法做到這一點?

謝謝! 託德

+0

請參閱http://stackoverflow.com/questions/2004185/wpf-image-control-to-progressively-load-multipage-tiff – ChrisF 2010-05-03 14:59:23

回答

3

我會在後面實現自己的控制代碼。您將需要一些用戶輸入來指示用戶何時從一個頁面移動到另一個頁面,通過鼠標點擊或其他方式進行操作。

一旦你得到那個用戶輸入,你可以顯示一個不同的tiff頁面。正如在ChrisF所用的問題中所說的,我會使用libtiff,更具體地說,.NET包裝器FreeImage,很好地封裝了用於.NET的tiff功能。

2

如在another問題中回答,請使用TiffBitmapDecoder

事情是這樣的:

// Decode TIFF image 
ImageStream = new FileStream(EnvelopeItem.LocalImagePath, FileMode.Open, FileAccess.Read, FileShare.Read); 
ImageDecoder = new TiffBitmapDecoder(ImageStream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default); 
PageImage.Source = ImageDecoder.Frames.FirstOrDefault(); 

,直到你做與圖像顯示的幀雖然不處分流。

相關問題