我在 silverlight 中编写了一个应用程序网站,用于查看 Tiff 文件。我将 Tiff 文件的绝对 uri 发送到 silverlight 应用程序,它会查看/缩放或下载文件。
我使用 PrintDocument 库打印 tiff,但发送到打印机的文件非常大(100kb 的 tiff 文件为 500Mb)。
现在这是我的打印代码:
Protected Sub pd_PrintPage(ByVal sender As Object, ByVal ev As PrintPageEventArgs)
Try
If (PrintPageCount = 0) Then
PrintPageCount = ImageTiff.NumberOfDirectories
PrintCurrPage = 0
End If
If (PrintCurrPage < PrintPageCount) Then
ImageTiff.SetDirectory(PrintCurrPage)
Dim cnv As New Canvas With
{
.Width = 840,
.Height = 1180,
.Background = New ImageBrush With {
.ImageSource = GetWritableBmp(ImageTiff, larghezza, altezza),
.Stretch = Stretch.Fill
}
}
ev.PageVisual = cnv
PrintCurrPage += 1
ev.HasMorePages = True
Else
ev.HasMorePages = False
End If
Catch ex As Exception
MessageBox.Show("Errore handler:" & ex.Message & vbCrLf & ex.StackTrace)
End Try
End Sub
还有我的打印按钮事件处理程序
Private Sub ButtonPrint_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles ButtonPrint.Click
Try
Dim pdoc As New PrintDocument()
AddHandler pdoc.PrintPage, AddressOf Me.pd_PrintPage
pdoc.Print(Uri.AbsoluteUri)
Catch ex As Exception
MessageBox.Show("Errore:" & ex.Message)
End Try
End Sub
我想将“ http://www.mysite.it/tifffiles/mytif.tif ”的打印直接发送到打印机,这可能吗?