Skip to content

Commit

Permalink
Merge pull request #3 from RepairShopr/fix-print
Browse files Browse the repository at this point in the history
Fix printing of several copies.
  • Loading branch information
yuske authored Aug 15, 2018
2 parents 82d9ecd + b81e979 commit 06e369c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions AutoPrintr/AssemblyVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("2.0.23.0")]
[assembly: AssemblyFileVersion("2.0.23.0")]
[assembly: AssemblyVersion("2.0.24.0")]
[assembly: AssemblyFileVersion("2.0.24.0")]
11 changes: 8 additions & 3 deletions AutoPrintr/AutoPrintr.Service/Services/PrinterService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.IO;
using System.Linq;
using System.Printing;
using System.Threading;
using System.Threading.Tasks;

namespace AutoPrintr.Service.Services
Expand Down Expand Up @@ -65,7 +66,7 @@ await Task.Factory.StartNew(() =>
throw new InvalidOperationException("LocalFilePath is required");

var processPath = ExtractSumatraPDF();
var arguments = $"-silent -print-settings \"noscale,{printer.PrintMode.ToString().ToLower()},{count}x\" -exit-on-print -print-to \"{printer.Name}\" \"{_fileService.GetFilePath(document.LocalFilePath)}\"";
var arguments = $"-silent -print-settings \"noscale,{printer.PrintMode.ToString().ToLower()},1x\" -exit-on-print -print-to \"{printer.Name}\" \"{_fileService.GetFilePath(document.LocalFilePath)}\"";

_loggingService.WriteInformation($"Printing command: {arguments}");

Expand All @@ -82,8 +83,12 @@ await Task.Factory.StartNew(() =>
CreateNoWindow = true
};

var process = Process.Start(psi);
process.WaitForExit();
for (int i = 0; i < count; i++)
{
var process = Process.Start(psi);
process.WaitForExit();
Thread.Sleep(500);
}
}
catch (Exception ex)
{
Expand Down

0 comments on commit 06e369c

Please sign in to comment.