Document: Add IsPreview to indicate that a document may only be viewed by internal staff
All checks were successful
Test / Run tests (push) Successful in 2m51s
All checks were successful
Test / Run tests (push) Successful in 2m51s
This commit is contained in:
@@ -18,10 +18,11 @@ namespace Elwig.Documents {
|
||||
protected string? _pdfPath;
|
||||
protected string? PdfPath => _pdfPath ?? _pdfFile?.FilePath;
|
||||
public int? TotalPages { get; private set; }
|
||||
public int? Pages => TotalPages / (DoublePaged ? 2 : 1);
|
||||
public int? Pages => TotalPages / (IsDoublePaged ? 2 : 1);
|
||||
|
||||
public bool ShowFoldMarks = App.Config.Debug;
|
||||
public bool DoublePaged = false;
|
||||
public bool IsDoublePaged = false;
|
||||
public bool IsPreview = false;
|
||||
|
||||
public string DocumentsPath;
|
||||
public int CurrentNextSeason;
|
||||
@@ -129,7 +130,7 @@ namespace Elwig.Documents {
|
||||
progress?.Report(GenerationProportion * 100 * i / n);
|
||||
}
|
||||
progress?.Report(GenerationProportion * 100);
|
||||
var pages = await Pdf.Convert(tmpFiles, pdf.FileName, DoublePaged, new Progress<double>(v => progress?.Report(GenerationProportion * 100 + v * (1 - GenerationProportion))));
|
||||
var pages = await Pdf.Convert(tmpFiles, pdf.FileName, IsDoublePaged, new Progress<double>(v => progress?.Report(GenerationProportion * 100 + v * (1 - GenerationProportion))));
|
||||
TotalPages = pages.Pages;
|
||||
foreach (var tmp in tmpHtmls) {
|
||||
tmp.Dispose();
|
||||
@@ -140,7 +141,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, DoublePaged);
|
||||
var pages = await Pdf.Convert(tmpHtml.FilePath, pdf.FilePath, IsDoublePaged);
|
||||
TotalPages = pages.Pages;
|
||||
}
|
||||
_pdfFile = pdf;
|
||||
@@ -155,7 +156,7 @@ namespace Elwig.Documents {
|
||||
|
||||
public async Task Print(int copies = 1) {
|
||||
if (PdfPath == null) throw new InvalidOperationException("Pdf file has not been generated yet");
|
||||
await Pdf.Print(PdfPath, copies, DoublePaged);
|
||||
await Pdf.Print(PdfPath, copies, IsDoublePaged);
|
||||
}
|
||||
|
||||
public void Show() {
|
||||
|
||||
Reference in New Issue
Block a user