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
  1. Home
  2. General Programming
  3. C#
  4. Print .Net Bitmap with Win32 API

Print .Net Bitmap with Win32 API

Scheduled Pinned Locked Moved C#
csharpgraphicsjsonquestion
7 Posts 3 Posters 0 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.
  • S Offline
    S Offline
    Shaun Becker
    wrote on last edited by
    #1

    Does anybody know how I could print a .Net Bitmap with Win32 Api calls? Thanks alot

    H A 2 Replies Last reply
    0
    • S Shaun Becker

      Does anybody know how I could print a .Net Bitmap with Win32 Api calls? Thanks alot

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      Why would you want to? GDI+ (encapsulated in the System.Drawing classes) gives you all the functionality as GDI (though some things are still easier in GDI at times) and all the printing facilities in .NET allow you to manipulate the image that is printed (including text) however you want. It's a heck of a lot easier, especially since coordinate transformations are a little easier since the printer-specific coordinate mapping is abstracted away. If you want to use Win32 printing APIs (which is really just GDI using the HDC of a printer), then find an example in C/C++ and go to all the work of P/Invoking what you need to do it in C#.

      Microsoft MVP, Visual C# My Articles

      S 1 Reply Last reply
      0
      • H Heath Stewart

        Why would you want to? GDI+ (encapsulated in the System.Drawing classes) gives you all the functionality as GDI (though some things are still easier in GDI at times) and all the printing facilities in .NET allow you to manipulate the image that is printed (including text) however you want. It's a heck of a lot easier, especially since coordinate transformations are a little easier since the printer-specific coordinate mapping is abstracted away. If you want to use Win32 printing APIs (which is really just GDI using the HDC of a printer), then find an example in C/C++ and go to all the work of P/Invoking what you need to do it in C#.

        Microsoft MVP, Visual C# My Articles

        S Offline
        S Offline
        Shaun Becker
        wrote on last edited by
        #3

        The reason that I want to use API is because I am working on a project to print invoices. The .Net printing framework is to slow to keep up with the volume of invoices printed every night. So, my only other alternative is to print using the API. Thanks for your help.

        H 1 Reply Last reply
        0
        • S Shaun Becker

          The reason that I want to use API is because I am working on a project to print invoices. The .Net printing framework is to slow to keep up with the volume of invoices printed every night. So, my only other alternative is to print using the API. Thanks for your help.

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          By the time the performance hit for marshaling parameters for P/Invoked method invocation, you probably won't notice a huge difference anyway. Perhaps a better solution is an N-tier design, one in which reports are generated and placed in a directory where another app (or even if the printer "driver" supports such a thing) is responsible only for printing the queued reports and removing them or backing them up. This would be truly faster so that your reporting app can just worry about generating these reports from the onslaught of all this data without having to wait for the printer queue to free-up after a few pages go in. A good multi-threaded design would help, but eventually you'd have to start blocking for sake of memory and performance.

          Microsoft MVP, Visual C# My Articles

          S 1 Reply Last reply
          0
          • S Shaun Becker

            Does anybody know how I could print a .Net Bitmap with Win32 Api calls? Thanks alot

            A Offline
            A Offline
            Anonymous
            wrote on last edited by
            #5

            Yeah why don't you start getting undress and start fucking the printer....:eek:

            S 1 Reply Last reply
            0
            • H Heath Stewart

              By the time the performance hit for marshaling parameters for P/Invoked method invocation, you probably won't notice a huge difference anyway. Perhaps a better solution is an N-tier design, one in which reports are generated and placed in a directory where another app (or even if the printer "driver" supports such a thing) is responsible only for printing the queued reports and removing them or backing them up. This would be truly faster so that your reporting app can just worry about generating these reports from the onslaught of all this data without having to wait for the printer queue to free-up after a few pages go in. A good multi-threaded design would help, but eventually you'd have to start blocking for sake of memory and performance.

              Microsoft MVP, Visual C# My Articles

              S Offline
              S Offline
              Shaun Becker
              wrote on last edited by
              #6

              That wouldn't work because I only have a certain block of time that the reports can print because the printer is used for other purposes and with the .Net printing framework, it is constantly going behond that block. It is not the report generation that is slowing down the process, it is the actual printing of the reports. And actually, I am almost done with the Win32 Api printing functions and it seems to be considerably faster.

              1 Reply Last reply
              0
              • A Anonymous

                Yeah why don't you start getting undress and start fucking the printer....:eek:

                S Offline
                S Offline
                Shaun Becker
                wrote on last edited by
                #7

                Why are you posting as Anonymous, you don't want anybody to know who you are?

                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