36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
using RazorLight;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.IO;
|
|
using WGneu.Models;
|
|
|
|
namespace WGneu.Documents {
|
|
class Template {
|
|
|
|
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");
|
|
}
|
|
|
|
public static async void Generate(WgContext c) {
|
|
var engine = new RazorLightEngineBuilder()
|
|
.UseFileSystemProject(@"C:\Users\tom\source\repos\wgneu-cs\WGneu\Documents")
|
|
.UseMemoryCachingProvider()
|
|
.Build();
|
|
|
|
var model = new TestTemplateModel(c);
|
|
|
|
string result = await engine.CompileRenderAsync("TestTemplate.cshtml", model);
|
|
|
|
await File.WriteAllTextAsync(ROOT + "razor_test.html", result);
|
|
}
|
|
}
|
|
}
|