unidoc / unipdf

Golang PDF library for creating and processing PDF files (pure go)
https://unidoc.io
Other
2.5k stars 249 forks source link

Combo field appearance #370

Closed adrg closed 4 years ago

adrg commented 4 years ago

Addresses #270

Partially addresses #341: both the fill and flatten operations work as intended. However, the PDF seems to be invalid the sense that the choice/combo field has an I array with a single value present, which causes the first value in the selection list to always be shown when opening the file. According to the specifications, the I field should be used only for fields that support multiple selection, which is not the case there. Setting that field to nil before the fill operation should solve the issue (the flatten operation works as intended using the PR, without removing the I value). See section 12.7.4.4 "Choice Fields" (pp. 444-446) of the PDF specs for more details.


This change is Reviewable

codecov[bot] commented 4 years ago

Codecov Report

Merging #370 into development will decrease coverage by 0.00%. The diff coverage is 58.82%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development     #370      +/-   ##
===============================================
- Coverage        56.54%   56.54%   -0.01%     
===============================================
  Files              236      236              
  Lines            45786    45798      +12     
===============================================
+ Hits             25891    25895       +4     
- Misses           16555    16563       +8     
  Partials          3340     3340              
Impacted Files Coverage Δ
annotator/field_appearance.go 51.48% <0.00%> (-0.07%) :arrow_down:
model/flatten.go 64.22% <33.33%> (ø)
model/form.go 61.53% <76.00%> (-1.51%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 6cb58f6...542bf32. Read the comment docs.