Update 20260130
This commit is contained in:
@@ -330,6 +330,7 @@ namespace API_NetFramework.Controllers
|
||||
onbasedoc.attributes.Add(na);
|
||||
}
|
||||
onbasedoc.dokumentDatei = dok.dokument;
|
||||
|
||||
|
||||
if (pdfdoc != "")
|
||||
{
|
||||
@@ -712,6 +713,7 @@ namespace API_NetFramework.Controllers
|
||||
onbasedoc.dokumentDatum = db.dsdaten.Tables[0].Rows[0]["DokumentDatum"].ToString();
|
||||
onbasedoc.dokumentTyp = db.dsdaten.Tables[0].Rows[0]["dokumenttyp"].ToString();
|
||||
onbasedoc.dateiTyp = db.dsdaten.Tables[0].Rows[0]["dateityp"].ToString();
|
||||
|
||||
|
||||
onbasedoc.attributes = new List<Model.OnBaseDocUpload.attribute>();
|
||||
foreach (System.Data.DataRow rw in db.dsdaten.Tables[1].Rows)
|
||||
@@ -811,6 +813,8 @@ namespace API_NetFramework.Controllers
|
||||
oba.Returnaddress = versandpaket.GASAdresse;
|
||||
oba.O2ODochandle = "";
|
||||
oba.Status = "";
|
||||
oba.ReferenceId = versandpaket.ReferenceID;
|
||||
|
||||
//if (oba.GASCouvert == "") { oba.GASCouvert = "false"; } else { oba.GASCouvert = "true"; }
|
||||
foreach (Versanddokument vd in versandpaket.Dokument)
|
||||
{
|
||||
@@ -828,7 +832,7 @@ namespace API_NetFramework.Controllers
|
||||
oba.Returnaddress = versandpaket.GASAdresse;
|
||||
oba.O2ODochandle = "";
|
||||
oba.Status = "";
|
||||
|
||||
oba.ReferenceId = versandpaket.ReferenceID;
|
||||
|
||||
foreach (Versanddokument vd in versandpaket.Dokument)
|
||||
{
|
||||
@@ -908,6 +912,7 @@ namespace API_NetFramework.Controllers
|
||||
onbasedoc.dokumentDatum = DateTime.Now.ToString("dd.MM.yyyy");
|
||||
onbasedoc.dokumentDatei = versandpaket.finaldoc;
|
||||
onbasedoc.dateiTyp = "PDF";
|
||||
onbasedoc.ReferenceId = versandpaket.ReferenceID;
|
||||
onbasedoc.attributes = new List<OnBaseDocUpload.attribute>();
|
||||
if (oba.GASCouvert == "") { oba.GASCouvert = "false"; } else { oba.GASCouvert = "true"; }
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -120,19 +120,10 @@ ELSE
|
||||
FileName = $"{dto.Key}.pdf"
|
||||
};
|
||||
response.Content.Headers.ContentLength = pdfBytes.Length;
|
||||
if (System.IO.File.Exists(@"x:\file.pdf")) { System.IO.File.Delete(@"x:\file.pdf"); }
|
||||
System.IO.FileStream stream =
|
||||
|
||||
new FileStream(@"x:\file.pdf", FileMode.CreateNew);
|
||||
System.IO.BinaryWriter writer =
|
||||
new BinaryWriter(stream);
|
||||
writer.Write(pdfBytes, 0, pdfBytes.Length);
|
||||
writer.Close();
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private async Task<byte[]> CallExternalPdfApi(string json)
|
||||
{
|
||||
@@ -148,6 +139,7 @@ ELSE
|
||||
var data = Encoding.UTF8.GetBytes(jsonstring);
|
||||
string OwnHost = System.Configuration.ConfigurationManager.AppSettings["OwnHost"].ToString();
|
||||
string uri = OwnHost + "/API/CreateCLM";
|
||||
uri = OwnHost + "/API/DokumentGenerator";
|
||||
request = WebRequest.Create(uri);
|
||||
request.ContentLength = data.Length;
|
||||
request.ContentType = "application/json";
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace API_NetFramework.Controllers
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("API/GetUnterschriftAsBase64New")]
|
||||
[Route("API/GetUnterschriftAsBase64IL")]
|
||||
public IHttpActionResult GetUnterschriftAsBase64IL(string TGNummer, int ImageWidth = 0, int ImageHeight = 0)
|
||||
{
|
||||
|
||||
@@ -156,11 +156,13 @@ namespace API_NetFramework.Controllers
|
||||
apireturn.field = "";
|
||||
try
|
||||
{
|
||||
return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
//return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
return Content(HttpStatusCode.BadRequest, apireturn);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
//return Content(HttpStatusCode.Unauthorized, "Invalid Token or API-Key");
|
||||
return Content(HttpStatusCode.BadRequest, apireturn);
|
||||
}
|
||||
finally { apireturn = null; };
|
||||
}
|
||||
@@ -187,11 +189,13 @@ namespace API_NetFramework.Controllers
|
||||
|
||||
try
|
||||
{
|
||||
return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
//return BadRequest(Newtonsoft.Json.JsonConvert.SerializeObject(apireturn));
|
||||
return Content(HttpStatusCode.BadRequest, apireturn);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Content(HttpStatusCode.InternalServerError, "Unterschfit für TGNumemr " + TGNummer + " nicht vorhanden");
|
||||
//return Content(HttpStatusCode.InternalServerError, "Unterschfit für TGNumemr " + TGNummer + " nicht vorhanden");
|
||||
return Content(HttpStatusCode.BadRequest, apireturn);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -242,11 +246,12 @@ namespace API_NetFramework.Controllers
|
||||
apiok.file=Convert.ToBase64String(imageBytes);
|
||||
try
|
||||
{
|
||||
return Ok(Newtonsoft.Json.JsonConvert.SerializeObject(apiok));
|
||||
return Ok(apiok);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
//return Content(HttpStatusCode.InternalServerError, e.Message);
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
+110
-84
@@ -4,24 +4,24 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>JSON Editor → PDF Preview</title>
|
||||
<script>
|
||||
|
||||
|
||||
</script>
|
||||
<script>
|
||||
|
||||
|
||||
</script>
|
||||
<!-- ACE
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.32.6/ace.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.32.6/mode-json.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.32.6/theme-tomorrow.min.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
|
||||
-->
|
||||
|
||||
|
||||
<script src="/Scripts/ace/ace.js"></script>
|
||||
<script src="/Scripts/ace/mode-json.min.js"></script>
|
||||
<script src="/Scripts/ace/theme-tomorrow.min.js"></script>
|
||||
<script src="/Scripts/ace/worker-json.js"></script>
|
||||
<script src="/Scripts/jquery.min.js"></script>
|
||||
<script src="/Scripts/ace/ext-searchbox.js"></script>
|
||||
|
||||
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
@@ -34,15 +34,15 @@
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.toolbar input {
|
||||
width: 220px;
|
||||
padding: 4px;
|
||||
}
|
||||
.toolbar input {
|
||||
width: 220px;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.toolbar button {
|
||||
margin-left: 5px;
|
||||
padding: 6px 10px;
|
||||
}
|
||||
.toolbar button {
|
||||
margin-left: 5px;
|
||||
padding: 6px 10px;
|
||||
}
|
||||
|
||||
.container {
|
||||
display: flex;
|
||||
@@ -75,91 +75,117 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="toolbar">
|
||||
<label>Schlüssel:</label>
|
||||
<input type="text" id="key" placeholder="provDokumentID" />
|
||||
<button onclick="loadJson()">Laden</button>
|
||||
<button onclick="saveJson()">Speichern</button>
|
||||
<button onclick="generatePdf()">PDF generieren</button>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<!-- LINKS: JSON -->
|
||||
<div class="left">
|
||||
<div id="editor">{}</div>
|
||||
<div class="toolbar">
|
||||
<label>Schlüssel:</label>
|
||||
<input type="text" id="key" placeholder="provDokumentID" />
|
||||
<button onclick="loadJson()">Laden</button>
|
||||
<button onclick="saveJson()">Speichern</button>
|
||||
<button onclick="generatePdf()">PDF generieren</button>
|
||||
</div>
|
||||
|
||||
<!-- RECHTS: PDF -->
|
||||
<div class="right">
|
||||
<iframe id="pdfFrame" title="PDF Vorschau"></iframe>
|
||||
<div class="container">
|
||||
<!-- LINKS: JSON -->
|
||||
<div class="left">
|
||||
<div id="editor">{}</div>
|
||||
</div>
|
||||
|
||||
<!-- RECHTS: PDF -->
|
||||
<table>
|
||||
<tr>
|
||||
<div class="right">
|
||||
<iframe id="pdfFrame" title="PDF Vorschau"></iframe>
|
||||
</div>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const apiBase = "/api/json";
|
||||
<script>
|
||||
const apiBase = "/api/json";
|
||||
|
||||
|
||||
// ACE INIT
|
||||
const editor = ace.edit("editor");
|
||||
editor.setTheme("ace/theme/tomorrow");
|
||||
editor.session.setMode("ace/mode/json");
|
||||
editor.setShowPrintMargin(false);
|
||||
editor.session.setTabSize(2);
|
||||
editor.session.setUseSoftTabs(true);
|
||||
// ACE INIT
|
||||
const editor = ace.edit("editor");
|
||||
editor.setTheme("ace/theme/tomorrow");
|
||||
editor.session.setMode("ace/mode/json");
|
||||
editor.setShowPrintMargin(false);
|
||||
editor.session.setTabSize(2);
|
||||
editor.session.setUseSoftTabs(true);
|
||||
const editor1 = ace.edit("editor");
|
||||
editor1.setTheme("ace/theme/tomorrow");
|
||||
editor1.session.setMode("ace/mode/json");
|
||||
editor1.setShowPrintMargin(false);
|
||||
editor1.session.setTabSize(2);
|
||||
editor1.session.setUseSoftTabs(true);
|
||||
|
||||
// JSON LADEN
|
||||
function loadJson() {
|
||||
const key = $("#key").val();
|
||||
if (!key) { alert("Bitte Schlüssel eingeben"); return; }
|
||||
// JSON LADEN
|
||||
function loadJson() {
|
||||
|
||||
$.get(apiBase + "/load/" + encodeURIComponent(key))
|
||||
.done(data => editor.setValue(data, -1))
|
||||
.fail(() => alert("Kein Eintrag gefunden"));
|
||||
}
|
||||
editor.setValue("", -1);
|
||||
clearPdfPreview();
|
||||
const key = $("#key").val();
|
||||
if (!key) { alert("Bitte Schlüssel eingeben"); return; }
|
||||
|
||||
// JSON SPEICHERN
|
||||
function saveJson() {
|
||||
const key = $("#key").val();
|
||||
const json = editor.getValue();
|
||||
$.get(apiBase + "/load/" + encodeURIComponent(key))
|
||||
.done(data => editor.setValue(data, -1))
|
||||
.fail(() => alert("Kein Eintrag gefunden"));
|
||||
}
|
||||
|
||||
if (!key) { alert("Bitte Schlüssel eingeben"); return; }
|
||||
// JSON SPEICHERN
|
||||
function saveJson() {
|
||||
const key = $("#key").val();
|
||||
const json = editor.getValue();
|
||||
|
||||
try { JSON.parse(json); }
|
||||
catch { alert("Ungültiges JSON"); return; }
|
||||
if (!key) { alert("Bitte Schlüssel eingeben"); return; }
|
||||
|
||||
$.ajax({
|
||||
url: apiBase + "/save",
|
||||
type: "POST",
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify({ key: key, json: json }),
|
||||
success: () => alert("Gespeichert")
|
||||
});
|
||||
}
|
||||
// try { JSON.parse(json); }
|
||||
// catch { alert("Ungültiges JSON"); return; }
|
||||
|
||||
// PDF GENERIEREN & EMBEDDED ANZEIGEN
|
||||
function generatePdf() {
|
||||
const key = $("#key").val();
|
||||
if (!key) { alert("Bitte Schlüssel eingeben"); return; }
|
||||
$.ajax({
|
||||
url: apiBase + "/save",
|
||||
type: "POST",
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify({ key: key, json: json }),
|
||||
success: () => alert("Gespeichert")
|
||||
});
|
||||
}
|
||||
|
||||
fetch(apiBase + "/generatepdf", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
key: key,
|
||||
json: editor.getValue()
|
||||
// PDF GENERIEREN & EMBEDDED ANZEIGEN
|
||||
function generatePdf() {
|
||||
const key = $("#key").val();
|
||||
if (!key) { alert("Bitte Schlüssel eingeben"); return; }
|
||||
|
||||
fetch(apiBase + "/generatepdf", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
key: key,
|
||||
json: editor.getValue()
|
||||
})
|
||||
})
|
||||
})
|
||||
.then(r => {
|
||||
if (!r.ok) throw new Error("PDF-Fehler");
|
||||
return r.blob();
|
||||
})
|
||||
.then(blob => {
|
||||
const url = URL.createObjectURL(blob);
|
||||
document.getElementById("pdfFrame").src = url;
|
||||
})
|
||||
.catch(err => alert(err.message));
|
||||
}
|
||||
</script>
|
||||
.then(r => {
|
||||
if (!r.ok) throw new Error("PDF-Fehler");
|
||||
return r.blob();
|
||||
})
|
||||
.then(blob => {
|
||||
const url = URL.createObjectURL(blob);
|
||||
document.getElementById("pdfFrame").src = url;
|
||||
})
|
||||
.catch(err => alert(err.message));
|
||||
}
|
||||
function clearPdfPreview() {
|
||||
const frame = document.getElementById("pdfFrame");
|
||||
|
||||
// iframe leeren
|
||||
frame.src = "";
|
||||
|
||||
// optional: alte Blob-URL freigeben
|
||||
if (frame.dataset.blobUrl) {
|
||||
URL.revokeObjectURL(frame.dataset.blobUrl);
|
||||
frame.dataset.blobUrl = "";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user