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 / C++ / MFC
  4. Generating/exporting a PDF from my MFC application, for reports that are created by overloading OnDraw in a view

Generating/exporting a PDF from my MFC application, for reports that are created by overloading OnDraw in a view

Scheduled Pinned Locked Moved C / C++ / MFC
c++graphicsquestion
8 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
    Sternocera
    wrote on last edited by
    #1

    Hello, I'd like to be able to directly support exporting various reports from my MFC application. The reports are drawn to a device context using standard GDI techniques, overloading OnDraw in a view. Ideally, there'd be a library that I could just drop in that provides a hDc that I'd draw to in the usual manner. This library would be either available under a copy-centre licence (BSD/MIT/COL) or would be commercially available. Could someone suggest a library/approach? Regards, Sternocera

    C R 2 Replies Last reply
    0
    • S Sternocera

      Hello, I'd like to be able to directly support exporting various reports from my MFC application. The reports are drawn to a device context using standard GDI techniques, overloading OnDraw in a view. Ideally, there'd be a library that I could just drop in that provides a hDc that I'd draw to in the usual manner. This library would be either available under a copy-centre licence (BSD/MIT/COL) or would be commercially available. Could someone suggest a library/approach? Regards, Sternocera

      C Offline
      C Offline
      CPallini
      wrote on last edited by
      #2

      Please, let me google that for you [^]. :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      1 Reply Last reply
      0
      • S Sternocera

        Hello, I'd like to be able to directly support exporting various reports from my MFC application. The reports are drawn to a device context using standard GDI techniques, overloading OnDraw in a view. Ideally, there'd be a library that I could just drop in that provides a hDc that I'd draw to in the usual manner. This library would be either available under a copy-centre licence (BSD/MIT/COL) or would be commercially available. Could someone suggest a library/approach? Regards, Sternocera

        R Offline
        R Offline
        Rajesh R Subramanian
        wrote on last edited by
        #3

        Hello! Take a look at LibHaru[^]

        It is a crappy thing, but it's life -^ Carlo Pallini

        S 1 Reply Last reply
        0
        • R Rajesh R Subramanian

          Hello! Take a look at LibHaru[^]

          It is a crappy thing, but it's life -^ Carlo Pallini

          S Offline
          S Offline
          Sternocera
          wrote on last edited by
          #4

          Rajesh, I took a look at LibHaru, but I found that it cannot draw to a windows GDI device context...thus, I'd have to rewrite my reports from scratch. What I'd really like is a drop-in replacement for my GDI device context. I read somewhere that it is somehow possible to do this using WxWidgets' PDF support. I can't seem to find any more information though, Regards, Sternocera

          R 1 Reply Last reply
          0
          • S Sternocera

            Rajesh, I took a look at LibHaru, but I found that it cannot draw to a windows GDI device context...thus, I'd have to rewrite my reports from scratch. What I'd really like is a drop-in replacement for my GDI device context. I read somewhere that it is somehow possible to do this using WxWidgets' PDF support. I can't seem to find any more information though, Regards, Sternocera

            R Offline
            R Offline
            Rajesh R Subramanian
            wrote on last edited by
            #5

            You can always create a bitmap of the stuff that's stored on your device context and then Haru can print it to a PDF. Sounds viable?

            It is a crappy thing, but it's life -^ Carlo Pallini

            S 1 Reply Last reply
            0
            • R Rajesh R Subramanian

              You can always create a bitmap of the stuff that's stored on your device context and then Haru can print it to a PDF. Sounds viable?

              It is a crappy thing, but it's life -^ Carlo Pallini

              S Offline
              S Offline
              Sternocera
              wrote on last edited by
              #6

              Rajesh, Obviously, I'd much rather preserve my reports as vector graphics. At the moment, I'm looking at wxPdfDocument - It's designed to be used from WxWidgets, but it may be possible to use from MFC, Regards, Sternocera

              R 1 Reply Last reply
              0
              • S Sternocera

                Rajesh, Obviously, I'd much rather preserve my reports as vector graphics. At the moment, I'm looking at wxPdfDocument - It's designed to be used from WxWidgets, but it may be possible to use from MFC, Regards, Sternocera

                R Offline
                R Offline
                Rajesh R Subramanian
                wrote on last edited by
                #7

                If you succeed in making it work with MFC, it must make a good article for CP. :)

                It is a crappy thing, but it's life -^ Carlo Pallini

                S 1 Reply Last reply
                0
                • R Rajesh R Subramanian

                  If you succeed in making it work with MFC, it must make a good article for CP. :)

                  It is a crappy thing, but it's life -^ Carlo Pallini

                  S Offline
                  S Offline
                  Sternocera
                  wrote on last edited by
                  #8

                  Rajesh, Yes, indeed. I have a high level idea of how it might be possible. http://wxcode.sourceforge.net/docs/wxpdfdoc/classwx_pdf_document.html[^] Look at the function "bool wxPdfDocument::Image". It ought to be possible to export my GDI data to a WMF file ( see http://en.wikipedia.org/wiki/Windows_Metafile[^] ), perhaps to a temp directory, and open that using wxPdfDocument afterwards. More research is required, Regards, Sternocera

                  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