Revert "Enhance PDF viewing experience with new document viewer"
This reverts commit 1cc617de42.
This commit is contained in:
@@ -16,10 +16,10 @@
|
||||
|
||||
@if (!string.IsNullOrEmpty(Model.Invoice?.ResultFilePath))
|
||||
{
|
||||
<a class="btn btn-primary mb-3 ms-2"
|
||||
href="/Invoices/DocumentViewer?id=@Model.Invoice.Id">
|
||||
<button class="btn btn-primary mb-3 ms-2"
|
||||
onclick="openPdfViewer(@Model.Invoice.Id)">
|
||||
<i class="dx-icon-pdffile"></i> Ergebnis anzeigen
|
||||
</a>
|
||||
</button>
|
||||
}
|
||||
|
||||
@if (Model.Invoice is null)
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
@page
|
||||
@model DXApp.TemplateKitProject.Pages.Invoices.DocumentViewerModel
|
||||
@{
|
||||
ViewData["Title"] = "Dokument Viewer";
|
||||
var pdfUrl = Model.PdfUrl;
|
||||
}
|
||||
|
||||
<div class="container-fluid" style="height:100vh; padding:0;">
|
||||
<div class="d-flex align-items-center justify-content-between p-3 border-bottom">
|
||||
<h5 class="m-0">Rechnung @Model.Id - Dokument</h5>
|
||||
<div>
|
||||
<a class="btn btn-secondary me-2" href="/Invoices">Zurück zur Übersicht</a>
|
||||
<!-- Später: Button um DevExpress Viewer zu öffnen -->
|
||||
<a class="btn btn-outline-primary" href="/Invoices/DocumentViewerDevExpress?id=@Model.Id">
|
||||
DevExpress Viewer (experimental)
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="height:calc(100vh - 64px);">
|
||||
@* Solide, funktionierende Baseline: Browser-internen PDF-Renderer verwenden *@
|
||||
<iframe id="pdf-viewer-iframe"
|
||||
src="@pdfUrl"
|
||||
style="width:100%; height:100%; border: none;"
|
||||
title="PDF Viewer"></iframe>
|
||||
</div>
|
||||
|
||||
@* Hinweis:
|
||||
- Diese Seite zeigt aktuell das PDF per einfachem iframe (funktioniert zuverlässig).
|
||||
- Nächster Commit: wir ersetzen iframe durch DevExpress WebDocumentViewer oder laden diesen zusätzlich.
|
||||
- Der Link "DevExpress Viewer (experimental)" ist ein Platzhalter; wir implementieren die Route /Invoices/DocumentViewerDevExpress in einem der nächsten Schritte.
|
||||
*@
|
||||
</div>
|
||||
@@ -1,17 +0,0 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace DXApp.TemplateKitProject.Pages.Invoices;
|
||||
|
||||
public class DocumentViewerModel : PageModel
|
||||
{
|
||||
[BindProperty(SupportsGet = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
public string PdfUrl => $"/Invoices/ViewPdf?id={Id}";
|
||||
|
||||
public void OnGet()
|
||||
{
|
||||
// Keine serverseitige Logik nötig für die erste Version.
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ public class ViewPdfModel : PageModel
|
||||
|
||||
public async Task<IActionResult> OnGetAsync(int id)
|
||||
{
|
||||
// Sicherheit: defensive checks, gleiche Logik wie CustomReportStorageWebExtension
|
||||
var invoice = await _db.ZugferdInvoices
|
||||
.AsNoTracking()
|
||||
.FirstOrDefaultAsync(i => i.Id == id);
|
||||
@@ -34,10 +35,6 @@ public class ViewPdfModel : PageModel
|
||||
var bytes = await System.IO.File.ReadAllBytesAsync(invoice.ResultFilePath);
|
||||
_logger.LogInformation("ViewPdf: Invoice {Id} ausgeliefert ({Size} Bytes).", id, bytes.Length);
|
||||
|
||||
// Wichtig: keine "attachment" Content-Disposition setzen
|
||||
// wir setzen inline (oder lassen es weg) damit Browser im Viewer darstellt
|
||||
Response.Headers["Content-Disposition"] = $"inline; filename=\"{Path.GetFileName(invoice.ResultFilePath)}\"";
|
||||
|
||||
return File(bytes, "application/pdf");
|
||||
return File(bytes, "application/pdf", $"{Path.GetFileName(invoice.ResultFilePath)}");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user