Skip to content

Commit

Permalink
TODO: FIX LATER! - Potential fix for invalid PDFs with checkboxes wit…
Browse files Browse the repository at this point in the history
…h string values
  • Loading branch information
gettalong committed Aug 30, 2024
1 parent d411e84 commit 0a0d894
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/hexapdf/type/acro_form/appearance_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0a0d894

Please sign in to comment.