Verbessere Codequalität und Sicherheit durch Refactoring, Hinzufügen von ESLint-Regeln und Aktualisierung der OSV-Scanner-Konfiguration
This commit is contained in:
@@ -106,7 +106,7 @@ export async function fillFormFields(pdfDoc, form, data) {
|
||||
try {
|
||||
const helveticaFont = await pdfDoc.embedFont(StandardFonts.Helvetica)
|
||||
form.updateFieldAppearances(helveticaFont)
|
||||
} catch (_error) {
|
||||
} catch (error) {
|
||||
console.warn('Could not update field appearances:', error.message)
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,7 @@ export async function fillPdfForm(pdfDoc, form, data) {
|
||||
|
||||
// Check if PLZ/Ort field on page 1 is empty and fix it
|
||||
await fixPLZOrtField(pdfDoc, data)
|
||||
} catch (_error) {
|
||||
} catch (error) {
|
||||
console.warn('Form filling failed, using fallback:', error.message)
|
||||
await fillFormFieldsPositionally(pdfDoc, data)
|
||||
}
|
||||
@@ -136,7 +136,6 @@ export async function fillPdfForm(pdfDoc, form, data) {
|
||||
*/
|
||||
async function fixPLZOrtField(pdfDoc, data) {
|
||||
try {
|
||||
const pages = pdfDoc.getPages()
|
||||
await pdfDoc.embedFont(StandardFonts.Helvetica)
|
||||
|
||||
// Draw PLZ/Ort at the correct position on page 1
|
||||
@@ -160,7 +159,7 @@ async function fixPLZOrtField(pdfDoc, data) {
|
||||
}
|
||||
}
|
||||
|
||||
} catch (_error) {
|
||||
} catch (error) {
|
||||
console.warn('Could not fix PLZ/Ort field:', error.message)
|
||||
}
|
||||
}
|
||||
@@ -221,7 +220,7 @@ async function fillFormFieldsPositionally(pdfDoc, data) {
|
||||
firstPage.drawText('X', { x: 116, y: -8, size: 12, font: helveticaFont })
|
||||
}
|
||||
|
||||
} catch (_error) {
|
||||
} catch (error) {
|
||||
console.error('Positional filling failed:', error.message)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user