Printing: Replace WinziPrint with iText
Some checks failed
Test / Run tests (push) Failing after 2m18s

This commit is contained in:
2026-02-18 23:00:21 +01:00
parent 4cd7ef85a1
commit a6e04ab1d2
17 changed files with 341 additions and 234 deletions

View File

@@ -31,7 +31,6 @@ namespace Elwig.Documents {
public string Title;
public string Author;
public string Header;
public string Footer;
public DateOnly Date;
public Document(string title) {
@@ -41,7 +40,6 @@ namespace Elwig.Documents {
Title = title;
Author = c.NameFull;
Header = "";
Footer = Utils.GenerateFooter("<br/>", " \u00b7 ").Item(c.NameFull).ToString();
Date = DateOnly.FromDateTime(Utils.Today);
}
@@ -122,12 +120,12 @@ namespace Elwig.Documents {
var tmpHtml = new TempFile("html");
await File.WriteAllTextAsync(tmpHtml.FilePath, await doc.Render(), Utils.UTF8);
tmpHtmls.Add(tmpHtml);
tmpFiles.Add((doc is Letterhead ? "#" : "") + tmpHtml.FileName);
tmpFiles.Add((doc is Letterhead ? "#" : "") + tmpHtml.FilePath);
i++;
progress?.Report(GenerationProportion * 100 * i / n);
}
progress?.Report(GenerationProportion * 100);
var pages = await Pdf.Convert(tmpFiles, pdf.FileName, IsDoublePaged, cancelToken, new Progress<double>(v => progress?.Report(GenerationProportion * 100 + v * (1 - GenerationProportion))));
var pages = Pdf.Convert(tmpFiles, pdf.FilePath, IsDoublePaged, m.Documents, cancelToken, new Progress<double>(v => progress?.Report(GenerationProportion * 100 + v * (1 - GenerationProportion))));
TotalPages = pages.Pages;
_pdfFile = pdf;
} catch {
@@ -146,7 +144,7 @@ namespace Elwig.Documents {
using var tmpHtml = new TempFile("html");
await File.WriteAllTextAsync(tmpHtml.FilePath, await Render(), Utils.UTF8);
progress?.Report(50.0);
var pages = await Pdf.Convert(tmpHtml.FilePath, pdf.FilePath, IsDoublePaged, cancelToken);
var pages = Pdf.Convert(tmpHtml.FilePath, pdf.FilePath, this);
TotalPages = pages.Pages;
_pdfFile = pdf;
} catch {