Prefetch paged.js
This commit is contained in:
@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Elwig.Models;
|
||||
using Elwig.Models;
|
||||
|
||||
namespace Elwig.Documents {
|
||||
public abstract class BusinessDocument : Document {
|
||||
|
@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Elwig.Models;
|
||||
using Elwig.Models;
|
||||
|
||||
namespace Elwig.Documents {
|
||||
public class BusinessLetter : BusinessDocument {
|
||||
|
@ -14,8 +14,8 @@
|
||||
window.addEventListener("afterprint", () => { location.reload(); });
|
||||
}
|
||||
</script>
|
||||
<!-- TODO store paged.js locally to avoid using the internet -->
|
||||
<script src="https://unpkg.com/pagedjs/dist/paged.polyfill.js"></script>
|
||||
<script src="C:\ProgramData\Elwig\resources\paged.polyfill.js"></script>
|
||||
<!--link rel="stylesheet" href="C:\ProgramData\Elwig\resources\style.css"/-->
|
||||
@{ await IncludeAsync("Style.css"); }
|
||||
</head>
|
||||
<body>
|
||||
|
@ -1,10 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using Elwig.Helpers;
|
||||
|
||||
namespace Elwig.Documents {
|
||||
|
@ -1,17 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Shapes;
|
||||
using PdfSharp.Pdf.IO;
|
||||
using PuppeteerSharp;
|
||||
using PuppeteerSharp.Media;
|
||||
using RazorLight;
|
||||
using Elwig.Helpers;
|
||||
using Elwig.Windows;
|
||||
|
||||
@ -26,6 +17,8 @@ namespace Elwig.Documents {
|
||||
Browser = await Puppeteer.LaunchAsync(new LaunchOptions {
|
||||
Headless = true,
|
||||
ExecutablePath = Chromium,
|
||||
// paged.js uses XHRs to load styles, so this is needed
|
||||
Args = new[] { "--allow-file-access-from-files" },
|
||||
});
|
||||
evtHandler();
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
@using RazorLight
|
||||
@inherits TemplatePage<Elwig.Documents.Document>
|
||||
|
||||
<style>
|
||||
:root {
|
||||
|
@ -34,4 +34,8 @@
|
||||
<EmbeddedResource Include="Documents/BusinessLetter.cshtml" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||
<Exec Command="call fetch-resources.bat" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
3
Elwig/fetch-resources.bat
Normal file
3
Elwig/fetch-resources.bat
Normal file
@ -0,0 +1,3 @@
|
||||
mkdir "C:\ProgramData\Elwig\resources""
|
||||
curl -s -L "https://unpkg.com/pagedjs/dist/paged.polyfill.js" -o "C:\ProgramData\Elwig\resources\paged.polyfill.js"
|
||||
::copy /y "Documents\style.css" "C:\ProgramData\Elwig\resources\style.css"
|
Reference in New Issue
Block a user