get info DONE!
This commit is contained in:
parent
96f05cd518
commit
b07437dbfa
2 changed files with 15 additions and 23 deletions
|
@ -260,23 +260,7 @@ public class GetInfoOnPDF {
|
||||||
|
|
||||||
// Digital Signatures using iText7 TODO
|
// Digital Signatures using iText7 TODO
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PDAcroForm pdAcroForm = pdfBoxDoc.getDocumentCatalog().getAcroForm();
|
|
||||||
ArrayNode formFieldsArray2 = objectMapper.createArrayNode();
|
|
||||||
if (pdAcroForm != null) {
|
|
||||||
|
|
||||||
for (PDField field : pdAcroForm.getFields()) {
|
|
||||||
ObjectNode fieldNode = objectMapper.createObjectNode();
|
|
||||||
fieldNode.put("FieldName", field.getFullyQualifiedName());
|
|
||||||
fieldNode.put("FieldType", field.getFieldType());
|
|
||||||
// Add more attributes as needed...
|
|
||||||
formFieldsArray2.add(fieldNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
jsonOutput.set("FormFields2", formFieldsArray2);
|
|
||||||
|
|
||||||
|
|
||||||
PDStructureTreeRoot structureTreeRoot = pdfBoxDoc.getDocumentCatalog().getStructureTreeRoot();
|
PDStructureTreeRoot structureTreeRoot = pdfBoxDoc.getDocumentCatalog().getStructureTreeRoot();
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<th:block th:insert="~{fragments/common :: game}"></th:block>
|
|
||||||
<div id="page-container">
|
<div id="page-container">
|
||||||
<div id="content-wrap">
|
<div id="content-wrap">
|
||||||
<div th:insert="~{fragments/navbar.html :: navbar}"></div>
|
<div th:insert="~{fragments/navbar.html :: navbar}"></div>
|
||||||
|
@ -71,14 +70,17 @@
|
||||||
|
|
||||||
|
|
||||||
function renderJsonSection(key, value, depth = 0) {
|
function renderJsonSection(key, value, depth = 0) {
|
||||||
|
// Replace spaces and other non-alphanumeric characters with underscores for valid IDs
|
||||||
|
let safeKey = (typeof key === "string") ? key.replace(/[^a-zA-Z0-9]/g, '_') : key;
|
||||||
|
|
||||||
let output = `<div class="card mb-3">
|
let output = `<div class="card mb-3">
|
||||||
<div class="card-header" id="${key}-heading-${depth}">
|
<div class="card-header" id="${safeKey}-heading-${depth}">
|
||||||
<h5 class="mb-0">`;
|
<h5 class="mb-0">`;
|
||||||
|
|
||||||
// Check if the value is an object and has children
|
// Check if the value is an object and has children
|
||||||
if (value && typeof value === 'object' && Object.keys(value).length) {
|
if (value && typeof value === 'object' && (Object.keys(value).length || Array.isArray(value))) {
|
||||||
output += `
|
output += `
|
||||||
<button class="btn btn-link" type="button" data-toggle="collapse" data-target="#${key}-content-${depth}" aria-expanded="true" aria-controls="${key}-content-${depth}">
|
<button class="btn btn-link" type="button" data-toggle="collapse" data-target="#${safeKey}-content-${depth}" aria-expanded="true" aria-controls="${safeKey}-content-${depth}">
|
||||||
${key}
|
${key}
|
||||||
</button>`;
|
</button>`;
|
||||||
} else {
|
} else {
|
||||||
|
@ -89,7 +91,7 @@
|
||||||
output += `
|
output += `
|
||||||
</h5>
|
</h5>
|
||||||
</div>
|
</div>
|
||||||
<div id="${key}-content-${depth}" class="collapse" aria-labelledby="${key}-heading-${depth}">`;
|
<div id="${safeKey}-content-${depth}" class="collapse" aria-labelledby="${safeKey}-heading-${depth}">`;
|
||||||
|
|
||||||
// Check if the value is a nested object
|
// Check if the value is a nested object
|
||||||
if (typeof value === 'object' && !Array.isArray(value)) {
|
if (typeof value === 'object' && !Array.isArray(value)) {
|
||||||
|
@ -99,9 +101,13 @@
|
||||||
}
|
}
|
||||||
output += '</div>';
|
output += '</div>';
|
||||||
} else if (typeof value === 'object' && Array.isArray(value) && value.length) { // Array values
|
} else if (typeof value === 'object' && Array.isArray(value) && value.length) { // Array values
|
||||||
|
output += '<div class="card-body">';
|
||||||
value.forEach((val, index) => {
|
value.forEach((val, index) => {
|
||||||
output += renderJsonSection(index, val, depth + 1);
|
// For arrays, we're going to make the displayed key more descriptive.
|
||||||
|
const arrayKey = `${key}[${index}]`;
|
||||||
|
output += renderJsonSection(arrayKey, val, depth + 1);
|
||||||
});
|
});
|
||||||
|
output += '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
output += '</div></div>';
|
output += '</div></div>';
|
||||||
|
@ -109,6 +115,8 @@
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue