Note the point:
1. Calculate the total number of pages of an image object
Image. Getframecount (Framedimension.page);
2. Initialize the current page and get the contents of the specified page
Image. Selectactiveframe (Framedimension.page, m_currentpage);
3. Set the PrintPage time PrintPageEventArgs parameter value to determine if there are additional pages to print (the number of times is to print multi-page key)
E.hasmorepages = (M_currentpage < m_pagecount);
Basic Demo (reprint)
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 < m_pagecount);} private void Btnprint_click (object sender, EventArgs e) { printdocument.print ();}
C # Print multi-page TIF