Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Printing any document straight from vb.net

$
0
0
hi guys.. i've been googling for samples or codes that might help me figure out how i can modify/specify the pages and number of copies straight from vb.net.

here is the scenario why i really need this one so badly.
my PC running win7 32-bit OS is the machine where the company printer is directly connected.
it has been shared to the network and all other machines running 32-bit OS got no problems in printing from the shared Printer but there are also machines on my network running 64-bit and they cant print due to driver issue.. ive tried all other fixes that microsoft have released or posted but none of them seemed to work..
that is why i've decided to create a little client/server program and the client pcs are obviously those that are running the 64-bit OS. and when they browse and select the document that they want to print. and click the Print Button from the client app. it will make a copy of that file to a shared folder from my PC and sends the filename to the server side app. then the server which my PC will immediately look for the filename from the specified directory and print it.

the problem is it will just print whatever that file or document contains and im not able to specify the number of copies to be printed as well as the pages to be printed...

im hoping someone can help me in figuring this thing out.. heres my code so far..
im open for any corrections and suggestions.. thnx


Sub printme(ByVal filename As String)
        Dim SelProcess As New Process

        Dim printDialog1 As New System.Windows.Forms.PrintDialog
 
        Dim psi As New ProcessStartInfo
        filename = srcPath & filename
        printDialog1.AllowSomePages = True

        With printDialog1.PrinterSettings
            .PrintFileName = filename
            .Copies = 2
            .FromPage = 1
            .ToPage = 1
            .PrinterName = "Canon Inkjet iP1900 series"
        End With
        


        psi.UseShellExecute = True
        psi.Verb = "print"
        psi.FileName = filename
        psi.Arguments = printDialog1.PrinterSettings.ToString
        psi.WindowStyle = ProcessWindowStyle.Hidden
        SelProcess.StartInfo = psi
        SelProcess.Start()
  End Sub





Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>