From 0a0d8947d58c02bb09fc657599363625da2d9c0a Mon Sep 17 00:00:00 2001 From: Thomas Leitner Date: Fri, 30 Aug 2024 22:42:40 +0200 Subject: [PATCH] TODO: FIX LATER! - Potential fix for invalid PDFs with checkboxes with string values --- lib/hexapdf/type/acro_form/appearance_generator.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/hexapdf/type/acro_form/appearance_generator.rb b/lib/hexapdf/type/acro_form/appearance_generator.rb index 61584eba..73445a36 100644 --- a/lib/hexapdf/type/acro_form/appearance_generator.rb +++ b/lib/hexapdf/type/acro_form/appearance_generator.rb @@ -134,12 +134,12 @@ def create_check_box_appearances if !normal_appearance.kind_of?(HexaPDF::Dictionary) || normal_appearance.kind_of?(HexaPDF::Stream) (@widget[:AP] ||= {})[:N] = {Off: nil} normal_appearance = @widget[:AP][:N] - normal_appearance[@field[:V] == :Off ? :Yes : @field[:V]] = nil + normal_appearance[@field[:V] == :Off ? :Yes : @field[:V].to_sym] = nil end on_name = (normal_appearance.value.keys - [:Off]).first unless on_name on_name = :Yes - normal_appearance[@field[:V] == :Off ? on_name : @field[:V]] = nil + normal_appearance[@field[:V] == :Off ? on_name : @field[:V].to_sym] = nil end @widget[:AS] = (@field[:V] == on_name ? on_name : :Off)