[#15] MailWindow: Add feature to print
This commit is contained in:
@ -49,11 +49,11 @@ namespace Elwig.Helpers.Printing {
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public static async Task<IEnumerable<int>> Convert(string htmlPath, string pdfPath, bool doubleSided = false, IProgress<double>? progress = null) {
|
||||
public static async Task<(int Pages, IEnumerable<int> PerDoc)> Convert(string htmlPath, string pdfPath, bool doubleSided = false, IProgress<double>? progress = null) {
|
||||
return await Convert([htmlPath], pdfPath, doubleSided, progress);
|
||||
}
|
||||
|
||||
public static async Task<IEnumerable<int>> Convert(IEnumerable<string> htmlPath, string pdfPath, bool doubleSided = false, IProgress<double>? progress = null) {
|
||||
public static async Task<(int Pages, IEnumerable<int> PerDoc)> Convert(IEnumerable<string> htmlPath, string pdfPath, bool doubleSided = false, IProgress<double>? progress = null) {
|
||||
if (WinziPrintProc == null) throw new InvalidOperationException("The WinziPrint process has not been initialized yet");
|
||||
progress?.Report(0.0);
|
||||
using var client = new TcpClient("127.0.0.1", 30983);
|
||||
@ -71,8 +71,8 @@ namespace Elwig.Helpers.Printing {
|
||||
var parts = line[9..].Trim().Split('/').Select(int.Parse).ToArray();
|
||||
progress?.Report(100.0 * parts[0] / parts[1]);
|
||||
} else if (line.StartsWith("success:")) {
|
||||
var m = Regex.Match(line, @"\(([0-9, ]+)\)");
|
||||
return m.Groups[1].Value.Split(", ").Select(int.Parse).ToList();
|
||||
var m = Regex.Match(line, @"([0-9]+) pages \(([0-9, ]+)\)");
|
||||
return (int.Parse(m.Groups[1].Value), m.Groups[2].Value.Split(", ").Select(int.Parse).ToList());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user