/// <summary> /// Launches a print job for all dropped files that can be printed. /// Return false if cancelled because of unprintable files /// </summary> private void PrintPrintableFiles(IList <string> printFiles) { if (!_printFileHelper.AddFiles(printFiles)) { return; } _storedParametersManager.SaveParameterSettings("", "", printFiles.FirstOrDefault()); _printFileHelper.PrintAll(); }
public override ExitCode Run() { _logger.Info("Launched printjob with PrintFile command."); if (string.IsNullOrEmpty(PrintFile)) { _logger.Error("PrintFile Parameter has no argument"); return(ExitCode.PrintFileParameterHasNoArgument); } if (!File.Exists(PrintFile)) { _logger.Error("The file \"{0}\" does not exist!", PrintFile); return(ExitCode.PrintFileDoesNotExist); } _settingsManager.LoadAllSettings(); _printFileHelper.PdfCreatorPrinter = GetValidPrinterName(); if (!_printFileHelper.AddFile(PrintFile)) { _logger.Warn("The file \"{0}\" is not printable!", PrintFile); return(ExitCode.PrintFileNotPrintable); } //todo: Test // Ignore Profile if Printer is set. // After the printing we can't determine if the printer was selected by the user or was the primary printer var profile = ""; if (string.IsNullOrWhiteSpace(AppStartParameters.Printer)) { profile = AppStartParameters.Profile; } _storedParametersManager.SaveParameterSettings(AppStartParameters.OutputFile, profile, PrintFile); if (!_printFileHelper.PrintAll()) { _logger.Error("The file \"{0}\" could not be printed!", PrintFile); return(ExitCode.PrintFileCouldNotBePrinted); } return(ExitCode.Ok); }