Compare commits

...

3 Commits

Author SHA1 Message Date
OlgunR
2ae2bbdaf6 Update PDF metadata handling in PdfResultPackageService
Introduce functionality to remove and replace metadata in the
resulting PDF document. After loading the document with
`PdfDocumentProcessor`, the metadata fields (`Author`, `Creator`,
`Producer`, `Title`, `Subject`, and `Keywords`) are cleared or
replaced with values indicating the document was processed by
the "DXApp" system. This ensures proper attribution and removes
any association with the original document creator.
2026-06-01 16:32:25 +02:00
OlgunR
a4c33e6bac Add MIME type mappings for .mjs and .ftl files
Updated the `Program.cs` file to enhance static file handling:
- Corrected the comment for `.mjs` MIME type registration.
- Added a new MIME type mapping for `.ftl` files as `text/plain`.
- Updated `UseStaticFiles` middleware to use a `StaticFileOptions`
  object with the modified `ContentTypeProvider`.

These changes ensure proper serving of `.mjs` and `.ftl` files with
appropriate content type headers.
2026-06-01 15:43:16 +02:00
OlgunR
346750e933 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.
2026-06-01 14:08:17 +02:00
411 changed files with 179856 additions and 3 deletions

View File

@@ -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>

View File

@@ -0,0 +1,2 @@
@page
@model DXApp.TemplateKitProject.Pages.Invoices.ViewPdfModel

View 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");
}
}

View File

@@ -28,7 +28,13 @@ if (!app.Environment.IsDevelopment())
} }
app.UseHttpsRedirection(); app.UseHttpsRedirection();
app.UseStaticFiles();
// MIME-Types für PDF.js registrieren (einmaliger UseStaticFiles-Aufruf)
var provider = new Microsoft.AspNetCore.StaticFiles.FileExtensionContentTypeProvider();
provider.Mappings[".mjs"] = "text/javascript";
provider.Mappings[".ftl"] = "text/plain";
app.UseStaticFiles(new StaticFileOptions { ContentTypeProvider = provider });
app.UseRouting(); app.UseRouting();
app.UseAuthorization(); app.UseAuthorization();
app.MapRazorPages(); app.MapRazorPages();

View File

@@ -60,6 +60,14 @@ public class PdfResultPackageService(
using var processor = new PdfDocumentProcessor(); using var processor = new PdfDocumentProcessor();
processor.LoadDocument(convertedStream); processor.LoadDocument(convertedStream);
// Metadaten des Originals entfernen → Result-PDF gehört uns, nicht dem Ersteller
processor.Document.Author = "DXApp Verarbeitungssystem";
processor.Document.Creator = "DXApp";
processor.Document.Producer = "DXApp";
processor.Document.Title = string.Empty;
processor.Document.Subject = string.Empty;
processor.Document.Keywords = string.Empty;
processor.AttachFile(new PdfFileAttachment processor.AttachFile(new PdfFileAttachment
{ {
FileName = Path.GetFileName(reportPath), FileName = Path.GetFileName(reportPath),

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
àRCopyright 1990-2009 Adobe Systems Incorporated.
All rights reserved.
See ./LICENSEáCNS2-H

View File

@@ -0,0 +1,3 @@
àRCopyright 1990-2009 Adobe Systems Incorporated.
All rights reserved.
See ./LICENSEá ETen-B5-H` ^

View File

@@ -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>"Rd<E2809A>-Uƒ7<C692>*
4„%<25>+ „Z „{<7B>/%…<<3C>9K…b<E280A6>1]†.<2E>" ‰`]‡,<2C>"]ˆ

Some files were not shown because too many files have changed in this diff Show More