corp_pdf 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: fe571644d98559aebc1201878125a75eb96d1cda4a01f59d7c62a2783de9006c
4
+ data.tar.gz: ead3b549dbffce573981c5ecce1b4a08401a6eb23d407ed50c086388c551bd36
5
+ SHA512:
6
+ metadata.gz: a37bc26b4125c885fb121d170212ab75d4f85ce2f0366c53feb93a233128cfdd1ec1d01091ac77ba027bd6ed2daa0d960060a8e5d5a8353ff0d5422cdda5def3
7
+ data.tar.gz: d8cbba8496866a6a2e2326ec69a8206a2100d4693dc0d5d233cec930767da4d23bcc56e61ab51fc162ec2bc56be5033e398ae06f5c2e24910f182c476f183091
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ .byebug_history
2
+ .rspec_status
3
+
4
+ *.pdf
5
+ *.png
6
+ *.jpg
7
+ *.gem
8
+
9
+ research/
10
+ pdf_test_script.rb
11
+ .cursor/
12
+
13
+ .DS_Store
data/.rubocop.yml ADDED
@@ -0,0 +1,78 @@
1
+ # frozen_string_literal: true
2
+
3
+ require:
4
+ - rubocop-rspec
5
+
6
+ AllCops:
7
+ NewCops: enable
8
+ TargetRubyVersion: 3.1
9
+ Exclude:
10
+ - 'vendor/**/*'
11
+ - 'tmp/**/*'
12
+ - '*.gemspec'
13
+
14
+ # Disable problematic cops
15
+ Capybara/RSpec/PredicateMatcher:
16
+ Enabled: false
17
+
18
+ RSpec/FilePath:
19
+ Enabled: false
20
+
21
+ RSpec/SpecFilePathFormat:
22
+ Enabled: false
23
+
24
+ Style/Documentation:
25
+ Enabled: false
26
+
27
+ Style/StringLiterals:
28
+ EnforcedStyle: double_quotes
29
+
30
+ Style/FrozenStringLiteralComment:
31
+ Enabled: true
32
+
33
+ Layout/LineLength:
34
+ Max: 120
35
+
36
+ Metrics/AbcSize:
37
+ Max: 20
38
+
39
+ Metrics/MethodLength:
40
+ Max: 20
41
+
42
+ Metrics/ClassLength:
43
+ Max: 150
44
+
45
+ Metrics/ModuleLength:
46
+ Max: 150
47
+
48
+ Metrics/BlockLength:
49
+ Exclude:
50
+ - 'spec/**/*'
51
+ - 'Rakefile'
52
+
53
+ Style/ClassAndModuleChildren:
54
+ Enabled: false
55
+
56
+ Style/GuardClause:
57
+ Enabled: false
58
+
59
+ Style/IfUnlessModifier:
60
+ Enabled: false
61
+
62
+ Style/RedundantReturn:
63
+ Enabled: false
64
+
65
+ Style/RescueStandardError:
66
+ Enabled: false
67
+
68
+ Style/SafeNavigation:
69
+ Enabled: false
70
+
71
+ Style/TrivialAccessors:
72
+ Enabled: false
73
+
74
+ RSpec/ExampleLength:
75
+ Max: 10
76
+
77
+ RSpec/MultipleExpectations:
78
+ Max: 5
data/CHANGELOG.md ADDED
@@ -0,0 +1,122 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.5] - 2025-11-12
9
+
10
+ ### Changed
11
+ - Renamed gem from `acro_that` to `corp_pdf`
12
+ - Renamed module from `AcroThat` to `CorpPdf`
13
+ - Updated all internal references, documentation, and examples
14
+
15
+ ## [1.0.4] - 2025-11-12
16
+
17
+ ### Fixed
18
+ - Fixed `Encoding::CompatibilityError` when processing field values with special characters (e.g., "María", "José"). Special characters are now automatically transliterated to ASCII equivalents (e.g., "María" → "Maria") before encoding to PDF format, ensuring compatibility with PDF string encoding requirements.
19
+
20
+ ### Added
21
+ - Added I18n gem as a runtime dependency for transliteration support
22
+ - Added `DictScan.transliterate_to_ascii` method to convert special characters to ASCII equivalents
23
+ - Automatic transliteration for text field values and radio button field export values
24
+
25
+ ## [1.0.3] - 2025-11-07
26
+
27
+ ### Fixed
28
+ - Fixed `/DA` (default appearance) metadata handling for text fields. When `/DA` is provided in metadata, it is now properly applied to both field dictionaries and widget annotations for text fields.
29
+
30
+ ## [1.0.2] - 2025-11-06
31
+
32
+ ### Fixed
33
+ - Fixed xref table generation to properly handle missing object numbers. The xref table now correctly marks missing objects as free entries, ensuring PDF compatibility with viewers that strictly validate xref tables.
34
+
35
+ ### Changed
36
+ - Updated `.gitignore` to exclude image files (`.png`, `.jpg`) from version control
37
+
38
+ ## [1.0.1] - 2025-11-05
39
+
40
+ ### Fixed
41
+ - Fixed checkbox field appearance state handling
42
+ - Improved radio button field value handling and appearance updates
43
+ - Enhanced `update_field` to better handle checkbox and radio button state changes
44
+ - Fixed field type detection for button fields in `add_field`
45
+
46
+ ### Changed
47
+ - Refactored checkbox and radio button field creation logic for better consistency
48
+
49
+ ## [1.0.0] - 2025-11-05
50
+
51
+ ### Added
52
+ - Added radio button field support with `group_id` option for creating mutually exclusive radio button groups
53
+ - Refactored field types into separate classes (`Text`, `Checkbox`, `Radio`, `Signature`) for better code organization and maintainability
54
+ - Added `Fields::Base` module with shared functionality for all field types
55
+ - Improved field creation and update logic with better separation of concerns
56
+
57
+ ### Changed
58
+ - Major refactoring of field type handling - field types are now implemented as separate classes rather than inline conditionals
59
+ - Improved code organization and maintainability
60
+
61
+ ## [0.1.8] - 2025-11-04
62
+
63
+ ### Fixed
64
+ - Fixed PDF parsing error when PDFs are wrapped in multipart form data. PDFs uploaded via web forms (with boundary markers like `------WebKitFormBoundary...`) are now automatically extracted before processing, ensuring correct offset calculations for xref tables and streams.
65
+
66
+ ## [0.1.7] - 2025-11-03
67
+
68
+ ### Changed
69
+ - Memory optimization improvements for document processing and field operations
70
+
71
+ ## [0.1.6] - 2025-11-01
72
+
73
+ ### Added
74
+ - Added new utility methods to `DictScan` for improved PDF dictionary parsing and manipulation
75
+ - Enhanced `add_field` action with improved field creation logic
76
+ - Enhanced `update_field` action with better field value update handling
77
+
78
+ ### Changed
79
+ - Major refactoring of `add_field` and `update_field` actions for improved code organization
80
+ - Refactored `Document` class to reduce code duplication
81
+ - Improved field handling and metadata processing
82
+
83
+ ## [0.1.5] - 2025-11-01
84
+
85
+ ### Fixed
86
+ - Fixed signature field image data parsing when adding signature fields. Image data (base64 or data URI) is now properly detected and parsed when creating signature fields, matching the behavior of `update_field`.
87
+ - Fixed multiline text field handling
88
+
89
+ ### Added
90
+ - Added support for `metadata` option in `add_field` to pass PDF widget properties. This allows setting properties like field flags (`Ff`) for multiline text fields, alignment (`Q`), and other PDF widget options directly when creating fields.
91
+
92
+ ## [0.1.4] - 2025-11-01
93
+
94
+ ### Fixed
95
+ - Fixed bug where fields added to multi-page PDFs were all placed on the same page. Fields now correctly appear on their specified pages when using the `page` option in `add_field`.
96
+
97
+ ### Changed
98
+ - Refactored page-finding logic to eliminate code duplication across `Document` and `AddField` classes
99
+ - Unified page discovery through `Document#find_all_pages` and `Document#find_page_by_number` methods
100
+ - Updated all page detection patterns to use centralized `DictScan.is_page?` utility method
101
+
102
+ ### Added
103
+ - `DictScan.is_page?` utility method for consistent page object detection across the codebase
104
+ - `Document#find_all_pages` private method for unified page discovery in document order
105
+ - `Document#find_page_by_number` private method for finding pages by page number
106
+ - Exposed `find_page_by_number` through `Base` module for use in action classes
107
+
108
+ ## [0.1.3] - 2025-11-01
109
+
110
+ ### Changed
111
+ - Version bump release
112
+
113
+ ## [0.1.1] - 2025-10-31
114
+
115
+ ### Added
116
+ - Initial release of CorpPdf
117
+ - Pure Ruby PDF AcroForm editing library
118
+ - Support for parsing, listing, adding, removing, and modifying form fields
119
+ - Signature field image appearance support (JPEG and PNG)
120
+ - PDF flattening functionality
121
+ - StringIO support for in-memory PDF processing
122
+
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,90 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ corp_pdf (1.0.5)
5
+ chunky_png (~> 1.4)
6
+ i18n (~> 1.14)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ ast (2.4.3)
12
+ chunky_png (1.4.0)
13
+ coderay (1.1.3)
14
+ concurrent-ruby (1.3.5)
15
+ diff-lcs (1.6.2)
16
+ i18n (1.14.7)
17
+ concurrent-ruby (~> 1.0)
18
+ json (2.15.2)
19
+ language_server-protocol (3.17.0.5)
20
+ lint_roller (1.1.0)
21
+ method_source (1.1.0)
22
+ parallel (1.27.0)
23
+ parser (3.3.10.0)
24
+ ast (~> 2.4.1)
25
+ racc
26
+ prism (1.6.0)
27
+ pry (0.15.2)
28
+ coderay (~> 1.1)
29
+ method_source (~> 1.0)
30
+ racc (1.8.1)
31
+ rainbow (3.1.1)
32
+ regexp_parser (2.11.3)
33
+ rspec (3.13.2)
34
+ rspec-core (~> 3.13.0)
35
+ rspec-expectations (~> 3.13.0)
36
+ rspec-mocks (~> 3.13.0)
37
+ rspec-core (3.13.6)
38
+ rspec-support (~> 3.13.0)
39
+ rspec-expectations (3.13.5)
40
+ diff-lcs (>= 1.2.0, < 2.0)
41
+ rspec-support (~> 3.13.0)
42
+ rspec-mocks (3.13.6)
43
+ diff-lcs (>= 1.2.0, < 2.0)
44
+ rspec-support (~> 3.13.0)
45
+ rspec-support (3.13.6)
46
+ rubocop (1.81.6)
47
+ json (~> 2.3)
48
+ language_server-protocol (~> 3.17.0.2)
49
+ lint_roller (~> 1.1.0)
50
+ parallel (~> 1.10)
51
+ parser (>= 3.3.0.2)
52
+ rainbow (>= 2.2.2, < 4.0)
53
+ regexp_parser (>= 2.9.3, < 3.0)
54
+ rubocop-ast (>= 1.47.1, < 2.0)
55
+ ruby-progressbar (~> 1.7)
56
+ unicode-display_width (>= 2.4.0, < 4.0)
57
+ rubocop-ast (1.47.1)
58
+ parser (>= 3.3.7.2)
59
+ prism (~> 1.4)
60
+ rubocop-capybara (2.22.1)
61
+ lint_roller (~> 1.1)
62
+ rubocop (~> 1.72, >= 1.72.1)
63
+ rubocop-factory_bot (2.27.1)
64
+ lint_roller (~> 1.1)
65
+ rubocop (~> 1.72, >= 1.72.1)
66
+ rubocop-rspec (2.31.0)
67
+ rubocop (~> 1.40)
68
+ rubocop-capybara (~> 2.17)
69
+ rubocop-factory_bot (~> 2.22)
70
+ rubocop-rspec_rails (~> 2.28)
71
+ rubocop-rspec_rails (2.29.1)
72
+ rubocop (~> 1.61)
73
+ ruby-progressbar (1.13.0)
74
+ unicode-display_width (3.2.0)
75
+ unicode-emoji (~> 4.1)
76
+ unicode-emoji (4.1.0)
77
+
78
+ PLATFORMS
79
+ arm64-darwin-22
80
+ ruby
81
+
82
+ DEPENDENCIES
83
+ corp_pdf!
84
+ pry (~> 0.14)
85
+ rspec (~> 3.0)
86
+ rubocop (~> 1.50)
87
+ rubocop-rspec (~> 2.20)
88
+
89
+ BUNDLED WITH
90
+ 2.5.21