Order printing of random file types from VB.Net

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Here's the setup:
- Windows Forms app that needs to print a set of files in a specific order
- Files will mostly be Word docs and PDF docs, but could also be TIF, Excel,
etc...
- The files need to come out of the printer in the order that they are sent
to the printer (Word, Word, pdf, pdf, pdf, Word, pdf, Word, etc...) because
there are a lot of them and we don't want users to collate them.
- We don't want the user to have to do anything other than click a button
that says "Print". Although, if they could initially choose a printer (as
opposed to the default printer), that would be great.

Any ideas on how this might be accomplished? I've tried using various
implementations of the Process class, but in every case, all the Word docs
come out of the printer first, then the pdf files.

Thanks in advance!
 
I´ve noticed you can print doc and pdf files. I´m trying to do the same . At
this moment I can print docs with an OLE componet of MSWord, but I don´t know
how to do it with pdf. I will really appreciate if you could send some
example code on how to do this and some information about Process clas you´re
using. I can handle the installed printers and select the active one to
print. Here´s some code. Sorry for the spanish.

Thanks.

using System.Drawing.Printing;
using MSWord = Word; //Include a reference for Microsoft.Office.Core from
COM references

....

MSWord.ApplicationClass managerDocument = new MSWord.ApplicationClass();

....

/// <summary>
/// Returns an array with the installed printers
/// </summary>
/// <returns></returns>
public string[] ImpresorasInstaladas()
{
string[] impresoras = new string[10]; //Revizar esto !!!

try
{
for (int i = 0; i < PrinterSettings.InstalledPrinters.Count; i++)
impresoras = PrinterSettings.InstalledPrinters;

return impresoras;
}
catch (Exception ex)
{
throw ex;
}
}

/// <summary>
/// Selects the printer to print from the list of the installed printers
/// </summary>
/// <param name="impresoras">Arreglo de impresoras instaladas</param>
/// <param name="i">El índice del arreglo de impresoras instaladas</param>
public void SeleccionarImpresora(string[] impresoras, int i)
{
managerDocument.ActivePrinter = impresoras;
}

.....
 
Back
Top