Compare commits
3 Commits
a087baa089
...
2ae2bbdaf6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ae2bbdaf6 | ||
|
|
a4c33e6bac | ||
|
|
346750e933 |
@@ -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,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();
|
||||||
|
|||||||
@@ -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),
|
||||||
|
|||||||
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.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user