@@ -17,6 +17,9 @@ public final class PdfConfig {
1717 private final boolean extractMetadata ;
1818 private final FontConfig fontConfig ;
1919 private final HierarchyConfig hierarchyConfig ;
20+ private final boolean extractAnnotations ;
21+ private final Double topMarginFraction ;
22+ private final Double bottomMarginFraction ;
2023
2124 private PdfConfig (Builder builder ) {
2225 this .extractImages = builder .extractImages ;
@@ -26,6 +29,9 @@ private PdfConfig(Builder builder) {
2629 this .extractMetadata = builder .extractMetadata ;
2730 this .fontConfig = builder .fontConfig ;
2831 this .hierarchyConfig = builder .hierarchyConfig ;
32+ this .extractAnnotations = builder .extractAnnotations ;
33+ this .topMarginFraction = builder .topMarginFraction ;
34+ this .bottomMarginFraction = builder .bottomMarginFraction ;
2935 }
3036
3137 public static Builder builder () {
@@ -52,19 +58,38 @@ public HierarchyConfig getHierarchyConfig() {
5258 return hierarchyConfig ;
5359 }
5460
61+ public boolean isExtractAnnotations () {
62+ return extractAnnotations ;
63+ }
64+
65+ public Double getTopMarginFraction () {
66+ return topMarginFraction ;
67+ }
68+
69+ public Double getBottomMarginFraction () {
70+ return bottomMarginFraction ;
71+ }
72+
5573 public Map <String , Object > toMap () {
5674 Map <String , Object > map = new HashMap <>();
5775 map .put ("extract_images" , extractImages );
5876 if (passwords != null && !passwords .isEmpty ()) {
5977 map .put ("passwords" , passwords );
6078 }
6179 map .put ("extract_metadata" , extractMetadata );
80+ map .put ("extract_annotations" , extractAnnotations );
6281 if (fontConfig != null ) {
6382 map .put ("font_config" , fontConfig .toMap ());
6483 }
6584 if (hierarchyConfig != null ) {
6685 map .put ("hierarchy" , hierarchyConfig .toMap ());
6786 }
87+ if (topMarginFraction != null ) {
88+ map .put ("top_margin_fraction" , topMarginFraction );
89+ }
90+ if (bottomMarginFraction != null ) {
91+ map .put ("bottom_margin_fraction" , bottomMarginFraction );
92+ }
6893 return map ;
6994 }
7095
@@ -74,6 +99,9 @@ public static final class Builder {
7499 private boolean extractMetadata = true ;
75100 private FontConfig fontConfig ;
76101 private HierarchyConfig hierarchyConfig ;
102+ private boolean extractAnnotations = false ;
103+ private Double topMarginFraction ;
104+ private Double bottomMarginFraction ;
77105
78106 private Builder () {
79107 }
@@ -111,6 +139,21 @@ public Builder hierarchyConfig(HierarchyConfig hierarchyConfig) {
111139 return this ;
112140 }
113141
142+ public Builder extractAnnotations (boolean extractAnnotations ) {
143+ this .extractAnnotations = extractAnnotations ;
144+ return this ;
145+ }
146+
147+ public Builder topMarginFraction (Double topMarginFraction ) {
148+ this .topMarginFraction = topMarginFraction ;
149+ return this ;
150+ }
151+
152+ public Builder bottomMarginFraction (Double bottomMarginFraction ) {
153+ this .bottomMarginFraction = bottomMarginFraction ;
154+ return this ;
155+ }
156+
114157 public PdfConfig build () {
115158 return new PdfConfig (this );
116159 }
@@ -141,6 +184,18 @@ static PdfConfig fromMap(Map<String, Object> map) {
141184 if (extractMetadataValue instanceof Boolean ) {
142185 builder .extractMetadata ((Boolean ) extractMetadataValue );
143186 }
187+ Object extractAnnotationsValue = map .get ("extract_annotations" );
188+ if (extractAnnotationsValue instanceof Boolean ) {
189+ builder .extractAnnotations ((Boolean ) extractAnnotationsValue );
190+ }
191+ Object topMarginValue = map .get ("top_margin_fraction" );
192+ if (topMarginValue instanceof Number ) {
193+ builder .topMarginFraction (((Number ) topMarginValue ).doubleValue ());
194+ }
195+ Object bottomMarginValue = map .get ("bottom_margin_fraction" );
196+ if (bottomMarginValue instanceof Number ) {
197+ builder .bottomMarginFraction (((Number ) bottomMarginValue ).doubleValue ());
198+ }
144199 @ SuppressWarnings ("unchecked" )
145200 Map <String , Object > fontConfigMap = map .get ("font_config" ) instanceof Map
146201 ? (Map <String , Object >) map .get ("font_config" )
0 commit comments