Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a6e04ab1d2 | |||
| 4cd7ef85a1 | |||
| 2c0b000073 | |||
| f1737af2a2 | |||
| 8f423e3e92 | |||
| c8911c0acb | |||
| baf598b76c | |||
| 7adc9f89e4 | |||
| dde808df6a | |||
| e63de0d867 |
36
CHANGELOG.md
36
CHANGELOG.md
@@ -2,6 +2,42 @@
|
|||||||
Changelog
|
Changelog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
[v1.0.3.3][v1.0.3.3] (2026-02-05) {#v1.0.3.3}
|
||||||
|
---------------------------------------------
|
||||||
|
|
||||||
|
### Behobene Fehler {#v1.0.3.3-bugfixes}
|
||||||
|
|
||||||
|
* Hotfix: Probleme beim Drucken seit der Installation von [v1.0.3.0](#v1.0.3.0). (c8911c0acb, 8f423e3e92)
|
||||||
|
|
||||||
|
[v1.0.3.3]: https://git.necronda.net/winzer/elwig/releases/tag/v1.0.3.3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[v1.0.3.2][v1.0.3.2] (2026-02-04) {#v1.0.3.2}
|
||||||
|
---------------------------------------------
|
||||||
|
|
||||||
|
### Behobene Fehler {#v1.0.3.2-bugfixes}
|
||||||
|
|
||||||
|
* Hotfix: Probleme bei der Installation von [v1.0.3.0](#v1.0.3.0). (7adc9f89e4)
|
||||||
|
|
||||||
|
[v1.0.3.2]: https://git.necronda.net/winzer/elwig/releases/tag/v1.0.3.2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[v1.0.3.1][v1.0.3.1] (2026-01-19) {#v1.0.3.1}
|
||||||
|
---------------------------------------------
|
||||||
|
|
||||||
|
### Behobene Fehler {#v1.0.3.1-bugfixes}
|
||||||
|
|
||||||
|
* Hotfix: Probleme bei der Installation von [v1.0.3.0](#v1.0.3.0). (e63de0d867)
|
||||||
|
|
||||||
|
[v1.0.3.1]: https://git.necronda.net/winzer/elwig/releases/tag/v1.0.3.1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[v1.0.3.0][v1.0.3.0] (2026-01-16) {#v1.0.3.0}
|
[v1.0.3.0][v1.0.3.0] (2026-01-16) {#v1.0.3.0}
|
||||||
---------------------------------------------
|
---------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -21,14 +21,6 @@ namespace Elwig.Documents {
|
|||||||
IncludeSender = includeSender;
|
IncludeSender = includeSender;
|
||||||
var c = App.Client;
|
var c = App.Client;
|
||||||
Header = $"<div class='name'>{c.Name}</div><div class='suffix'>{c.NameSuffix}</div><div class='type'>{c.NameTypeFull}</div>";
|
Header = $"<div class='name'>{c.Name}</div><div class='suffix'>{c.NameSuffix}</div><div class='type'>{c.NameTypeFull}</div>";
|
||||||
Footer = Utils.GenerateFooter("<br/>", " \u00b7 ")
|
|
||||||
.Item(c.NameFull).NextLine()
|
|
||||||
.Item(c.Address).Item($"{c.Plz} {c.Ort}").Item("Österreich").Item("Tel.", c.PhoneNr).Item("Fax", c.FaxNr).NextLine()
|
|
||||||
.Item(c.EmailAddress != null ? $"<a href=\"mailto:{c.Name} {c.NameSuffix} <{c.EmailAddress}>\">{c.EmailAddress}</a>" : null)
|
|
||||||
.Item(c.Website != null ? $"<a href=\"http://{c.Website}/\">{c.Website}</a>" : null)
|
|
||||||
.Item("Betriebs-Nr.", c.LfbisNr).Item("Bio-KSt.", c.OrganicAuthority).NextLine()
|
|
||||||
.Item("UID", c.UstIdNr).Item("BIC", c.Bic).Item("IBAN", c.Iban)
|
|
||||||
.ToString();
|
|
||||||
var uid = (m.UstIdNr ?? "-") + (m.IsBuchführend ? "" : " <i>(pauschaliert)</i>");
|
var uid = (m.UstIdNr ?? "-") + (m.IsBuchführend ? "" : " <i>(pauschaliert)</i>");
|
||||||
Aside = $"<table><colgroup><col span='1' style='width: 22.5mm;'/><col span='1' style='width: 42.5mm;'/></colgroup>" +
|
Aside = $"<table><colgroup><col span='1' style='width: 22.5mm;'/><col span='1' style='width: 42.5mm;'/></colgroup>" +
|
||||||
$"<thead><tr><th colspan='2'>Mitglied</th></tr></thead><tbody>" +
|
$"<thead><tr><th colspan='2'>Mitglied</th></tr></thead><tbody>" +
|
||||||
|
|||||||
@@ -1,19 +1,4 @@
|
|||||||
|
|
||||||
.m1, .m2, .m3 {
|
|
||||||
height: 0;
|
|
||||||
width: 10mm;
|
|
||||||
position: fixed;
|
|
||||||
left: -25mm;
|
|
||||||
border-top: var(--border-thickness) solid black;
|
|
||||||
}
|
|
||||||
.m1.r, .m2.r, .m3.r {
|
|
||||||
left: initial;
|
|
||||||
right: -20mm;
|
|
||||||
}
|
|
||||||
.m1 {top: 80mm;}
|
|
||||||
.m2 {top: 123.5mm;}
|
|
||||||
.m3 {top: 185mm;}
|
|
||||||
|
|
||||||
.page-break {
|
.page-break {
|
||||||
break-before: page;
|
break-before: page;
|
||||||
}
|
}
|
||||||
@@ -23,15 +8,15 @@ hr.page-break {
|
|||||||
|
|
||||||
@page {
|
@page {
|
||||||
size: A4;
|
size: A4;
|
||||||
margin: 25mm 20mm 35mm 25mm;
|
margin: 25mm 20mm 25mm 25mm;
|
||||||
|
}
|
||||||
|
|
||||||
@bottom-center {
|
@page :first {
|
||||||
content: element(page-footer);
|
margin: 25mm 20mm 35mm 25mm;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen {
|
@media screen {
|
||||||
body, header, .footer-wrapper {
|
body, header {
|
||||||
width: 210mm;
|
width: 210mm;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,10 +24,6 @@ hr.page-break {
|
|||||||
border: 1px solid lightgray;
|
border: 1px solid lightgray;
|
||||||
}
|
}
|
||||||
|
|
||||||
.m1, .m2, .m3 {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
header {
|
header {
|
||||||
top: 0;
|
top: 0;
|
||||||
}
|
}
|
||||||
@@ -54,23 +35,9 @@ hr.page-break {
|
|||||||
.main-wrapper {
|
.main-wrapper {
|
||||||
margin: 0 20mm 40mm 25mm;
|
margin: 0 20mm 40mm 25mm;
|
||||||
}
|
}
|
||||||
|
|
||||||
.footer-wrapper {
|
|
||||||
position: fixed;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
background: white;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media print {
|
a {
|
||||||
.page::after {
|
text-decoration: inherit;
|
||||||
content: "Seite " counter(page) " von " counter(pages) !important;
|
color: inherit;
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
text-decoration: inherit;
|
|
||||||
color: inherit;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
|
|
||||||
main table {
|
main table {
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
margin-bottom: 10mm;
|
margin-bottom: 0mm;
|
||||||
font-size: 10pt;
|
font-size: 10pt;
|
||||||
}
|
}
|
||||||
main table.large {font-size: 12pt;}
|
main table.large {font-size: 12pt;}
|
||||||
main table.tiny {
|
main table.tiny {
|
||||||
font-size: 8pt;
|
font-size: 8pt;
|
||||||
margin-bottom: 5mm;
|
margin-bottom: 0mm;
|
||||||
}
|
}
|
||||||
|
|
||||||
main table.border {
|
main table.border {
|
||||||
@@ -30,7 +30,7 @@ main table.small th,
|
|||||||
main table.small td,
|
main table.small td,
|
||||||
main table.tiny th,
|
main table.tiny th,
|
||||||
main table.tiny td {
|
main table.tiny td {
|
||||||
padding: 0.125mm 0.125mm;
|
padding: 0mm 0.125mm;
|
||||||
}
|
}
|
||||||
|
|
||||||
main table td[rowspan] {
|
main table td[rowspan] {
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ namespace Elwig.Documents {
|
|||||||
public string Title;
|
public string Title;
|
||||||
public string Author;
|
public string Author;
|
||||||
public string Header;
|
public string Header;
|
||||||
public string Footer;
|
|
||||||
public DateOnly Date;
|
public DateOnly Date;
|
||||||
|
|
||||||
public Document(string title) {
|
public Document(string title) {
|
||||||
@@ -41,7 +40,6 @@ namespace Elwig.Documents {
|
|||||||
Title = title;
|
Title = title;
|
||||||
Author = c.NameFull;
|
Author = c.NameFull;
|
||||||
Header = "";
|
Header = "";
|
||||||
Footer = Utils.GenerateFooter("<br/>", " \u00b7 ").Item(c.NameFull).ToString();
|
|
||||||
Date = DateOnly.FromDateTime(Utils.Today);
|
Date = DateOnly.FromDateTime(Utils.Today);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,12 +120,12 @@ namespace Elwig.Documents {
|
|||||||
var tmpHtml = new TempFile("html");
|
var tmpHtml = new TempFile("html");
|
||||||
await File.WriteAllTextAsync(tmpHtml.FilePath, await doc.Render(), Utils.UTF8);
|
await File.WriteAllTextAsync(tmpHtml.FilePath, await doc.Render(), Utils.UTF8);
|
||||||
tmpHtmls.Add(tmpHtml);
|
tmpHtmls.Add(tmpHtml);
|
||||||
tmpFiles.Add((doc is Letterhead ? "#" : "") + tmpHtml.FileName);
|
tmpFiles.Add((doc is Letterhead ? "#" : "") + tmpHtml.FilePath);
|
||||||
i++;
|
i++;
|
||||||
progress?.Report(GenerationProportion * 100 * i / n);
|
progress?.Report(GenerationProportion * 100 * i / n);
|
||||||
}
|
}
|
||||||
progress?.Report(GenerationProportion * 100);
|
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;
|
TotalPages = pages.Pages;
|
||||||
_pdfFile = pdf;
|
_pdfFile = pdf;
|
||||||
} catch {
|
} catch {
|
||||||
@@ -146,7 +144,7 @@ namespace Elwig.Documents {
|
|||||||
using var tmpHtml = new TempFile("html");
|
using var tmpHtml = new TempFile("html");
|
||||||
await File.WriteAllTextAsync(tmpHtml.FilePath, await Render(), Utils.UTF8);
|
await File.WriteAllTextAsync(tmpHtml.FilePath, await Render(), Utils.UTF8);
|
||||||
progress?.Report(50.0);
|
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;
|
TotalPages = pages.Pages;
|
||||||
_pdfFile = pdf;
|
_pdfFile = pdf;
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
@@ -13,41 +13,12 @@
|
|||||||
@if (Model.IsDoublePaged) {
|
@if (Model.IsDoublePaged) {
|
||||||
<style>
|
<style>
|
||||||
@@page :left {
|
@@page :left {
|
||||||
margin: 25mm 25mm 35mm 20mm;
|
margin: 25mm 25mm 25mm 20mm;
|
||||||
@@bottom-center {
|
|
||||||
content: element(page-footer-left);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
}
|
}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@if (Model.ShowFoldMarks) {
|
|
||||||
<div class="m1"></div>
|
|
||||||
<div class="m2"></div>
|
|
||||||
<div class="m3"></div>
|
|
||||||
<div class="m1 r"></div>
|
|
||||||
<div class="m2 r"></div>
|
|
||||||
<div class="m3 r"></div>
|
|
||||||
}
|
|
||||||
<div class="footer-wrapper">
|
|
||||||
<div class="pre-footer">
|
|
||||||
<span class="date">@($"{Model.Date:dddd, d. MMMM yyyy}")</span>
|
|
||||||
<span class="doc-id">@Model.DocumentId</span>
|
|
||||||
<span><span class="page"></span>@Raw(Model.IsPreview ? " <b>(vorläufig)</b>" : "")</span>
|
|
||||||
</div>
|
|
||||||
<footer>@Raw(Model.Footer)</footer>
|
|
||||||
</div>
|
|
||||||
@if (Model.IsDoublePaged) {
|
|
||||||
<div class="footer-wrapper left">
|
|
||||||
<div class="pre-footer">
|
|
||||||
<span>@Raw(Model.IsPreview ? "<b>(vorläufig)</b> " : "")<span class="page"></span></span>
|
|
||||||
<span class="doc-id">@Model.DocumentId</span>
|
|
||||||
<span class="date">@($"{Model.Date:dddd, d. MMMM yyyy}")</span>
|
|
||||||
</div>
|
|
||||||
<footer>@Raw(Model.Footer)</footer>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
<header>@Raw(Model.Header)</header>
|
<header>@Raw(Model.Header)</header>
|
||||||
<div class="spacing"></div>
|
<div class="spacing"></div>
|
||||||
<div class="main-wrapper">
|
<div class="main-wrapper">
|
||||||
|
|||||||
@@ -55,53 +55,6 @@ header .type {
|
|||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
.footer-wrapper {
|
|
||||||
position: running(page-footer);
|
|
||||||
width: 165mm;
|
|
||||||
/* for some reason the position without the following statement changes on the second page */
|
|
||||||
border: var(--border-thickness) solid #00000000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer-wrapper.left {
|
|
||||||
position: running(page-footer-left);
|
|
||||||
}
|
|
||||||
|
|
||||||
.pre-footer {
|
|
||||||
margin: 1em 0;
|
|
||||||
font-size: 10pt;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pre-footer > * {
|
|
||||||
display: inline-block;
|
|
||||||
width: 33%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pre-footer > *:first-child {
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pre-footer > *:nth-child(2) {
|
|
||||||
text-align: center;
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pre-footer > *:last-child {
|
|
||||||
text-align: right;
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pre-footer .page::after {
|
|
||||||
content: "Seite 1 von 1";
|
|
||||||
}
|
|
||||||
|
|
||||||
footer {
|
|
||||||
font-size: 10pt;
|
|
||||||
border-top: var(--border-thickness) solid black;
|
|
||||||
height: 25mm;
|
|
||||||
padding-top: 1mm;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hidden {
|
.hidden {
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -166,7 +166,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@if (areaComs.Count != 0) {
|
@if (areaComs.Count != 0) {
|
||||||
<br class="area-commitements"/>
|
|
||||||
<h2>Flächenbindungen per @($"{Model.Date:dd.MM.yyyy}")</h2>
|
<h2>Flächenbindungen per @($"{Model.Date:dd.MM.yyyy}")</h2>
|
||||||
<table class="area-commitements">
|
<table class="area-commitements">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
|
margin-top: 0;
|
||||||
margin-bottom: 0.5em !important;
|
margin-bottom: 0.5em !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,9 +23,3 @@ table.area-commitements td.text {
|
|||||||
table.area-commitements tr.sum {
|
table.area-commitements tr.sum {
|
||||||
font-size: 12pt;
|
font-size: 12pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@page :not(:first) {
|
|
||||||
br.area-commitements {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -3,11 +3,13 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>net10.0-windows</TargetFramework>
|
<TargetFramework>net10.0-windows</TargetFramework>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<UseWPF>true</UseWPF>
|
<UseWPF>true</UseWPF>
|
||||||
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
<PreserveCompilationContext>true</PreserveCompilationContext>
|
<PreserveCompilationContext>true</PreserveCompilationContext>
|
||||||
<ApplicationIcon>Resources\Images\Elwig.ico</ApplicationIcon>
|
<ApplicationIcon>Resources\Images\Elwig.ico</ApplicationIcon>
|
||||||
<Version>1.0.3.0</Version>
|
<Version>1.0.3.3</Version>
|
||||||
<SatelliteResourceLanguages>de-AT</SatelliteResourceLanguages>
|
<SatelliteResourceLanguages>de-AT</SatelliteResourceLanguages>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
@@ -21,7 +23,11 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="bblanchon.PDFium.Win32" Version="147.0.7690" />
|
||||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||||
|
<PackageReference Include="itext" Version="9.5.0" />
|
||||||
|
<PackageReference Include="itext.bouncy-castle-adapter" Version="9.5.0" />
|
||||||
|
<PackageReference Include="itext.pdfhtml" Version="6.3.1" />
|
||||||
<PackageReference Include="LinqKit" Version="1.3.9" />
|
<PackageReference Include="LinqKit" Version="1.3.9" />
|
||||||
<PackageReference Include="MailKit" Version="4.14.1" />
|
<PackageReference Include="MailKit" Version="4.14.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="6.0.36" />
|
<PackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="6.0.36" />
|
||||||
@@ -30,15 +36,12 @@
|
|||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Ini" Version="10.0.2" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Ini" Version="10.0.2" />
|
||||||
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.3650.58" />
|
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.3650.58" />
|
||||||
<PackageReference Include="NJsonSchema" Version="11.5.2" />
|
<PackageReference Include="NJsonSchema" Version="11.5.2" />
|
||||||
<PackageReference Include="PdfiumViewer" Version="2.13.0" />
|
|
||||||
<PackageReference Include="PdfiumViewer.Native.x86_64.no_v8-no_xfa" Version="2018.4.8.256" />
|
|
||||||
<PackageReference Include="RazorLight" Version="2.3.1" />
|
<PackageReference Include="RazorLight" Version="2.3.1" />
|
||||||
<PackageReference Include="ScottPlot.WPF" Version="5.1.57" />
|
<PackageReference Include="ScottPlot.WPF" Version="5.1.57" />
|
||||||
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="3.0.2" />
|
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="3.0.2" />
|
||||||
<PackageReference Include="System.IO.Hashing" Version="10.0.2" />
|
<PackageReference Include="System.IO.Hashing" Version="10.0.2" />
|
||||||
<PackageReference Include="System.IO.Ports" Version="10.0.2" />
|
<PackageReference Include="System.IO.Ports" Version="10.0.2" />
|
||||||
<PackageReference Include="System.Management" Version="10.0.2" />
|
<PackageReference Include="System.Management" Version="10.0.2" />
|
||||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="10.0.2" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
176
Elwig/Helpers/Printing/FooterEventHandler.cs
Normal file
176
Elwig/Helpers/Printing/FooterEventHandler.cs
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
using Elwig.Documents;
|
||||||
|
using iText.IO.Font.Constants;
|
||||||
|
using iText.Kernel.Font;
|
||||||
|
using iText.Kernel.Geom;
|
||||||
|
using iText.Kernel.Pdf;
|
||||||
|
using iText.Kernel.Pdf.Action;
|
||||||
|
using iText.Kernel.Pdf.Canvas;
|
||||||
|
using iText.Kernel.Pdf.Event;
|
||||||
|
using iText.Kernel.Pdf.Xobject;
|
||||||
|
using iText.Layout;
|
||||||
|
using iText.Layout.Borders;
|
||||||
|
using iText.Layout.Element;
|
||||||
|
using iText.Layout.Properties;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Elwig.Helpers.Printing {
|
||||||
|
public class FooterEventHandler : AbstractPdfDocumentEventHandler {
|
||||||
|
|
||||||
|
private const float _fontSize = 10;
|
||||||
|
private const float _ptInMm = 2.8346456693f;
|
||||||
|
private const float _placeholderWidth = 50 * _ptInMm;
|
||||||
|
|
||||||
|
private readonly string _date;
|
||||||
|
private readonly string? _center;
|
||||||
|
private readonly bool _doublePaged;
|
||||||
|
private readonly bool _isPreview;
|
||||||
|
private readonly bool _isBusiness;
|
||||||
|
private readonly bool _showFoldMarks;
|
||||||
|
private readonly PdfFont _font;
|
||||||
|
private readonly PdfFont _fontBold;
|
||||||
|
private readonly PdfFont _fontItalic;
|
||||||
|
|
||||||
|
private readonly List<PdfFormXObject> _pageNumPlaceholders;
|
||||||
|
|
||||||
|
public int NumberOfPages { get; private set; }
|
||||||
|
|
||||||
|
public FooterEventHandler(Documents.Document? doc = null) {
|
||||||
|
_date = $"{doc?.Date ?? DateOnly.FromDateTime(Utils.Today):dddd, d. MMMM yyyy}";
|
||||||
|
_center = doc?.DocumentId;
|
||||||
|
_doublePaged = doc?.IsDoublePaged ?? false;
|
||||||
|
_isPreview = doc?.IsPreview ?? false;
|
||||||
|
_isBusiness = doc is BusinessDocument;
|
||||||
|
_showFoldMarks = doc?.ShowFoldMarks ?? false;
|
||||||
|
_font = PdfFontFactory.CreateFont(StandardFonts.TIMES_ROMAN);
|
||||||
|
_fontBold = PdfFontFactory.CreateFont(StandardFonts.TIMES_BOLD);
|
||||||
|
_fontItalic = PdfFontFactory.CreateFont(StandardFonts.TIMES_ITALIC);
|
||||||
|
_pageNumPlaceholders = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAcceptedEvent(AbstractPdfDocumentEvent evt) {
|
||||||
|
if (evt.GetType() == PdfDocumentEvent.END_PAGE) {
|
||||||
|
OnPageEnd((PdfDocumentEvent)evt);
|
||||||
|
} else if (evt.GetType() == PdfDocumentEvent.START_DOCUMENT_CLOSING) {
|
||||||
|
OnDocumentClose((PdfDocumentEvent)evt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnPageEnd(PdfDocumentEvent evt) {
|
||||||
|
var pdf = evt.GetDocument();
|
||||||
|
var page = evt.GetPage();
|
||||||
|
var pageNum = pdf.GetPageNumber(page);
|
||||||
|
|
||||||
|
var pageSize = page.GetPageSize();
|
||||||
|
float leftX1 = pageSize.GetLeft() + 25 * _ptInMm;
|
||||||
|
float leftX2 = pageSize.GetLeft() + 20 * _ptInMm;
|
||||||
|
float rightX1 = pageSize.GetRight() - 20 * _ptInMm;
|
||||||
|
float rightX2 = pageSize.GetRight() - 25 * _ptInMm;
|
||||||
|
float footerY = pageSize.GetBottom() + 25 * _ptInMm;
|
||||||
|
float y = footerY + _fontSize;
|
||||||
|
float footerWidth = 165 * _ptInMm;
|
||||||
|
float footerHeight = 25 * _ptInMm;
|
||||||
|
|
||||||
|
var pdfCanvas = new PdfCanvas(page.NewContentStreamAfter(), page.GetResources(), pdf);
|
||||||
|
using var canvas = new Canvas(pdfCanvas, pageSize);
|
||||||
|
|
||||||
|
var placeholder = new PdfFormXObject(new Rectangle(0, 0, _placeholderWidth, _fontSize));
|
||||||
|
_pageNumPlaceholders.Add(placeholder);
|
||||||
|
|
||||||
|
var c = App.Client;
|
||||||
|
var dateP = new Paragraph(_date).SetFont(_font).SetFontSize(_fontSize);
|
||||||
|
var centerP = new Paragraph(_center ?? "").SetFont(_fontItalic).SetFontSize(_fontSize);
|
||||||
|
var pageNumP = new Paragraph().Add(new Image(placeholder)).SetFont(_font).SetFontSize(_fontSize);
|
||||||
|
|
||||||
|
if (pageNum == 1) {
|
||||||
|
// First page
|
||||||
|
canvas.ShowTextAligned(dateP, leftX1, y, TextAlignment.LEFT);
|
||||||
|
canvas.ShowTextAligned(centerP, (leftX1 + rightX1) / 2, y, TextAlignment.CENTER);
|
||||||
|
canvas.ShowTextAligned(pageNumP, rightX1, y, TextAlignment.RIGHT);
|
||||||
|
|
||||||
|
var footerP = new Paragraph().SetFont(_font).SetFontSize(_fontSize)
|
||||||
|
.SetTextAlignment(TextAlignment.CENTER).SetVerticalAlignment(VerticalAlignment.TOP)
|
||||||
|
.SetMargin(0).SetMultipliedLeading(1)
|
||||||
|
.SetWidth(footerWidth).SetHeight(footerHeight).SetPaddingTop(1 * _ptInMm).SetBorderTop(new SolidBorder(0.5f))
|
||||||
|
.Add(c.NameFull);
|
||||||
|
if (_isBusiness) {
|
||||||
|
footerP.Add("\n");
|
||||||
|
footerP.AddAll(Utils.GenerateFooter("\n", " \u00b7 ")
|
||||||
|
.Item(c.Address).Item($"{c.Plz} {c.Ort}").Item("Österreich").Item("Tel.", c.PhoneNr).Item("Fax", c.FaxNr).NextLine()
|
||||||
|
.Item(c.EmailAddress != null ? new Link(c.EmailAddress, PdfAction.CreateURI($"mailto:{Uri.EscapeDataString(c.Name)}%20<{c.EmailAddress}>")) : null)
|
||||||
|
.Item(c.Website != null ? new Link(c.Website, PdfAction.CreateURI($"http://{c.Website}/")) : null)
|
||||||
|
.Item("Betriebs-Nr.", c.LfbisNr).Item("Bio-KSt.", c.OrganicAuthority).NextLine()
|
||||||
|
.Item("UID", c.UstIdNr).Item("BIC", c.Bic).Item("IBAN", c.Iban)
|
||||||
|
.ToLeafElements());
|
||||||
|
}
|
||||||
|
// FIXME links are drawn on next page - move footer into "normal" document creation
|
||||||
|
canvas.ShowTextAligned(footerP, (leftX1 + rightX1) / 2, footerY, TextAlignment.CENTER, VerticalAlignment.TOP);
|
||||||
|
} else if (_doublePaged && (pageNum % 2 == 0)) {
|
||||||
|
// Swap side
|
||||||
|
canvas.ShowTextAligned(pageNumP, leftX2, footerY, TextAlignment.LEFT, VerticalAlignment.TOP);
|
||||||
|
canvas.ShowTextAligned(centerP, (leftX2 + rightX2) / 2, footerY, TextAlignment.CENTER, VerticalAlignment.TOP);
|
||||||
|
canvas.ShowTextAligned(dateP, rightX2, footerY, TextAlignment.RIGHT, VerticalAlignment.TOP);
|
||||||
|
} else {
|
||||||
|
canvas.ShowTextAligned(dateP, leftX1, footerY, TextAlignment.LEFT, VerticalAlignment.TOP);
|
||||||
|
canvas.ShowTextAligned(centerP, (leftX1 + rightX1) / 2, footerY, TextAlignment.CENTER, VerticalAlignment.TOP);
|
||||||
|
canvas.ShowTextAligned(pageNumP, rightX1, footerY, TextAlignment.RIGHT, VerticalAlignment.TOP);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_showFoldMarks) {
|
||||||
|
var m1 = pageSize.GetTop() - 105 * _ptInMm;
|
||||||
|
var m2 = pageSize.GetTop() - 148.5 * _ptInMm;
|
||||||
|
var m3 = pageSize.GetTop() - 210 * _ptInMm;
|
||||||
|
pdfCanvas.SetLineWidth(0.5f);
|
||||||
|
|
||||||
|
pdfCanvas.MoveTo(0, m1);
|
||||||
|
pdfCanvas.LineTo(10 * _ptInMm, m1);
|
||||||
|
pdfCanvas.MoveTo(pageSize.GetRight(), m1);
|
||||||
|
pdfCanvas.LineTo(pageSize.GetRight() - 10 * _ptInMm, m1);
|
||||||
|
|
||||||
|
pdfCanvas.MoveTo(0, m2);
|
||||||
|
pdfCanvas.LineTo(7 * _ptInMm, m2);
|
||||||
|
pdfCanvas.MoveTo(pageSize.GetRight(), m2);
|
||||||
|
pdfCanvas.LineTo(pageSize.GetRight() - 7 * _ptInMm, m2);
|
||||||
|
|
||||||
|
pdfCanvas.MoveTo(0, m3);
|
||||||
|
pdfCanvas.LineTo(10 * _ptInMm, m3);
|
||||||
|
pdfCanvas.MoveTo(pageSize.GetRight(), m3);
|
||||||
|
pdfCanvas.LineTo(pageSize.GetRight() - 10 * _ptInMm, m3);
|
||||||
|
|
||||||
|
pdfCanvas.ClosePathStroke();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NumberOfPages > 0) {
|
||||||
|
// FillPlaceholders() was already called
|
||||||
|
FillPlaceholder(pdf, pageNum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDocumentClose(PdfDocumentEvent evt) {
|
||||||
|
FillPlaceholders(evt.GetDocument());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FillPlaceholders(PdfDocument pdf) {
|
||||||
|
NumberOfPages = pdf.GetNumberOfPages();
|
||||||
|
for (int i = 0; i < _pageNumPlaceholders.Count; i++)
|
||||||
|
FillPlaceholder(pdf, i + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FillPlaceholder(PdfDocument pdf, int pageNum) {
|
||||||
|
var placeholder = _pageNumPlaceholders[pageNum - 1];
|
||||||
|
using var canvas = new Canvas(placeholder, pdf);
|
||||||
|
if (_doublePaged && (pageNum % 2 == 0)) {
|
||||||
|
// swap
|
||||||
|
var p = new Paragraph().SetFont(_font).SetFontSize(_fontSize);
|
||||||
|
if (_isPreview) p.Add(new Text("(vorläufig) ").SetFont(_fontBold));
|
||||||
|
p.Add($"Seite {pageNum:N0} von {NumberOfPages:N0} ");
|
||||||
|
canvas.ShowTextAligned(p, 0, 0, TextAlignment.LEFT);
|
||||||
|
} else {
|
||||||
|
var p = new Paragraph().SetFont(_font).SetFontSize(_fontSize)
|
||||||
|
.Add($"Seite {pageNum:N0} von {NumberOfPages:N0}");
|
||||||
|
if (_isPreview) p.Add(new Text(" (vorläufig)").SetFont(_fontBold));
|
||||||
|
canvas.ShowTextAligned(p, _placeholderWidth, 0, TextAlignment.RIGHT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,14 +14,23 @@ namespace Elwig.Helpers.Printing {
|
|||||||
.UseMemoryCachingProvider()
|
.UseMemoryCachingProvider()
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
await Task.Delay(500);
|
||||||
|
|
||||||
await e.CompileTemplateAsync("Document");
|
await e.CompileTemplateAsync("Document");
|
||||||
await e.CompileTemplateAsync("BusinessDocument");
|
await e.CompileTemplateAsync("BusinessDocument");
|
||||||
await e.CompileTemplateAsync("BusinessLetter");
|
await e.CompileTemplateAsync("BusinessLetter");
|
||||||
await e.CompileTemplateAsync("DeliveryNote");
|
|
||||||
await e.CompileTemplateAsync("CreditNote");
|
await e.CompileTemplateAsync("CreditNote");
|
||||||
await e.CompileTemplateAsync("DeliveryJournal");
|
await e.CompileTemplateAsync("DeliveryAncmtList");
|
||||||
await e.CompileTemplateAsync("Letterhead");
|
|
||||||
await e.CompileTemplateAsync("DeliveryConfirmation");
|
await e.CompileTemplateAsync("DeliveryConfirmation");
|
||||||
|
await e.CompileTemplateAsync("DeliveryDepreciationList");
|
||||||
|
await e.CompileTemplateAsync("DeliveryJournal");
|
||||||
|
await e.CompileTemplateAsync("DeliveryNote");
|
||||||
|
await e.CompileTemplateAsync("Letterhead");
|
||||||
|
await e.CompileTemplateAsync("MemberDataSheet");
|
||||||
|
await e.CompileTemplateAsync("MemberList");
|
||||||
|
await e.CompileTemplateAsync("PaymentVariantSummary");
|
||||||
|
await e.CompileTemplateAsync("WineQualityStatistics");
|
||||||
|
|
||||||
Engine = e;
|
Engine = e;
|
||||||
evtHandler?.Invoke();
|
evtHandler?.Invoke();
|
||||||
|
|||||||
@@ -1,102 +1,148 @@
|
|||||||
using Elwig.Windows;
|
using Elwig.Windows;
|
||||||
using PdfiumViewer;
|
using iText.Html2pdf;
|
||||||
|
using iText.Kernel.Pdf;
|
||||||
|
using iText.Kernel.Pdf.Event;
|
||||||
|
using iText.Kernel.Utils;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Drawing.Printing;
|
using System.Drawing.Printing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Sockets;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
namespace Elwig.Helpers.Printing {
|
namespace Elwig.Helpers.Printing {
|
||||||
public static class Pdf {
|
public static class Pdf {
|
||||||
|
public static Task Init(Action? evtHandler = null) {
|
||||||
private static readonly string WinziPrint = (Assembly.GetEntryAssembly()?.Location.Contains(@"\bin\") ?? false) ?
|
PdfiumNative.FPDF_InitLibrary();
|
||||||
Path.Combine(Assembly.GetEntryAssembly()!.Location.Split(@"\bin\")[0], "../Installer/Files/WinziPrint.exe") :
|
|
||||||
new string[] { App.InstallPath }
|
|
||||||
.Union(Environment.GetEnvironmentVariable("PATH")?.Split(';') ?? [])
|
|
||||||
.Select(x => Path.Combine(x, "WinziPrint.exe"))
|
|
||||||
.Where(File.Exists)
|
|
||||||
.FirstOrDefault() ?? throw new FileNotFoundException("WiniPrint executable not found");
|
|
||||||
private static Process? WinziPrintProc;
|
|
||||||
public static bool IsReady => WinziPrintProc != null;
|
|
||||||
|
|
||||||
public static async Task Init(Action? evtHandler = null) {
|
|
||||||
// NOTE: If the WinziPrint daemon is already running this will succeed, but the process will fail.
|
|
||||||
// Should be no problem, as long as the daemon is not closed
|
|
||||||
var p = new Process() { StartInfo = new() {
|
|
||||||
FileName = WinziPrint,
|
|
||||||
CreateNoWindow = true,
|
|
||||||
UseShellExecute = false,
|
|
||||||
RedirectStandardOutput = true,
|
|
||||||
} };
|
|
||||||
p.StartInfo.ArgumentList.Add("-D");
|
|
||||||
p.StartInfo.ArgumentList.Add("-d");
|
|
||||||
p.StartInfo.ArgumentList.Add(App.TempPath);
|
|
||||||
p.Start();
|
|
||||||
await p.StandardOutput.ReadLineAsync();
|
|
||||||
WinziPrintProc = p;
|
|
||||||
evtHandler?.Invoke();
|
evtHandler?.Invoke();
|
||||||
}
|
|
||||||
|
|
||||||
public static Task Cleanup() {
|
|
||||||
WinziPrintProc?.Kill(true);
|
|
||||||
WinziPrintProc?.Close();
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<(int Pages, IEnumerable<int> PerDoc)> Convert(string htmlPath, string pdfPath, bool doublePaged = false, CancellationToken? cancelToken = null, IProgress<double>? progress = null) {
|
public static Task Cleanup() {
|
||||||
return await Convert([htmlPath], pdfPath, doublePaged, cancelToken, progress);
|
PdfiumNative.FPDF_DestroyLibrary();
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<(int Pages, IEnumerable<int> PerDoc)> Convert(IEnumerable<string> htmlPath, string pdfPath, bool doublePaged = false, CancellationToken? cancelToken = null, IProgress<double>? progress = null) {
|
public static (int Pages, IEnumerable<int> PerDoc) Convert(string htmlPath, string pdfPath, Documents.Document? doc = null) {
|
||||||
if (WinziPrintProc == null) throw new InvalidOperationException("The WinziPrint process has not been initialized yet");
|
int nPages;
|
||||||
progress?.Report(0.0);
|
using var html = File.Open(htmlPath, FileMode.Open);
|
||||||
using var client = new TcpClient("127.0.0.1", 30983);
|
using var writer = new PdfWriter(pdfPath);
|
||||||
using var stream = client.GetStream();
|
using var pdf = new PdfDocument(writer);
|
||||||
string cnxId;
|
var footerHandler = new FooterEventHandler(doc);
|
||||||
using var reader = new StreamReader(stream);
|
pdf.AddEventHandler(PdfDocumentEvent.END_PAGE, footerHandler);
|
||||||
var first = await reader.ReadLineAsync() ?? throw new IOException("Invalid response from WinziPrint");
|
pdf.AddEventHandler(PdfDocumentEvent.START_DOCUMENT_CLOSING, footerHandler);
|
||||||
if (first.StartsWith("id:")) {
|
// TODO embed fonts?
|
||||||
cnxId = first[3..].Trim();
|
//pdf.AddFont(PdfFontFactory.CreateFont(StandardFonts.TIMES_ROMAN));
|
||||||
} else {
|
HtmlConverter.ConvertToPdf(html, pdf);
|
||||||
throw new IOException("Invalid response from WinziPrint");
|
nPages = footerHandler.NumberOfPages;
|
||||||
}
|
return (nPages, [nPages]);
|
||||||
await stream.WriteAsync(Utils.UTF8.GetBytes(
|
}
|
||||||
"-e utf-8;-p;" + (doublePaged ? "-2;" : "") +
|
|
||||||
$"{string.Join(';', htmlPath)};{pdfPath}" +
|
public static (int Pages, IEnumerable<int> PerDoc) Convert(IEnumerable<string> inputFiles, string pdfPath, bool doublePaged = false, IEnumerable<Documents.Document>? docs = null, CancellationToken? cancelToken = null, IProgress<double>? progress = null) {
|
||||||
"\r\n"));
|
var tmpFileNames = new List<string>();
|
||||||
bool cancelled = false;
|
var pageNums = new List<int>();
|
||||||
while (true) {
|
var tmpPageNums = new List<int>();
|
||||||
if (!cancelled && (cancelToken?.IsCancellationRequested ?? false)) {
|
|
||||||
try {
|
var htmlFiles = inputFiles
|
||||||
using var cancelClient = new TcpClient("127.0.0.1", 30983);
|
.Where(f => !f.EndsWith(".pdf", StringComparison.OrdinalIgnoreCase))
|
||||||
using var cancelStream = cancelClient.GetStream();
|
.Select(f => f.TrimStart('!', '#'))
|
||||||
using var cancelReader = new StreamReader(cancelStream);
|
.ToList();
|
||||||
await cancelReader.ReadLineAsync();
|
|
||||||
await cancelStream.WriteAsync(Utils.UTF8.GetBytes($"cancel;{cnxId}\r\n"));
|
try {
|
||||||
} catch { }
|
for (int i = 0; i < htmlFiles.Count; i++) {
|
||||||
cancelled = true;
|
string tmpFile = $"{pdfPath}.{i:0000}.part";
|
||||||
|
tmpFileNames.Add(tmpFile);
|
||||||
|
var (pages, _) = Convert(htmlFiles[i], tmpFile, docs?.ElementAt(i));
|
||||||
|
tmpPageNums.Add(pages);
|
||||||
}
|
}
|
||||||
var line = await reader.ReadLineAsync() ?? throw new IOException("Invalid response from WinziPrint");
|
|
||||||
if (line.StartsWith("error:")) {
|
using var writer = new PdfWriter(pdfPath);
|
||||||
var msg = line[6..].Trim();
|
using var mergedPdf = new PdfDocument(writer);
|
||||||
if (msg == "aborted")
|
var merger = new PdfMerger(mergedPdf);
|
||||||
throw new OperationCanceledException("Dokumentenerzeugung abgebrochen!");
|
|
||||||
throw new IOException($"WinziPrint: {msg}");
|
PdfPage? letterheadPage = null;
|
||||||
} else if (line.StartsWith("progress:")) {
|
int letterheadInsertIndex = 0;
|
||||||
var parts = line[9..].Trim().Split('/').Select(int.Parse).ToArray();
|
int letterheadDocIndex = 0;
|
||||||
progress?.Report(100.0 * parts[0] / parts[1]);
|
|
||||||
} else if (line.StartsWith("success:")) {
|
for (int i = 0; i < inputFiles.Count(); i++) {
|
||||||
var m = Regex.Match(line, @"([0-9]+) pages \(([0-9, ]+)\)");
|
var fileName = inputFiles.ElementAt(i);
|
||||||
return (int.Parse(m.Groups[1].Value), m.Groups[2].Value.Split(", ").Select(int.Parse).ToList());
|
int p0 = mergedPdf.GetNumberOfPages();
|
||||||
|
|
||||||
|
if (letterheadPage != null && fileName.StartsWith('#')) {
|
||||||
|
if (mergedPdf.GetNumberOfPages() <= letterheadInsertIndex) {
|
||||||
|
mergedPdf.AddPage(letterheadPage.CopyTo(mergedPdf));
|
||||||
|
mergedPdf.AddNewPage();
|
||||||
|
} else {
|
||||||
|
mergedPdf.AddPage(letterheadInsertIndex + 1, letterheadPage.CopyTo(mergedPdf));
|
||||||
|
mergedPdf.AddNewPage(letterheadInsertIndex + 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
pageNums[letterheadDocIndex] = 1;
|
||||||
|
letterheadPage = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileName.EndsWith(".pdf", StringComparison.OrdinalIgnoreCase)) {
|
||||||
|
var cleanName = fileName.TrimStart('!', '#');
|
||||||
|
|
||||||
|
if (doublePaged && fileName.StartsWith('#')) {
|
||||||
|
using var reader = new PdfReader(cleanName);
|
||||||
|
using var src = new PdfDocument(reader);
|
||||||
|
letterheadPage = src.GetPage(1).CopyTo(mergedPdf);
|
||||||
|
letterheadInsertIndex = p0;
|
||||||
|
letterheadDocIndex = i;
|
||||||
|
} else {
|
||||||
|
using var reader = new PdfReader(cleanName);
|
||||||
|
using var src = new PdfDocument(reader);
|
||||||
|
merger.Merge(src, 1, src.GetNumberOfPages());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
string tmpFile = tmpFileNames[i];
|
||||||
|
if (doublePaged && fileName.StartsWith('#')) {
|
||||||
|
using var reader = new PdfReader(tmpFile);
|
||||||
|
using var src = new PdfDocument(reader);
|
||||||
|
letterheadPage = src.GetPage(1).CopyTo(mergedPdf);
|
||||||
|
letterheadInsertIndex = p0;
|
||||||
|
letterheadDocIndex = i;
|
||||||
|
} else {
|
||||||
|
using var reader = new PdfReader(tmpFile);
|
||||||
|
using var src = new PdfDocument(reader);
|
||||||
|
merger.Merge(src, 1, tmpPageNums[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int p1 = mergedPdf.GetNumberOfPages();
|
||||||
|
pageNums.Add(p1 - p0);
|
||||||
|
|
||||||
|
if (doublePaged && fileName[0] != '!' && fileName[0] != '#' && mergedPdf.GetNumberOfPages() % 2 != 0) {
|
||||||
|
if (letterheadPage != null) {
|
||||||
|
mergedPdf.AddPage(letterheadPage.CopyTo(mergedPdf));
|
||||||
|
letterheadPage = null;
|
||||||
|
} else {
|
||||||
|
mergedPdf.AddNewPage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (letterheadPage != null) {
|
||||||
|
if (mergedPdf.GetNumberOfPages() <= letterheadInsertIndex) {
|
||||||
|
mergedPdf.AddPage(letterheadPage.CopyTo(mergedPdf));
|
||||||
|
mergedPdf.AddNewPage();
|
||||||
|
} else {
|
||||||
|
mergedPdf.AddPage(letterheadInsertIndex + 1, letterheadPage.CopyTo(mergedPdf));
|
||||||
|
mergedPdf.AddNewPage(letterheadInsertIndex + 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
pageNums[letterheadDocIndex] = 1;
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
foreach (var tmp in tmpFileNames) {
|
||||||
|
if (File.Exists(tmp)) File.Delete(tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return (pageNums.Sum(), pageNums);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Show(TempFile file, string title) {
|
public static void Show(TempFile file, string title) {
|
||||||
@@ -123,9 +169,9 @@ namespace Elwig.Helpers.Printing {
|
|||||||
|
|
||||||
public static Task Print(string path, PrinterSettings settings) {
|
public static Task Print(string path, PrinterSettings settings) {
|
||||||
try {
|
try {
|
||||||
using var doc = PdfDocument.Load(path);
|
using var printDoc = new PdfPrintDocument(path) {
|
||||||
using var printDoc = doc.CreatePrintDocument(PdfPrintMode.CutMargin);
|
PrinterSettings = settings,
|
||||||
printDoc.PrinterSettings = settings;
|
};
|
||||||
printDoc.Print();
|
printDoc.Print();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
MessageBox.Show("Beim Drucken ist ein Fehler aufgetreten:\n\n" + e.Message, "Fehler beim Drucken", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show("Beim Drucken ist ein Fehler aufgetreten:\n\n" + e.Message, "Fehler beim Drucken", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
|||||||
102
Elwig/Helpers/Printing/PdfPrintDocument.cs
Normal file
102
Elwig/Helpers/Printing/PdfPrintDocument.cs
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
|
using System.Drawing.Printing;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Elwig.Helpers.Printing {
|
||||||
|
public class PdfPrintDocument : PrintDocument {
|
||||||
|
|
||||||
|
private readonly IntPtr _handle;
|
||||||
|
private readonly int _pageCount;
|
||||||
|
private readonly double _dpi;
|
||||||
|
|
||||||
|
private int _currentPage;
|
||||||
|
|
||||||
|
public PdfPrintDocument(string path, string? password = null, double dpi = 300.0) :
|
||||||
|
base() {
|
||||||
|
_handle = PdfiumNative.FPDF_LoadDocument(path, password);
|
||||||
|
_pageCount = PdfiumNative.FPDF_GetPageCount(_handle);
|
||||||
|
_dpi = dpi;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool disposing) {
|
||||||
|
PdfiumNative.FPDF_CloseDocument(_handle);
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnBeginPrint(PrintEventArgs evt) {
|
||||||
|
_currentPage = (PrinterSettings.FromPage != 0) ? (PrinterSettings.FromPage - 1) : 0;
|
||||||
|
base.OnBeginPrint(evt);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnPrintPage(PrintPageEventArgs evt) {
|
||||||
|
if (_currentPage < _pageCount) {
|
||||||
|
IntPtr page = PdfiumNative.FPDF_LoadPage(_handle, _currentPage);
|
||||||
|
double width = PdfiumNative.FPDF_GetPageWidth(page);
|
||||||
|
double height = PdfiumNative.FPDF_GetPageHeight(page);
|
||||||
|
int pixelWidth = (int)(width / 72.0 * _dpi);
|
||||||
|
int pixelHeight = (int)(height / 72.0 * _dpi);
|
||||||
|
|
||||||
|
IntPtr bitmap = PdfiumNative.FPDFBitmap_Create(pixelWidth, pixelHeight, 1);
|
||||||
|
PdfiumNative.FPDF_RenderPageBitmap(bitmap, page, 0, 0, pixelWidth, pixelHeight, 0, 0);
|
||||||
|
|
||||||
|
IntPtr buffer = PdfiumNative.FPDFBitmap_GetBuffer(bitmap);
|
||||||
|
int stride = PdfiumNative.FPDFBitmap_GetStride(bitmap);
|
||||||
|
using (var bmp = new Bitmap(pixelWidth, pixelHeight, stride, PixelFormat.Format32bppArgb, buffer)) {
|
||||||
|
evt.Graphics?.DrawImage(bmp, evt.PageBounds);
|
||||||
|
}
|
||||||
|
_currentPage++;
|
||||||
|
|
||||||
|
PdfiumNative.FPDFBitmap_Destroy(bitmap);
|
||||||
|
PdfiumNative.FPDF_ClosePage(page);
|
||||||
|
}
|
||||||
|
evt.HasMorePages = _currentPage < ((PrinterSettings.ToPage == 0) ? _pageCount : Math.Min(PrinterSettings.ToPage, _pageCount));
|
||||||
|
base.OnPrintPage(evt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal partial class PdfiumNative {
|
||||||
|
[LibraryImport("pdfium.dll")]
|
||||||
|
public static partial void FPDF_InitLibrary();
|
||||||
|
|
||||||
|
[LibraryImport("pdfium.dll")]
|
||||||
|
public static partial void FPDF_DestroyLibrary();
|
||||||
|
|
||||||
|
[LibraryImport("pdfium.dll", StringMarshalling = StringMarshalling.Utf8)]
|
||||||
|
public static partial IntPtr FPDF_LoadDocument(string filePath, string? password);
|
||||||
|
|
||||||
|
[LibraryImport("pdfium.dll")]
|
||||||
|
public static partial void FPDF_CloseDocument(IntPtr document);
|
||||||
|
|
||||||
|
[LibraryImport("pdfium.dll")]
|
||||||
|
public static partial int FPDF_GetPageCount(IntPtr document);
|
||||||
|
|
||||||
|
[LibraryImport("pdfium.dll")]
|
||||||
|
public static partial IntPtr FPDF_LoadPage(IntPtr document, int pageIndex);
|
||||||
|
|
||||||
|
[LibraryImport("pdfium.dll")]
|
||||||
|
public static partial void FPDF_ClosePage(IntPtr page);
|
||||||
|
|
||||||
|
[LibraryImport("pdfium.dll")]
|
||||||
|
public static partial double FPDF_GetPageWidth(IntPtr page);
|
||||||
|
|
||||||
|
[LibraryImport("pdfium.dll")]
|
||||||
|
public static partial double FPDF_GetPageHeight(IntPtr page);
|
||||||
|
|
||||||
|
[LibraryImport("pdfium.dll")]
|
||||||
|
public static partial IntPtr FPDFBitmap_Create(int width, int height, int alpha);
|
||||||
|
|
||||||
|
[LibraryImport("pdfium.dll")]
|
||||||
|
public static partial void FPDFBitmap_Destroy(IntPtr bitmap);
|
||||||
|
|
||||||
|
[LibraryImport("pdfium.dll")]
|
||||||
|
public static partial IntPtr FPDFBitmap_GetBuffer(IntPtr bitmap);
|
||||||
|
|
||||||
|
[LibraryImport("pdfium.dll")]
|
||||||
|
public static partial int FPDFBitmap_GetStride(IntPtr bitmap);
|
||||||
|
|
||||||
|
[LibraryImport("pdfium.dll")]
|
||||||
|
public static partial void FPDF_RenderPageBitmap(IntPtr bitmap, IntPtr page, int start_x, int start_y, int size_x, int size_y, int rotate, int flags);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ using Elwig.Documents;
|
|||||||
using Elwig.Helpers.Billing;
|
using Elwig.Helpers.Billing;
|
||||||
using Elwig.Models;
|
using Elwig.Models;
|
||||||
using Elwig.Models.Entities;
|
using Elwig.Models.Entities;
|
||||||
|
using iText.Layout.Element;
|
||||||
using LinqKit;
|
using LinqKit;
|
||||||
using MailKit.Net.Smtp;
|
using MailKit.Net.Smtp;
|
||||||
using MailKit.Security;
|
using MailKit.Security;
|
||||||
@@ -304,23 +305,18 @@ namespace Elwig.Helpers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class Footer {
|
public class Footer {
|
||||||
private string Text = "";
|
private readonly List<List<object>> Items = [[]];
|
||||||
private readonly string LineBreak;
|
private readonly string LineBreak;
|
||||||
private readonly string Seperator;
|
private readonly string Separator;
|
||||||
private bool FirstLine = true;
|
|
||||||
private bool FirstItemInLine = true;
|
|
||||||
|
|
||||||
public Footer(string lineBreak, string seperator) {
|
public Footer(string lineBreak, string separator) {
|
||||||
LineBreak = lineBreak;
|
LineBreak = lineBreak;
|
||||||
Seperator = seperator;
|
Separator = separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Footer Item(string? text) {
|
public Footer Item(object? text) {
|
||||||
if (text == null) return this;
|
if (text == null) return this;
|
||||||
Text += FirstItemInLine ? (FirstLine ? "" : LineBreak) : Seperator;
|
Items[^1].Add(text);
|
||||||
Text += text;
|
|
||||||
FirstLine = false;
|
|
||||||
FirstItemInLine = false;
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -329,12 +325,28 @@ namespace Elwig.Helpers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Footer NextLine() {
|
public Footer NextLine() {
|
||||||
FirstItemInLine = true;
|
Items.Add([]);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString() {
|
public override string ToString() {
|
||||||
return Text;
|
return string.Join(LineBreak, Items.Select(l => string.Join(Separator, l.ToString())));
|
||||||
|
}
|
||||||
|
|
||||||
|
public IList<ILeafElement> ToLeafElements() {
|
||||||
|
var l = new List<ILeafElement>();
|
||||||
|
var first1 = true;
|
||||||
|
foreach (var line in Items) {
|
||||||
|
if (!first1) l.Add(new Text(LineBreak));
|
||||||
|
var first2 = true;
|
||||||
|
foreach (var item in line) {
|
||||||
|
if (!first2) l.Add(new Text(Separator));
|
||||||
|
l.Add(item as ILeafElement ?? new Text(item.ToString()));
|
||||||
|
first2 = false;
|
||||||
|
}
|
||||||
|
first1 = false;
|
||||||
|
}
|
||||||
|
return l;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
Programmiersprache: C#<LineBreak/>
|
Programmiersprache: C#<LineBreak/>
|
||||||
Framework: Windows Presentation Framework (WPF)<LineBreak/>
|
Framework: Windows Presentation Framework (WPF)<LineBreak/>
|
||||||
Datenbank: <Hyperlink NavigateUri="https://sqlite.org/" RequestNavigate="Hyperlink_RequestNavigate">SQLite</Hyperlink><LineBreak/>
|
Datenbank: <Hyperlink NavigateUri="https://sqlite.org/" RequestNavigate="Hyperlink_RequestNavigate">SQLite</Hyperlink><LineBreak/>
|
||||||
PDF-Erstellung: <Hyperlink NavigateUri="https://weasyprint.org/" RequestNavigate="Hyperlink_RequestNavigate">WeasyPrint</Hyperlink>, <Hyperlink NavigateUri="https://github.com/toddams/RazorLight" RequestNavigate="Hyperlink_RequestNavigate">RazorLight</Hyperlink>, <Hyperlink NavigateUri="https://github.com/pvginkel/PdfiumViewer" RequestNavigate="Hyperlink_RequestNavigate">PdfiumViewer</Hyperlink><LineBreak/>
|
PDF-Erstellung: <Hyperlink NavigateUri="https://itextpdf.com/" RequestNavigate="Hyperlink_RequestNavigate">iText</Hyperlink>, <Hyperlink NavigateUri="https://github.com/toddams/RazorLight" RequestNavigate="Hyperlink_RequestNavigate">RazorLight</Hyperlink>, <Hyperlink NavigateUri="https://github.com/bblanchon/pdfium-binaries" RequestNavigate="Hyperlink_RequestNavigate">Pdfium</Hyperlink><LineBreak/>
|
||||||
Paketierung: <Hyperlink NavigateUri="https://www.firegiant.com/wixtoolset/" RequestNavigate="Hyperlink_RequestNavigate">WiX Toolset</Hyperlink>
|
Paketierung: <Hyperlink NavigateUri="https://www.firegiant.com/wixtoolset/" RequestNavigate="Hyperlink_RequestNavigate">WiX Toolset</Hyperlink>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
|
|
||||||
|
|||||||
@@ -248,7 +248,7 @@
|
|||||||
<Button x:Name="BreakdownButton"
|
<Button x:Name="BreakdownButton"
|
||||||
Click="BreakdownButton_Click"
|
Click="BreakdownButton_Click"
|
||||||
Margin="195,90,0,10" Width="190" Padding="3,5,5,5"
|
Margin="195,90,0,10" Width="190" Padding="3,5,5,5"
|
||||||
ToolTip="Aufschlüsselung der Menge nach Zweigstelle, Mitglied, Sorte, Attribut/Bewirt., Qualitätsstufe, gebunden/ungebunden">
|
ToolTip="Aufschlüsselung der Menge nach Zweigstelle, Sorte, Attribut/Bewirt., Qualitätsstufe, gebunden/ungebunden">
|
||||||
<Grid>
|
<Grid>
|
||||||
<TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text=""
|
<TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text=""
|
||||||
TextAlignment="Left" HorizontalAlignment="Left" Padding="6.5,0.5,0,0"/>
|
TextAlignment="Left" HorizontalAlignment="Left" Padding="6.5,0.5,0,0"/>
|
||||||
|
|||||||
Binary file not shown.
@@ -35,6 +35,5 @@
|
|||||||
</Target>
|
</Target>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Files\config.ini" />
|
<None Include="Files\config.ini" />
|
||||||
<None Include="Files\WinziPrint.exe" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -7,9 +7,6 @@
|
|||||||
<Component Directory="ConfigFolder" Permanent="true" NeverOverwrite="true">
|
<Component Directory="ConfigFolder" Permanent="true" NeverOverwrite="true">
|
||||||
<File Source="$(ProjectDir)\Files\config.ini" Id="config.ini"/>
|
<File Source="$(ProjectDir)\Files\config.ini" Id="config.ini"/>
|
||||||
</Component>
|
</Component>
|
||||||
<Component Directory="InstallFolder">
|
|
||||||
<File Source="$(ProjectDir)\Files\WinziPrint.exe" Id="WinziPrint.exe"/>
|
|
||||||
</Component>
|
|
||||||
</ComponentGroup>
|
</ComponentGroup>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
</Wix>
|
</Wix>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ About
|
|||||||
**Product:** Elwig
|
**Product:** Elwig
|
||||||
**Description:** Electronic Management for Vintners' Cooperatives
|
**Description:** Electronic Management for Vintners' Cooperatives
|
||||||
**Type:** ERP system
|
**Type:** ERP system
|
||||||
**Version:** 1.0.3.0 ([Changelog](./CHANGELOG.md))
|
**Version:** 1.0.3.3 ([Changelog](./CHANGELOG.md))
|
||||||
**License:** [GNU General Public License 3.0 (GPLv3)](./LICENSE)
|
**License:** [GNU General Public License 3.0 (GPLv3)](./LICENSE)
|
||||||
**Website:** https://elwig.at/
|
**Website:** https://elwig.at/
|
||||||
**Source code:** https://git.necronda.net/winzer/elwig
|
**Source code:** https://git.necronda.net/winzer/elwig
|
||||||
@@ -33,7 +33,7 @@ Packaging: [WiX Toolset](https://www.firegiant.com/wixtoolset/)
|
|||||||
**Produkt:** Elwig
|
**Produkt:** Elwig
|
||||||
**Beschreibung:** Elektronische Winzergenossenschaftsverwaltung
|
**Beschreibung:** Elektronische Winzergenossenschaftsverwaltung
|
||||||
**Typ:** Warenwirtschaftssystem (ERP-System)
|
**Typ:** Warenwirtschaftssystem (ERP-System)
|
||||||
**Version:** 1.0.3.0 ([Änderungsprotokoll](./CHANGELOG.md))
|
**Version:** 1.0.3.3 ([Änderungsprotokoll](./CHANGELOG.md))
|
||||||
**Lizenz:** [GNU General Public License 3.0 (GPLv3)](./LICENSE)
|
**Lizenz:** [GNU General Public License 3.0 (GPLv3)](./LICENSE)
|
||||||
**Website:** https://elwig.at/
|
**Website:** https://elwig.at/
|
||||||
**Quellcode:** https://git.necronda.net/winzer/elwig
|
**Quellcode:** https://git.necronda.net/winzer/elwig
|
||||||
@@ -43,5 +43,5 @@ Packaging: [WiX Toolset](https://www.firegiant.com/wixtoolset/)
|
|||||||
Programmiersprache: C#
|
Programmiersprache: C#
|
||||||
Framework: Windows Presentation Framework (WPF)
|
Framework: Windows Presentation Framework (WPF)
|
||||||
Datenbank: [SQLite](https://sqlite.org/)
|
Datenbank: [SQLite](https://sqlite.org/)
|
||||||
PDF-Erstellung: [WeasyPrint](https://weasyprint.org/), [RazorLight](https://github.com/toddams/RazorLight), [PdfiumViewer](https://github.com/pvginkel/PdfiumViewer)
|
PDF-Erstellung: [iText](https://itextpdf.com/), [RazorLight](https://github.com/toddams/RazorLight), [Pdfium](https://github.com/bblanchon/pdfium-binaries)
|
||||||
Paketierung: [WiX Toolset](https://www.firegiant.com/wixtoolset/)
|
Paketierung: [WiX Toolset](https://www.firegiant.com/wixtoolset/)
|
||||||
|
|||||||
@@ -8,18 +8,18 @@
|
|||||||
SuppressOptionsUI="yes" ShowVersion="yes"/>
|
SuppressOptionsUI="yes" ShowVersion="yes"/>
|
||||||
</BootstrapperApplication>
|
</BootstrapperApplication>
|
||||||
|
|
||||||
<util:RegistrySearch Id="VCredistx86" Variable="VCredistx86" Result="exists"
|
<util:RegistrySearch Id="VCredistx64" Variable="VCredistx64" Result="exists"
|
||||||
Root="HKLM" Key="SOFTWARE\Classes\Installer\Dependencies\VC,redist.x86,x86,14.36,bundle"/>
|
Root="HKLM" Key="SOFTWARE\Classes\Installer\Dependencies\VC,redist.x64,amd64,14.50,bundle"/>
|
||||||
<util:RegistrySearch Id="Webview2Machine" Variable="Webview2Machine" Result="exists"
|
<util:RegistrySearch Id="Webview2Machine" Variable="Webview2Machine" Result="exists"
|
||||||
Root="HKLM" Key="SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}"/>
|
Root="HKLM" Key="SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}"/>
|
||||||
<util:RegistrySearch Id="Webview2User" Variable="Webview2User" Result="exists"
|
<util:RegistrySearch Id="Webview2User" Variable="Webview2User" Result="exists"
|
||||||
Root="HKCU" Key="Software\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}"/>
|
Root="HKCU" Key="Software\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}"/>
|
||||||
|
|
||||||
<Chain>
|
<Chain>
|
||||||
<ExePackage Id="VCredistx86Installer" DisplayName="VC Redist x86 installer" Name="VC_redist.x86.exe"
|
<ExePackage Id="VCredistx64Installer" DisplayName="VC Redist x64 installer" Name="VC_redist.x64.exe"
|
||||||
SourceFile="$(ProjectDir)\Files\VC_redist.x86.exe"
|
SourceFile="$(ProjectDir)\Files\VC_redist.x64.exe"
|
||||||
Cache="remove" Compressed="yes" PerMachine="yes" Permanent="yes" Vital="yes"
|
Cache="remove" Compressed="yes" PerMachine="yes" Permanent="yes" Vital="yes"
|
||||||
InstallArguments="/install /passive /norestart" DetectCondition="VCredistx86"/>
|
InstallArguments="/install /passive /norestart" DetectCondition="VCredistx64"/>
|
||||||
<ExePackage Id="MicrosoftEdgeWebview2" DisplayName="Microsoft Edge Webview2 Runtime" Name="MicrosoftEdgeWebview2Setup.exe"
|
<ExePackage Id="MicrosoftEdgeWebview2" DisplayName="Microsoft Edge Webview2 Runtime" Name="MicrosoftEdgeWebview2Setup.exe"
|
||||||
SourceFile="$(ProjectDir)\Files\MicrosoftEdgeWebview2Setup.exe"
|
SourceFile="$(ProjectDir)\Files\MicrosoftEdgeWebview2Setup.exe"
|
||||||
Cache="remove" Compressed="yes" PerMachine="yes" Permanent ="yes" Vital="no"
|
Cache="remove" Compressed="yes" PerMachine="yes" Permanent ="yes" Vital="no"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Target Name="CustomBeforeBuild" BeforeTargets="BeforeBuild">
|
<Target Name="CustomBeforeBuild" BeforeTargets="BeforeBuild">
|
||||||
<Exec Command="curl --fail -s -L "https://go.microsoft.com/fwlink/p/?LinkId=2124703" -z "$(ProjectDir)\Files\MicrosoftEdgeWebview2Setup.exe" -o "$(ProjectDir)\Files\MicrosoftEdgeWebview2Setup.exe"" />
|
<Exec Command="curl --fail -s -L "https://go.microsoft.com/fwlink/p/?LinkId=2124703" -z "$(ProjectDir)\Files\MicrosoftEdgeWebview2Setup.exe" -o "$(ProjectDir)\Files\MicrosoftEdgeWebview2Setup.exe"" />
|
||||||
<Exec Command="curl --fail -s -L "https://aka.ms/vs/17/release/vc_redist.x86.exe" -z "$(ProjectDir)\Files\VC_redist.x86.exe" -o "$(ProjectDir)\Files\VC_redist.x86.exe"" />
|
<Exec Command="curl --fail -s -L "https://aka.ms/vc14/vc_redist.x64.exe" -z "$(ProjectDir)\Files\VC_redist.x64.exe" -o "$(ProjectDir)\Files\VC_redist.x64.exe"" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<DefineConstants>ElwigProjectDir=..\Elwig</DefineConstants>
|
<DefineConstants>ElwigProjectDir=..\Elwig</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user