0

I'm using vb to get printer settings, pdf location, and pdf name. Then send them to a c# dll that then uses the file.copy to print the document(s). The issue I'm having is when someone has a printer on their local(usually plugged in) and on the network. I was wondering if there was a way to have the copy differentiate between the printers and pick the one plugged in over the network when the name's match?

c# code

    public void PrintFromFile(string fileLocation, string fileName, System.Drawing.Printing.PrinterSettings printerSettings)
    {
        System.IO.File.Copy(fileLocation + fileName, printerSettings.PrinterName);
    }
  • There should be [more possibilities](https://stackoverflow.com/q/17448465/1997232) to print pdf. Have you tried anything else? – Sinatr Dec 19 '17 at 14:09
  • I was using hiqpdf, but that required purchasing. This works every time as long as there isn't two of the same printers for it to chose from. I get the error : "Error during EmailReport. The file 'PRINTER'S NAME (redirected 2)' already exists." – jigglymig TheMighty Dec 19 '17 at 14:25
  • I ended up using spire after a few failed attempts and canning a few that had license after. Spire.Pdf.PdfDocument doc = new Spire.Pdf.PdfDocument(); doc.LoadFromFile(fileLocation + docName); doc.PrintSettings.PrinterName = printerSettings.PrinterName; doc.Print(); – jigglymig TheMighty Dec 20 '17 at 15:02

0 Answers0