Skip to content

Commit 2605731

Browse files
committed
fix pdf form flatten fields
1 parent 99bc46b commit 2605731

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

lib/submissions/generate_result_attachments.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ def build_pdfs_index(submitter, flatten: true)
383383

384384
if flatten
385385
begin
386+
pdf.acro_form.create_appearances(force: true) if pdf.acro_form && pdf.acro_form[:NeedAppearances]
386387
pdf.acro_form&.flatten
387388
rescue StandardError => e
388389
Rollbar.error(e) if defined?(Rollbar)

lib/templates/process_document.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,15 @@ def generate_pdf_preview_images(attachment, data)
7474
end
7575
end
7676

77-
def maybe_flatten_form(data, pdf, attachment)
77+
def maybe_flatten_form(data, pdf)
7878
return data if data.size > MAX_FLATTEN_FILE_SIZE
7979
return data if pdf.acro_form.blank?
80-
return data if attachment.record.account.account_configs
81-
.find_or_initialize_by(key: AccountConfig::FLATTEN_RESULT_PDF_KEY).value == false
8280

8381
io = StringIO.new
8482

85-
pdf.acro_form&.flatten
83+
pdf.acro_form.create_appearances(force: true) if pdf.acro_form[:NeedAppearances]
84+
pdf.acro_form.flatten
85+
8686
pdf.write(io, incremental: false, validate: false)
8787

8888
io.string

0 commit comments

Comments
 (0)