Implement Pdf printing
This commit is contained in:
@ -5,11 +5,13 @@ using PdfSharp.Pdf.IO;
|
||||
using PuppeteerSharp;
|
||||
using Elwig.Helpers;
|
||||
using Elwig.Windows;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Elwig.Documents {
|
||||
public static class Pdf {
|
||||
|
||||
private static readonly string Chromium = @"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe";
|
||||
private static readonly string PdfToPrinter = App.ExePath + "PDFtoPrinter.exe";
|
||||
private static IBrowser? Browser = null;
|
||||
public static bool IsReady => Browser != null;
|
||||
|
||||
@ -73,8 +75,12 @@ namespace Elwig.Documents {
|
||||
});
|
||||
}
|
||||
|
||||
public static void Print(string path) {
|
||||
// TODO print pdf
|
||||
public static async Task Print(string path, int copies = 1) {
|
||||
var p = new Process() { StartInfo = new() { FileName = PdfToPrinter } };
|
||||
p.StartInfo.ArgumentList.Add(path);
|
||||
p.StartInfo.ArgumentList.Add($"copies={copies}");
|
||||
p.Start();
|
||||
await p.WaitForExitAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user