diff --git a/WGneu/App.xaml.cs b/WGneu/App.xaml.cs index 28037cd..98b8ba0 100644 --- a/WGneu/App.xaml.cs +++ b/WGneu/App.xaml.cs @@ -7,9 +7,9 @@ using System.Threading.Tasks; using System.Windows; namespace WGneu { - /// - /// Interaction logic for App.xaml - /// public partial class App : Application { + public App() : base() { + System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); + } } } diff --git a/WGneu/Documents/Pdf.cs b/WGneu/Documents/Pdf.cs index 176f763..178a571 100644 --- a/WGneu/Documents/Pdf.cs +++ b/WGneu/Documents/Pdf.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Reflection.Metadata.Ecma335; using System.Text; using System.Threading.Tasks; +using PdfSharp.Pdf.IO; using PuppeteerSharp; using PuppeteerSharp.Media; using WGneu.Windows; @@ -47,6 +48,13 @@ namespace WGneu.Documents { }); } + public static void UpdateMetadata(string path, string title, string author) { + using var doc = PdfReader.Open(path); + doc.Info.Title = title; + doc.Info.Author = author; + doc.Save(path); + } + public static void Display(string title, string path) { var w = new DocumentViewerWindow(title, path); w.Show(); diff --git a/WGneu/Documents/Template.cs b/WGneu/Documents/Template.cs index c8c34db..d22b0c4 100644 --- a/WGneu/Documents/Template.cs +++ b/WGneu/Documents/Template.cs @@ -11,10 +11,11 @@ using WGneu.Models; namespace WGneu.Documents { class Template { - private static readonly string ROOT = @"C:\Users\tom\Projects\wgneu\"; + private static readonly string ROOT = @"C:\Users\lorenz\Desktop\"; public static async void Test() { await Pdf.Convert(ROOT + "din-5008.html", ROOT + "test.pdf"); + Pdf.UpdateMetadata(ROOT + "test.pdf", "Test Dokument", "Winzergenossenschaft für Matzen und Umgebung reg. Gen.m.b.H."); Pdf.Display("Test-Dokument", ROOT + "test.pdf"); } diff --git a/WGneu/WGneu.csproj b/WGneu/WGneu.csproj index df79fa8..8664614 100644 --- a/WGneu/WGneu.csproj +++ b/WGneu/WGneu.csproj @@ -16,8 +16,10 @@ + + diff --git a/WGneu/Windows/DocumentViewerWindow.xaml b/WGneu/Windows/DocumentViewerWindow.xaml index fd64973..7b0ef13 100644 --- a/WGneu/Windows/DocumentViewerWindow.xaml +++ b/WGneu/Windows/DocumentViewerWindow.xaml @@ -7,7 +7,7 @@ xmlns:local="clr-namespace:WGneu.Windows" mc:Ignorable="d" Title="PDF Ansicht" - MinHeight="600" MinWidth="420" Height="970" Width="670"> + MinHeight="600" MinWidth="420" Height="750" Width="525">