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. Visual Basic
  4. Print to a File

Print to a File

Scheduled Pinned Locked Moved Visual Basic
questiontutorial
5 Posts 2 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.
  • G Offline
    G Offline
    gthompson2005
    wrote on last edited by
    #1

    Hey got a question, I'm using a printe document in my program, My printing goes just fine, along with my print preview. My question, is does anybody know how to at runtime, choose to print to a file, like you were to select that on a print dialog? Setting the path and file to create for this Print to File, I've searched all over and, can't seem to find anything on this, also tried a few different things. I want to do this all without user involvment. Thanks in advance

    D 1 Reply Last reply
    0
    • G gthompson2005

      Hey got a question, I'm using a printe document in my program, My printing goes just fine, along with my print preview. My question, is does anybody know how to at runtime, choose to print to a file, like you were to select that on a print dialog? Setting the path and file to create for this Print to File, I've searched all over and, can't seem to find anything on this, also tried a few different things. I want to do this all without user involvment. Thanks in advance

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      At runtime, you could just write the information to a text file using the normal File methods. You really can't setup a printer to use a FILE: port at runtime. There is no support in the .NET BCL to do this. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      G 1 Reply Last reply
      0
      • D Dave Kreskowiak

        At runtime, you could just write the information to a text file using the normal File methods. You really can't setup a printer to use a FILE: port at runtime. There is no support in the .NET BCL to do this. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        G Offline
        G Offline
        gthompson2005
        wrote on last edited by
        #3

        Thanks Dave for the reply, figured you would. But, let me be more clear, as to why I'm trying to do this, maybe you can give me a better solution. At work, when we click the fax button in are program, the MIS department, has that program print the document to a file ( one that is not text and also not a tiff file ) then passing this file to an email that gets sent to are biscom fax server. I'm assuming what they do, is act like printing, but print to a file (sort of like on the option on the print dialog to print to a file instead) and pass this along in the email. If not, I'll have to figure out how to create a tiff file from my print document to make this work. Thanks for your help

        D 1 Reply Last reply
        0
        • G gthompson2005

          Thanks Dave for the reply, figured you would. But, let me be more clear, as to why I'm trying to do this, maybe you can give me a better solution. At work, when we click the fax button in are program, the MIS department, has that program print the document to a file ( one that is not text and also not a tiff file ) then passing this file to an email that gets sent to are biscom fax server. I'm assuming what they do, is act like printing, but print to a file (sort of like on the option on the print dialog to print to a file instead) and pass this along in the email. If not, I'll have to figure out how to create a tiff file from my print document to make this work. Thanks for your help

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          The printing classes in the .NET BCL currently do not support (correctly anyway...) turning on the "Print To File" option through code. It only allows you to activate the check box on the PrintDialog. Even then, it doesn't work properly and your output will still go to the printer and not a file. This MIGHT be fixed in SP1 for .NET 1.1 and SP3 for .NET 1.0. You best bet is to "print" your document, I should say "draw" your document, to a Bitmap object and save that as a .JPG, .BMP, or whatever you need and send that image as an attachment in an email. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

          G 1 Reply Last reply
          0
          • D Dave Kreskowiak

            The printing classes in the .NET BCL currently do not support (correctly anyway...) turning on the "Print To File" option through code. It only allows you to activate the check box on the PrintDialog. Even then, it doesn't work properly and your output will still go to the printer and not a file. This MIGHT be fixed in SP1 for .NET 1.1 and SP3 for .NET 1.0. You best bet is to "print" your document, I should say "draw" your document, to a Bitmap object and save that as a .JPG, .BMP, or whatever you need and send that image as an attachment in an email. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

            G Offline
            G Offline
            gthompson2005
            wrote on last edited by
            #5

            I figured after not finding anything on printing to a file, as I was wanting to do. Thanks for your help, and suggestions.

            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