C # Print multi-page TIF

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.