Fix MICR font path, date import, PDF button bug; clean up config; add TODO markers
- Hardcode GnuMICR.otf path in pdfService.js; remove MICR_FONT_PATH env var - Fix normalizeDate to handle MM/DD/YY (2-digit year) and return null on no match - Fix generatePdf button DOM bug: update span directly instead of overwriting textContent - Remove .env.example and NTFY_URL from docker-compose (app has no required config) - Remove redundant fonts volume mount from docker-compose (fonts bundled in image) - Mark MVP TODO items complete; add // TODO comments in source for post-MVP features - Update README: correct slot height, remove stale env var docs
This commit is contained in:
@@ -28,9 +28,7 @@ const MICR_Y_IN = SLOT_HEIGHT_IN - 0.267; // 0.267" from bottom of slot
|
||||
// MICR line format: transit symbol (⑆) and on-us symbol (⑈) in E-13B encoding.
|
||||
// The GnuMICR / micrenc font maps these to specific characters.
|
||||
// Standard MICR layout: [check#] ⑆[routing]⑆ [account#]⑈
|
||||
const MICR_FONT_PATH = process.env.MICR_FONT_PATH
|
||||
? path.resolve(process.env.MICR_FONT_PATH)
|
||||
: path.join(__dirname, '../../fonts/micrenc.ttf');
|
||||
const MICR_FONT_PATH = path.join(__dirname, '../../fonts/GnuMICR.otf');
|
||||
|
||||
// Amount in words conversion
|
||||
function amountToWords(amount) {
|
||||
@@ -121,9 +119,11 @@ function generateCheckPdf(account, checks, fields) {
|
||||
doc.on('end', () => resolve(Buffer.concat(buffers)));
|
||||
doc.on('error', reject);
|
||||
|
||||
// TODO: Add 1-up with stub layout -- render Stub-prefixed fields from layout_fields alongside the check body
|
||||
|
||||
// Separate layout fields into check body vs stub fields
|
||||
const bodyFields = fields.filter(f => !f.field_name.startsWith('Stub'));
|
||||
const stubFields = fields.filter(f => f.field_name.startsWith('Stub'));
|
||||
const stubFields = fields.filter(f => f.field_name.startsWith('Stub')); // eslint-disable-line no-unused-vars
|
||||
|
||||
// We always render 3 slots; empty slots get a blank placeholder
|
||||
for (let slot = 0; slot < 3; slot++) {
|
||||
@@ -261,6 +261,8 @@ function resolveFieldValue(fieldName, check, account) {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Add visual layout editor -- UI to nudge field X/Y positions and printer offset calibration (offset_left/right/up/down)
|
||||
|
||||
/**
|
||||
* Sets the PDFKit font based on a layout field's font properties.
|
||||
* Falls back to Helvetica if the stored font name is not a built-in.
|
||||
|
||||
Reference in New Issue
Block a user