diff --git a/Elwig/Documents/Document.cshtml b/Elwig/Documents/Document.cshtml
index f518bc0..bfac449 100644
--- a/Elwig/Documents/Document.cshtml
+++ b/Elwig/Documents/Document.cshtml
@@ -9,6 +9,16 @@
+ @if (Model.DoubleSided) {
+
+ }
@if (Model.ShowFoldMarks) {
@@ -27,6 +37,16 @@
+ @if (Model.DoubleSided) {
+
+ }
diff --git a/Elwig/Documents/Document.cshtml.cs b/Elwig/Documents/Document.cshtml.cs
index 0033037..e826769 100644
--- a/Elwig/Documents/Document.cshtml.cs
+++ b/Elwig/Documents/Document.cshtml.cs
@@ -11,6 +11,7 @@ namespace Elwig.Documents {
private TempFile? _pdfFile = null;
public bool ShowFoldMarks = App.Config.Debug;
+ public bool DoubleSided = false;
public string DataPath;
public int CurrentNextSeason;
@@ -90,7 +91,7 @@ namespace Elwig.Documents {
progress?.Report(50.0 * i / n);
}
progress?.Report(50.0);
- await Pdf.Convert(tmpHtmls.Select(f => f.FileName), pdf.FileName, new Progress(v => progress?.Report(50.0 + v / 2)));
+ await Pdf.Convert(tmpHtmls.Select(f => f.FileName), pdf.FileName, DoubleSided, new Progress(v => progress?.Report(50.0 + v / 2)));
foreach (var tmp in tmpHtmls) {
tmp.Dispose();
}
@@ -100,7 +101,7 @@ namespace Elwig.Documents {
using (var tmpHtml = new TempFile("html")) {
await File.WriteAllTextAsync(tmpHtml.FilePath, await Render(), Utils.UTF8);
progress?.Report(50.0);
- await Pdf.Convert(tmpHtml.FilePath, pdf.FilePath);
+ await Pdf.Convert(tmpHtml.FilePath, pdf.FilePath, DoubleSided);
}
_pdfFile = pdf;
}
diff --git a/Elwig/Documents/Pdf.cs b/Elwig/Documents/Pdf.cs
index 5f466aa..4a5860f 100644
--- a/Elwig/Documents/Pdf.cs
+++ b/Elwig/Documents/Pdf.cs
@@ -21,25 +21,30 @@ namespace Elwig.Documents {
public static async Task Init(Action evtHandler) {
var p = new Process() { StartInfo = new() {
FileName = WinziPrint,
- Arguments = $"-p -e utf-8 -d \"{App.TempPath}\" -",
CreateNoWindow = true,
UseShellExecute = false,
RedirectStandardInput = true,
RedirectStandardOutput = true
} };
+ p.StartInfo.ArgumentList.Add("-p");
+ p.StartInfo.ArgumentList.Add("-e");
+ p.StartInfo.ArgumentList.Add("utf-8");
+ p.StartInfo.ArgumentList.Add("-d");
+ p.StartInfo.ArgumentList.Add(App.TempPath);
+ p.StartInfo.ArgumentList.Add("-");
p.Start();
WinziPrintProc = p;
evtHandler();
}
- public static async Task> Convert(string htmlPath, string pdfPath, IProgress? progress = null) {
- return await Convert(new string[] { htmlPath }, pdfPath, progress);
+ public static async Task> Convert(string htmlPath, string pdfPath, bool doubleSided = false, IProgress? progress = null) {
+ return await Convert(new string[] { htmlPath }, pdfPath, doubleSided, progress);
}
- public static async Task> Convert(IEnumerable htmlPath, string pdfPath, IProgress? progress = null) {
+ public static async Task> Convert(IEnumerable htmlPath, string pdfPath, bool doubleSided = false, IProgress? progress = null) {
if (WinziPrintProc == null) throw new InvalidOperationException("The WinziPrint process has not been initialized yet");
progress?.Report(0.0);
- await WinziPrintProc.StandardInput.WriteLineAsync($"{string.Join(';', htmlPath)};{pdfPath}");
+ await WinziPrintProc.StandardInput.WriteLineAsync((doubleSided ? "-2;" : "") + $"{string.Join(';', htmlPath)};{pdfPath}");
while (true) {
var line = await WinziPrintProc.StandardOutput.ReadLineAsync() ?? throw new IOException("Invalid response from WinziPrint");
if (line.StartsWith("error:")) {
diff --git a/Elwig/Documents/style-page.css b/Elwig/Documents/style-page.css
index 9f8c757..0fb675d 100644
--- a/Elwig/Documents/style-page.css
+++ b/Elwig/Documents/style-page.css
@@ -20,9 +20,6 @@
hr.page-break {
display: none;
}
-.document-break {
- break-before: page;
-}
@page {
size: A4;
diff --git a/Elwig/Documents/style.css b/Elwig/Documents/style.css
index af4c521..2690325 100644
--- a/Elwig/Documents/style.css
+++ b/Elwig/Documents/style.css
@@ -57,6 +57,12 @@ header .type {
.footer-wrapper {
position: running(page-footer);
width: 165mm;
+ /* for some reason the position without the following statement changes on the second page */
+ border: 0.5pt solid #00000000;
+}
+
+.footer-wrapper.left {
+ position: running(page-footer-left);
}
.pre-footer {
@@ -69,16 +75,16 @@ header .type {
width: 33%;
}
-.pre-footer .date {
+.pre-footer > *:first-child {
text-align: left;
}
-.pre-footer .doc-id {
+.pre-footer > *:nth-child(2) {
text-align: center;
font-style: italic;
}
-.pre-footer .page {
+.pre-footer > *:last-child {
text-align: right;
float: right;
}
diff --git a/Elwig/Windows/DeliveryConfirmationsWindow.xaml.cs b/Elwig/Windows/DeliveryConfirmationsWindow.xaml.cs
index 6c5b8fe..c43d211 100644
--- a/Elwig/Windows/DeliveryConfirmationsWindow.xaml.cs
+++ b/Elwig/Windows/DeliveryConfirmationsWindow.xaml.cs
@@ -95,7 +95,12 @@ namespace Elwig.Dialogs {
""")
.ToListAsync();
- using var doc = Document.Merge(list.Select(m => new DeliveryConfirmation(Context, Year, m, deliveries.Where(d => d.Delivery.MgNr == m.MgNr).ToList()))); ;
+ using var doc = Document.Merge(list.Select(m =>
+ new DeliveryConfirmation(Context, Year, m, deliveries.Where(d => d.Delivery.MgNr == m.MgNr).ToList()) {
+ DoubleSided = true
+ }
+ ));
+ doc.DoubleSided = true;
await doc.Generate(new Progress(v => {
ProgressBar.Value = v;
}));