From cdb8eb7931a97cadb4bdbf7683e5d31c7e63eae4 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Thu, 18 Apr 2024 22:25:04 +0300 Subject: [PATCH] fix pdf number of pages --- lib/templates/process_document.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/templates/process_document.rb b/lib/templates/process_document.rb index 9926f821..9326c224 100644 --- a/lib/templates/process_document.rb +++ b/lib/templates/process_document.rb @@ -45,7 +45,8 @@ module Templates ActiveStorage::Attachment.where(name: ATTACHMENT_NAME, record: attachment).destroy_all number_of_pages = HexaPDF::Document.new(io: StringIO.new(data)).pages.size - (attachment.metadata['pdf'] ||= {})[:number_of_pages] = number_of_pages + attachment.metadata['pdf'] ||= {} + attachment.metadata['pdf']['number_of_pages'] = number_of_pages attachment.save!