Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to preview multiple page tiff files in .Net
    text
    copied!<p>I'm trying to preview and print multiple page TIFF files from a C# 2005 Windows application. Printing works fine but when I send my PrintDocument to a PrintPreviewDialog I get two images of the first page rather than an ameage of the first and second page. I also have the same problem when I use PrintPreviewControl.</p> <p>Below is code for a form with 2 buttons, a PrintDocument and a PrintPreviewDialog that demonstrates the problem.</p> <pre><code>public partial class Form1 : Form { private Image m_Image; private Int32 m_CurrentPage; private Int32 m_PageCount; private void Form1_Load(object sender, EventArgs e) { m_Image = Image.FromFile(".\\Test-2-Page-Image.tif"); m_PageCount = m_Image.GetFrameCount(FrameDimension.Page); } private void printDocument_BeginPrint(object sender, PrintEventArgs e) { m_CurrentPage = 0; m_PageCount = m_Image.GetFrameCount(FrameDimension.Page); } private void printDocument_PrintPage(object sender, PrintPageEventArgs e) { m_Image.SelectActiveFrame(FrameDimension.Page, m_CurrentPage); e.Graphics.DrawImage(m_Image, 0, 0); ++m_CurrentPage; e.HasMorePages = (m_CurrentPage &lt; m_PageCount); } private void btnPreview_Click(object sender, EventArgs e) { printPreviewDialog.Document = printDocument; printPreviewDialog.ShowDialog(); } private void btnPrint_Click(object sender, EventArgs e) { printDocument.Print(); } } </code></pre> <p>Does anyone know if there is there a problem with the PrintPreviewDialog in the .Net framework or am I doing something wrong.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload