【发布时间】:2014-07-18 06:53:52
【问题描述】:
我想打印multipage .tiff files 的列表。我遇到的问题是我没有得到多页,只有第一页被“打印”。有人可以指出我到底做错了什么吗?
Private Sub docPrintPage(sender As Object, e As PrintPageEventArgs)
For Each filName As String In fileN
Dim m_Image As Image = Image.FromFile(filName)
Dim pc As Integer = 0
Dim currPage As Integer = 0
pc = m_Image.GetFrameCount(FrameDimension.Page)
While (currPage < pc)
m_Image.SelectActiveFrame(FrameDimension.Page, currPage)
e.Graphics.DrawImage(m_Image, e.PageBounds) 'Most likely the problem lies here
currPage = currPage + 1
e.HasMorePages = true
End While
Next
e.HasMorePages = false
End Sub
变量的一些解释:
fileN: List of paths to my files
pc: pagecount/framecount of the current .tiff
currPage: index of the active frame in the current .tiff
我的终极目标:在打印预览中显示一系列(列表)多帧 .tiff。
【问题讨论】:
-
为什么设置
e.HasMorePages = false -
否则它会继续使用 docPrintPage 方法添加页面。 e.HasMorePages 最后必须设置为 false。众多参考之一:参考:codeproject.com/Tips/733680/…
-
你到底想要什么?在每个打印页面上打印一个 tiff 页?因为 PrintPage 事件打印单个页面,但您尝试打印多个 tiff 页面然后退出指定 HasMorePages = False,这是不正确的。
-
确实,我的终极目标是每页打印一个 tiff。 tiff 中的每个帧都是 A4 大小的。问题在于存在多个文件和多个框架,并在打印预览中显示。显示一个多帧 .tiff 不是问题,它显示一个列表
-
删除该代码并尝试
标签: vb.net printdocument