Enhance PDF viewer with annotations and WebAssembly
Added support for advanced annotation tools, including signature and stamp management, along with accessibility improvements. Introduced WebAssembly binaries (`qcms_bg.wasm`, `quickjs-eval.wasm`, `openjpeg.wasm`, `jbig2.wasm`) for enhanced performance in color management, JavaScript execution, and image decoding. Implemented a JavaScript fallback (`openjpeg_nowasm_fallback.js`) for environments without WebAssembly support. Updated `Details.cshtml` to include a PDF viewer popup and added a new Razor Page (`ViewPdf.cshtml`) for secure PDF file access. Registered `.mjs` MIME type in `Program.cs` for PDF.js compatibility. Enhanced localization with translations for multiple languages in `viewer.ftl` and added new icons, dialogs, and accessibility features. Updated `DXApp.sln` to include a new project for template management. These changes improve functionality, modularity, and user experience.
This commit is contained in:
@@ -7,6 +7,14 @@
|
|||||||
<h2>📄 Rechnungsdetails</h2>
|
<h2>📄 Rechnungsdetails</h2>
|
||||||
<a href="/Invoices" class="btn btn-secondary mb-3">← Zurück zur Liste</a>
|
<a href="/Invoices" class="btn btn-secondary mb-3">← Zurück zur Liste</a>
|
||||||
|
|
||||||
|
@if (!string.IsNullOrEmpty(Model.Invoice?.ResultFilePath))
|
||||||
|
{
|
||||||
|
<button class="btn btn-primary mb-3 ms-2"
|
||||||
|
onclick="openPdfViewer(@Model.Invoice.Id)">
|
||||||
|
📄 PDF anzeigen
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
|
||||||
@if (Model.Invoice is null)
|
@if (Model.Invoice is null)
|
||||||
{
|
{
|
||||||
<div class="alert alert-danger">Rechnung nicht gefunden.</div>
|
<div class="alert alert-danger">Rechnung nicht gefunden.</div>
|
||||||
@@ -41,4 +49,37 @@ else
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
@(Html.DevExtreme().Popup()
|
||||||
|
.ID("pdf-viewer-popup")
|
||||||
|
.Title("PDF Viewer")
|
||||||
|
.Width("90%")
|
||||||
|
.Height("90%")
|
||||||
|
.ShowCloseButton(true)
|
||||||
|
.OnHiding("onPdfPopupHiding")
|
||||||
|
.ContentTemplate(new JS(@"function() {
|
||||||
|
return '<iframe id=""pdf-iframe"" style=""width:100%;height:100%;border:none;""></iframe>';
|
||||||
|
}"))
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function openPdfViewer(invoiceId) {
|
||||||
|
var pdfUrl = window.location.origin + '/Invoices/ViewPdf?id=' + invoiceId;
|
||||||
|
var viewerUrl = '/js/pdfjs/web/viewer.html?file=' + encodeURIComponent(pdfUrl);
|
||||||
|
|
||||||
|
var popup = $('#pdf-viewer-popup').dxPopup('instance');
|
||||||
|
|
||||||
|
// onShown sicherstellen dass iframe im DOM ist
|
||||||
|
popup.option('onShown', function () {
|
||||||
|
$('#pdf-iframe').attr('src', viewerUrl);
|
||||||
|
});
|
||||||
|
|
||||||
|
popup.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
function onPdfPopupHiding() {
|
||||||
|
// iframe src leeren beim Schließen → verhindert dass PDF im Hintergrund weiter läuft
|
||||||
|
$('#pdf-iframe').attr('src', '');
|
||||||
|
}
|
||||||
|
</script>
|
||||||
2
DXApp.TemplateKitProject/Pages/Invoices/ViewPdf.cshtml
Normal file
2
DXApp.TemplateKitProject/Pages/Invoices/ViewPdf.cshtml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
@page
|
||||||
|
@model DXApp.TemplateKitProject.Pages.Invoices.ViewPdfModel
|
||||||
24
DXApp.TemplateKitProject/Pages/Invoices/ViewPdf.cshtml.cs
Normal file
24
DXApp.TemplateKitProject/Pages/Invoices/ViewPdf.cshtml.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using DXApp.TemplateKitProject.Data;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace DXApp.TemplateKitProject.Pages.Invoices;
|
||||||
|
|
||||||
|
public class ViewPdfModel(AppDbContext db) : PageModel
|
||||||
|
{
|
||||||
|
public async Task<IActionResult> OnGetAsync(int id)
|
||||||
|
{
|
||||||
|
var invoice = await db.ZugferdInvoices
|
||||||
|
.FirstOrDefaultAsync(i => i.Id == id);
|
||||||
|
|
||||||
|
if (invoice is null || string.IsNullOrEmpty(invoice.ResultFilePath))
|
||||||
|
return NotFound();
|
||||||
|
|
||||||
|
if (!System.IO.File.Exists(invoice.ResultFilePath))
|
||||||
|
return NotFound();
|
||||||
|
|
||||||
|
var bytes = await System.IO.File.ReadAllBytesAsync(invoice.ResultFilePath);
|
||||||
|
return File(bytes, "application/pdf");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -28,7 +28,12 @@ if (!app.Environment.IsDevelopment())
|
|||||||
}
|
}
|
||||||
|
|
||||||
app.UseHttpsRedirection();
|
app.UseHttpsRedirection();
|
||||||
app.UseStaticFiles();
|
|
||||||
|
// .mjs MIME-Type für PDF.js registrieren (einmaliger UseStaticFiles-Aufruf)
|
||||||
|
var provider = new Microsoft.AspNetCore.StaticFiles.FileExtensionContentTypeProvider();
|
||||||
|
provider.Mappings[".mjs"] = "text/javascript";
|
||||||
|
app.UseStaticFiles(new StaticFileOptions { ContentTypeProvider = provider });
|
||||||
|
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
app.MapRazorPages();
|
app.MapRazorPages();
|
||||||
|
|||||||
27653
DXApp.TemplateKitProject/wwwroot/js/pdfjs/build/pdf.mjs
Normal file
27653
DXApp.TemplateKitProject/wwwroot/js/pdfjs/build/pdf.mjs
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
222
DXApp.TemplateKitProject/wwwroot/js/pdfjs/build/pdf.sandbox.mjs
Normal file
222
DXApp.TemplateKitProject/wwwroot/js/pdfjs/build/pdf.sandbox.mjs
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
63872
DXApp.TemplateKitProject/wwwroot/js/pdfjs/build/pdf.worker.mjs
Normal file
63872
DXApp.TemplateKitProject/wwwroot/js/pdfjs/build/pdf.worker.mjs
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/78-H.bcmap
Normal file
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/78-H.bcmap
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/78-V.bcmap
Normal file
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/78-V.bcmap
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/Add-H.bcmap
Normal file
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/Add-H.bcmap
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/Add-V.bcmap
Normal file
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/Add-V.bcmap
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/B5-H.bcmap
Normal file
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/B5-H.bcmap
Normal file
Binary file not shown.
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/B5-V.bcmap
Normal file
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/B5-V.bcmap
Normal file
Binary file not shown.
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/B5pc-H.bcmap
Normal file
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/B5pc-H.bcmap
Normal file
Binary file not shown.
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/B5pc-V.bcmap
Normal file
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/B5pc-V.bcmap
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/CNS1-H.bcmap
Normal file
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/CNS1-H.bcmap
Normal file
Binary file not shown.
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/CNS1-V.bcmap
Normal file
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/CNS1-V.bcmap
Normal file
Binary file not shown.
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/CNS2-H.bcmap
Normal file
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/CNS2-H.bcmap
Normal file
Binary file not shown.
@@ -0,0 +1,3 @@
|
|||||||
|
àRCopyright 1990-2009 Adobe Systems Incorporated.
|
||||||
|
All rights reserved.
|
||||||
|
See ./LICENSEáCNS2-H
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,3 @@
|
|||||||
|
àRCopyright 1990-2009 Adobe Systems Incorporated.
|
||||||
|
All rights reserved.
|
||||||
|
See ./LICENSEá ETen-B5-H` ^
|
||||||
Binary file not shown.
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/EUC-H.bcmap
Normal file
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/EUC-H.bcmap
Normal file
Binary file not shown.
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/EUC-V.bcmap
Normal file
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/EUC-V.bcmap
Normal file
Binary file not shown.
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/Ext-H.bcmap
Normal file
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/Ext-H.bcmap
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/Ext-V.bcmap
Normal file
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/Ext-V.bcmap
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,4 @@
|
|||||||
|
àRCopyright 1990-2009 Adobe Systems Incorporated.
|
||||||
|
All rights reserved.
|
||||||
|
See ./LICENSE!!<21>º]aX!!]`<60>21<32>> <09>p<0B>z<EFBFBD>$]‚<06>"R‚d<E2809A>-Uƒ7<C692>*„
|
||||||
|
4„%<25>+ „Z „{<7B>/…%…<<3C>9K…b<E280A6>1]†.<2E>"‡‰`]‡,<2C>"]ˆ
|
||||||
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/GB-V.bcmap
Normal file
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/GB-V.bcmap
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/GBT-H.bcmap
Normal file
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/GBT-H.bcmap
Normal file
Binary file not shown.
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/GBT-V.bcmap
Normal file
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/GBT-V.bcmap
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/H.bcmap
Normal file
BIN
DXApp.TemplateKitProject/wwwroot/js/pdfjs/web/cmaps/H.bcmap
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user