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#
  4. Print preview not printing...

Print preview not printing...

Scheduled Pinned Locked Moved C#
question
8 Posts 5 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
    Stanciu Vlad
    wrote on last edited by
    #1

    I have a print preview dialog that allways previsualates what is due to be printed. The previsualization work's fine, but the printing fails. I think that this may occur because at the printing algortihm the document.Print(); is called again. Is there any posibility to print directly the data previsualizated (into the control) without beeing necesary to recalculate (generate) it (through the document?

    protected internal static readonly ... and I wish the list could continue ...

    E N A 3 Replies Last reply
    0
    • S Stanciu Vlad

      I have a print preview dialog that allways previsualates what is due to be printed. The previsualization work's fine, but the printing fails. I think that this may occur because at the printing algortihm the document.Print(); is called again. Is there any posibility to print directly the data previsualizated (into the control) without beeing necesary to recalculate (generate) it (through the document?

      protected internal static readonly ... and I wish the list could continue ...

      E Offline
      E Offline
      Ed Poore
      wrote on last edited by
      #2

      Not in an easy way me thinks :sigh: Ed

      1 Reply Last reply
      0
      • S Stanciu Vlad

        I have a print preview dialog that allways previsualates what is due to be printed. The previsualization work's fine, but the printing fails. I think that this may occur because at the printing algortihm the document.Print(); is called again. Is there any posibility to print directly the data previsualizated (into the control) without beeing necesary to recalculate (generate) it (through the document?

        protected internal static readonly ... and I wish the list could continue ...

        N Offline
        N Offline
        Nicholas Butler
        wrote on last edited by
        #3

        Hi You can do this by deriving a class from PrintController. When the dialog "prints" to generate the preview, save the metafiles produced. Then when the dialog "prints" to the printer, just return the saved images. ---------------------------- Be excellent to each other :) EasiReports[^] My free reporting component for WinForms.

        S 1 Reply Last reply
        0
        • N Nicholas Butler

          Hi You can do this by deriving a class from PrintController. When the dialog "prints" to generate the preview, save the metafiles produced. Then when the dialog "prints" to the printer, just return the saved images. ---------------------------- Be excellent to each other :) EasiReports[^] My free reporting component for WinForms.

          S Offline
          S Offline
          Stanciu Vlad
          wrote on last edited by
          #4

          Can you supply me with a pice of code pls ... Currently I have no ideea how to achive that ... BTW, thank you for your answer :)

          protected internal static readonly ... and I wish the list could continue ...

          R 1 Reply Last reply
          0
          • S Stanciu Vlad

            Can you supply me with a pice of code pls ... Currently I have no ideea how to achive that ... BTW, thank you for your answer :)

            protected internal static readonly ... and I wish the list could continue ...

            R Offline
            R Offline
            Robert Rohde
            wrote on last edited by
            #5

            Nicholas wrote an article on how to get the meta files of the preview and store them as images. You can find it here[^]. You will have to redirect the meta files into a new print job. Note that you nevertheless need another PrintDocument.Print cycle but you won't have to regenerate the output.

            S 1 Reply Last reply
            0
            • R Robert Rohde

              Nicholas wrote an article on how to get the meta files of the preview and store them as images. You can find it here[^]. You will have to redirect the meta files into a new print job. Note that you nevertheless need another PrintDocument.Print cycle but you won't have to regenerate the output.

              S Offline
              S Offline
              Stanciu Vlad
              wrote on last edited by
              #6

              Thanks, exactly what I had to read before implementing an dirty method for obtaining the PageInfo from the preview control (reflection way). Didn't see the GetPreviewPageInfo() procedure. :)

              protected internal static readonly ... and I wish the list could continue ...

              1 Reply Last reply
              0
              • S Stanciu Vlad

                I have a print preview dialog that allways previsualates what is due to be printed. The previsualization work's fine, but the printing fails. I think that this may occur because at the printing algortihm the document.Print(); is called again. Is there any posibility to print directly the data previsualizated (into the control) without beeing necesary to recalculate (generate) it (through the document?

                protected internal static readonly ... and I wish the list could continue ...

                A Offline
                A Offline
                Aaron Dilliard
                wrote on last edited by
                #7

                If this is the case, (print preview is fine, print is not) then chances are you have some variables not reset somewhere, or set to the wrong value. I would suggest trying to figure out exactly what the problem is before "masking" the problem with another solution. Aaron

                S 1 Reply Last reply
                0
                • A Aaron Dilliard

                  If this is the case, (print preview is fine, print is not) then chances are you have some variables not reset somewhere, or set to the wrong value. I would suggest trying to figure out exactly what the problem is before "masking" the problem with another solution. Aaron

                  S Offline
                  S Offline
                  Stanciu Vlad
                  wrote on last edited by
                  #8

                  The problem was simple, I was doing a heavy print job, each page lasted for 1 sec to generate and there wore at least 10 pages. The request from the client was to be able to preview what is due to be printed. The solution I approched was this : into the print document I did a lot of heavy work ( the preview looked ok ) and in an inharited printPreviewDialog, on a print request, using reflection, I printed what was in the cache of the dialog (with out calling the document.Print() method again. I think that the dialog I designed can be usefull, so I intend to create an article based on it, but not now, currently I am time pressed. PS: thank you for your answer.

                  protected internal static readonly ... and I wish the list could continue ...

                  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