Printing through Code - InfoPath Dev
in

InfoPath Dev

Printing through Code

Last post 05-20-2008 06:25 AM by mhudsonjr. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 05-19-2008 12:28 PM

    Printing through Code

    Has anyone come across a solution to print from infopath without having to use the default printer?  I know you can use the XDocument.PrintOut(), but i dont want the user to have to keep a certain default printer.  Is there any active x control or anything like that?  Thanks for your replies. 

  • 05-19-2008 01:20 PM In reply to

    I got this from another forum, haven't tested it yet:

     Dim P As Integer
            Dim AvailablePrinters As String
            For P = 0 To System.Drawing.Printing.PrinterSettings. _
              InstalledPrinters.Count - 1
                AvailablePrinters = System.Drawing.Printing.PrinterSettings. _
                  InstalledPrinters.Item(P)
                ListBox1.Items.Add(AvailablePrinters)
            Next

    That code is for pure vb.net , some adaptation i am sure for using in infopath, or totally rewritten debending on what code you are using.  But that should give you the list of installed printers and put in a list box.  then the user can select which one to print to. And maybe something like this:

    PrintDocument1.PrinterSettings.PrinterName = "Printer Name"

    to hard code a particular printer.

    I haven't tested them, but i am curious as well.  I might try it tomorrow at work.

  • 05-20-2008 06:25 AM In reply to

    The problem I have is that our form is using JScript, and so far i have found nothing that will help.  I know the PrintOut uses the default printer.  I am also using some ActiveXObjects to run different applications from my infopath form, and so i was wondering if there was something similar that would help me with the printing issue Infopath has. 

Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.