Add Pdf.UpdateMetadata
This commit is contained in:
@ -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();
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user