Compare commits

...
2 Commits
Author SHA1 Message Date
Alex Turchyn 1daee8214c fix anonymous checkboxes form 2023-08-09 21:10:07 +03:00
Alex Turchyn 9cc85595e3 fix font size on large pdfs 2023-08-09 10:09:36 +03:00
2 changed files with 12 additions and 4 deletions

No files matched your search

+7
View File
@@ -195,6 +195,13 @@
>
<template v-if="isAnonymousChecboxes">
Complete hightlighted checkboxes and click <span class="font-semibold">{{ stepFields.length === currentStep + 1 ? 'submit' : 'next' }}</span>.
<input
v-for="field in currentStepFields"
:key="field.uuid"
type="hidden"
:name="`values[${field.uuid}]`"
:value="!!values[field.uuid]"
>
</template>
<template v-else>
<div
@@ -37,6 +37,7 @@ module Submissions
width = page.box.width
height = page.box.height
font_size = ((page.box.width / A4_SIZE[0].to_f) * FONT_SIZE).to_i
value = submitter.values[field['uuid']]
@@ -70,13 +71,13 @@ module Submissions
items = Array.wrap(value).each_with_object([]) do |uuid, acc|
attachment = submitter.attachments.find { |a| a.uuid == uuid }
acc << HexaPDF::Layout::InlineBox.create(width: FONT_SIZE, height: FONT_SIZE,
acc << HexaPDF::Layout::InlineBox.create(width: font_size, height: font_size,
margin: [0, 1, -2, 0]) do |cv, box|
cv.image(PdfIcons.paperclip_io, at: [0, 0], width: box.content_width)
end
acc << HexaPDF::Layout::TextFragment.create("#{attachment.filename}\n", font: pdf.fonts.add(FONT_NAME),
font_size: FONT_SIZE)
font_size:)
end
lines = layouter.fit(items, area['w'] * width, height).lines
@@ -132,7 +133,7 @@ module Submissions
value.chars.each_with_index do |char, index|
text = HexaPDF::Layout::TextFragment.create(char, font: pdf.fonts.add(FONT_NAME),
font_size: FONT_SIZE)
font_size:)
cell_layouter.fit([text], cell_width, area['h'] * height)
.draw(canvas, ((area['x'] * width) + (cell_width * index)),
@@ -142,7 +143,7 @@ module Submissions
value = I18n.l(Date.parse(value), format: :long) if field['type'] == 'date'
text = HexaPDF::Layout::TextFragment.create(Array.wrap(value).join(', '), font: pdf.fonts.add(FONT_NAME),
font_size: FONT_SIZE)
font_size:)
lines = layouter.fit([text], area['w'] * width, height).lines
box_height = lines.sum(&:height)