Document: Add GenerationProportion and set to 1/8

This commit is contained in:
2024-01-07 15:21:53 +01:00
parent 5e665ffb50
commit 9f73d13dbf
2 changed files with 12 additions and 8 deletions

View File

@ -11,6 +11,8 @@ namespace Elwig.Documents {
public static string Name => "Dokument";
private static readonly double GenerationProportion = 0.125;
private TempFile? _pdfFile = null;
public bool ShowFoldMarks = App.Config.Debug;
@ -95,10 +97,10 @@ namespace Elwig.Documents {
await File.WriteAllTextAsync(tmpHtml.FilePath, await doc.Render(), Utils.UTF8);
tmpHtmls.Add(tmpHtml);
i++;
progress?.Report(25.0 * i / n);
progress?.Report(GenerationProportion * i / n);
}
progress?.Report(25.0);
await Pdf.Convert(tmpHtmls.Select(f => f.FileName), pdf.FileName, DoubleSided, new Progress<double>(v => progress?.Report(25.0 + v * 0.75)));
progress?.Report(GenerationProportion);
await Pdf.Convert(tmpHtmls.Select(f => f.FileName), pdf.FileName, DoubleSided, new Progress<double>(v => progress?.Report(GenerationProportion + v * (1 - GenerationProportion))));
foreach (var tmp in tmpHtmls) {
tmp.Dispose();
}