add background

This commit is contained in:
Pete Matsyburka
2025-10-29 10:10:04 +02:00
parent 9163f744a3
commit 32691b0c0d
3 changed files with 14 additions and 1 deletions
@@ -244,6 +244,7 @@ module Submissions
font_size ||= (([page.box.width, page.box.height].min / A4_SIZE[0].to_f) * FONT_SIZE).to_i
fill_color = field.dig('preferences', 'color').to_s.delete_prefix('#').presence
bg_color = field.dig('preferences', 'background').to_s.delete_prefix('#').presence
font_name = field.dig('preferences', 'font')
font_variant = (field.dig('preferences', 'font_type').presence || 'none').to_sym
@@ -289,6 +290,13 @@ module Submissions
with_signature_id = field['preferences']['with_signature_id']
end
if bg_color.present?
canvas.fill_color(bg_color)
.rectangle(area['x'] * width, height - (area['y'] * height) - (area['h'] * height),
area['w'] * width, area['h'] * height)
.fill
end
case field_type
when ->(type) { type == 'signature' && (with_signature_id || field.dig('preferences', 'reason_field_uuid')) }
attachment = submitter.attachments.find { |a| a.uuid == value }