process pdf v2

This commit is contained in:
Pete Matsyburka committed 2026-09-03 11:48:54 +03:00
1 parent 785eb789ad
commit f9669b0e16
9 files changed
+59 -458

No files matched your search

+6 -2
View File
@@ -435,7 +435,9 @@ module Templates
end
def save_document(template, old_attachment, data)
annotations = data.size < ANNOTATIONS_SIZE_LIMIT ? Templates::BuildAnnotations.call(data) : []
doc = Pdfium::Document.open_io(StringIO.new(data))
annotations = data.size < ANNOTATIONS_SIZE_LIMIT ? Templates::BuildPdfiumAnnotations.call(doc) : []
sha256 = Base64.urlsafe_encode64(Digest::SHA256.digest(data))
blob = ActiveStorage::Blob.create_and_upload!(
@@ -448,7 +450,9 @@ module Templates
document = template.documents.create!(blob:)
Templates::ProcessDocument.call(document, data)
Templates::ProcessDocument.call(document, data, doc:)
ensure
doc&.close
end
def remap_fields(template, mapping)