Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CDC::StartPage() and CDC::EndPage()

CDC::StartPage() and CDC::EndPage()

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestioncareer
5 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RYU
    wrote on last edited by
    #1

    Hi All, When I am using CDC::StartPage() and CDC::EndPage() it does NOT honour the setting of "Start Printing Immediately". It means that if I have 10000 pages job, I must wait until it spooled completely before it starts printing to the printer. I know that StartPagePrinter() and EndPagePrinter(), it does print the page even though the print job is not completely spooled. That means for 10000 pages job, the printer is start printing as soon as the first page is completely spooled. Is this a bug in CDC::StartPage() and CDC::EndPage()? I do not want to use StartPagePrinter() and EndPagePrinter(). Is there any way around it so I still can use CDC to do an immediate printing? Thanks for any help in advance :)

    L 1 Reply Last reply
    0
    • R RYU

      Hi All, When I am using CDC::StartPage() and CDC::EndPage() it does NOT honour the setting of "Start Printing Immediately". It means that if I have 10000 pages job, I must wait until it spooled completely before it starts printing to the printer. I know that StartPagePrinter() and EndPagePrinter(), it does print the page even though the print job is not completely spooled. That means for 10000 pages job, the printer is start printing as soon as the first page is completely spooled. Is this a bug in CDC::StartPage() and CDC::EndPage()? I do not want to use StartPagePrinter() and EndPagePrinter(). Is there any way around it so I still can use CDC to do an immediate printing? Thanks for any help in advance :)

      L Offline
      L Offline
      Larry J Siddens
      wrote on last edited by
      #2

      You also need to do a CDC::StartDoc() which informs the device a new job is starting. Then you do a CDC::StartPage() which informs the device a new page is being printed. When don, you need to do an CDC::EndPage() for the end of a page and CDC::EndDoc() to inform the device that it has everything. Take a look at the MSDN CDC::StartDoc documentation. There is an example in there. Hope this helps. Larry J. Siddens

      R 1 Reply Last reply
      0
      • L Larry J Siddens

        You also need to do a CDC::StartDoc() which informs the device a new job is starting. Then you do a CDC::StartPage() which informs the device a new page is being printed. When don, you need to do an CDC::EndPage() for the end of a page and CDC::EndDoc() to inform the device that it has everything. Take a look at the MSDN CDC::StartDoc documentation. There is an example in there. Hope this helps. Larry J. Siddens

        R Offline
        R Offline
        RYU
        wrote on last edited by
        #3

        Hi Larry, Sorry if I wasn't make my question clear. What happen is that the page is start printing when it reaches CDC::EndDoc(). What I want is that the page starting to print as soon as it reaches CDC::EndPage() (NOT CDC::EndDoc()). Therefore if I have 10000pages job, I do NOT want to wait until it completely spooled before it starts printing. The only way that I know to do this is using StartPagePrinter() and EndPagePrinter(). Of course, I need to get the printer handle by calling OpenPrinter() to get the printer handle, StartDocPrinter() before calling StartPagePrinter() and EndPagePrinter(), and finally EndDocPrinter() to indicate end of print job. With this way, as soon as it reaches EndPagePrinter(), it will start printing. That means if I have 10000pages job, I can start printing as soon as the first page is completely spooled. (Please note that this will depend of the setting of your printer. Set your printer setting to "Start printing immediately"). Since my application is using a CDC to draw rectangle, etc... I do not want to change my application from using CDC. Thanks for any help again in advanced... Cheers :)

        L 1 Reply Last reply
        0
        • R RYU

          Hi Larry, Sorry if I wasn't make my question clear. What happen is that the page is start printing when it reaches CDC::EndDoc(). What I want is that the page starting to print as soon as it reaches CDC::EndPage() (NOT CDC::EndDoc()). Therefore if I have 10000pages job, I do NOT want to wait until it completely spooled before it starts printing. The only way that I know to do this is using StartPagePrinter() and EndPagePrinter(). Of course, I need to get the printer handle by calling OpenPrinter() to get the printer handle, StartDocPrinter() before calling StartPagePrinter() and EndPagePrinter(), and finally EndDocPrinter() to indicate end of print job. With this way, as soon as it reaches EndPagePrinter(), it will start printing. That means if I have 10000pages job, I can start printing as soon as the first page is completely spooled. (Please note that this will depend of the setting of your printer. Set your printer setting to "Start printing immediately"). Since my application is using a CDC to draw rectangle, etc... I do not want to change my application from using CDC. Thanks for any help again in advanced... Cheers :)

          L Offline
          L Offline
          Larry J Siddens
          wrote on last edited by
          #4

          If I understand you correctly, you have a handle to a printer and want to use the CDC. Look at CDC::Attach(). This takes the handle (HDC) and attaches it to the CDC so you can use it just like any other CDC. When you get done, you can use the CDC::Detach(). Unless you wish the ~CDC() to close it for you. Hope this helps. Larry J. Siddens

          R 1 Reply Last reply
          0
          • L Larry J Siddens

            If I understand you correctly, you have a handle to a printer and want to use the CDC. Look at CDC::Attach(). This takes the handle (HDC) and attaches it to the CDC so you can use it just like any other CDC. When you get done, you can use the CDC::Detach(). Unless you wish the ~CDC() to close it for you. Hope this helps. Larry J. Siddens

            R Offline
            R Offline
            RYU
            wrote on last edited by
            #5

            Hi Larry, (No offence), but you are totally miss-understand my question. My CDC print is working perfectly. The only problem I have is when I need to print, say, 100000pages report (a hundred thousand pages report). Currently if I wanted to print 100000pages report, I have to wait until 100000pages report to be COMPLETELY spooled before start to print the 1st page. What I really need when I print 100000pages report is that as soon as the 1st page is spooled, I can print it straight away. So, I do NOT need to wait until 100000th pages is COMPLETELY spooled before printing the first page. Now, this feature is currently supported by StartPagePrinter() and EndPagePrinter(). Unfortunately, I can’t use these two functions because I need to use CDC to draw text, rectangle, etc… I know that I am still be able to draw the text, rectangle, etc, by passing the HDC, but it will involve too much modification on the application. Therefore, I must stick with CDC. Do you know how to do this? Thanks again for any help in advanced :)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups