Skip to content

Commit 78b9822

Browse files
committed
Move sharpen configuration from sharpen
DEVSIX-8602
1 parent e6b3b33 commit 78b9822

File tree

2 files changed

+95
-0
lines changed

2 files changed

+95
-0
lines changed
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/*
2+
This file is part of the iText (R) project.
3+
Copyright (c) 1998-2025 Apryse Group NV
4+
Authors: Apryse Software.
5+
6+
This program is offered under a commercial and under the AGPL license.
7+
For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below.
8+
9+
AGPL licensing:
10+
This program is free software: you can redistribute it and/or modify
11+
it under the terms of the GNU Affero General Public License as published by
12+
the Free Software Foundation, either version 3 of the License, or
13+
(at your option) any later version.
14+
15+
This program is distributed in the hope that it will be useful,
16+
but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
GNU Affero General Public License for more details.
19+
20+
You should have received a copy of the GNU Affero General Public License
21+
along with this program. If not, see <https://www.gnu.org/licenses/>.
22+
*/
23+
package com.itextpdf.pdfocr;
24+
25+
import java.util.AbstractMap.SimpleImmutableEntry;
26+
import java.util.Collection;
27+
import java.util.Collections;
28+
import java.util.List;
29+
import sharpen.config.MappingConfiguration;
30+
import sharpen.config.MappingConfigurator;
31+
import sharpen.config.ModuleOption;
32+
import sharpen.config.ModulesConfigurator;
33+
import sharpen.config.OptionsConfigurator;
34+
35+
public class SharpenConfigMapping implements MappingConfiguration {
36+
37+
@Override
38+
public int getMappingPriority() {
39+
return 6;
40+
}
41+
42+
@Override
43+
public String getModuleName() {
44+
return "pdfocr-api";
45+
}
46+
47+
@Override
48+
public void applyMappingConfiguration(MappingConfigurator configurator) {
49+
configurator.mapStringLiteral("com.itextpdf.pdfocr.PdfOcrFontProvider.DEFAULT_FONT_PATH", "iText.Pdfocr.Api.font.LiberationSans-Regular.ttf");
50+
51+
// It's fine to use System.IO.StreamWriter in this mapping instead of the iText.Commons.Utils.FormattingStreamWriter
52+
// because java.io.FileWriter only works with the characters writing, so there are no locale-dependent conversions.
53+
configurator.ignoreUsing("Java.IO");
54+
configurator.ignoreUsing("Java.Nio");
55+
// images
56+
configurator.addFullName("System.Drawing.Bitmap");
57+
configurator.ignoreUsing("Javax.Imageio");
58+
}
59+
60+
@Override
61+
public void applySharpenOptions(OptionsConfigurator configurator) {
62+
63+
}
64+
65+
@Override
66+
public void applyConfigModuleSettings(ModulesConfigurator configurator) {
67+
68+
}
69+
70+
@Override
71+
public Collection<ModuleOption> getAvailableModuleSettings() {
72+
return Collections.EMPTY_SET;
73+
}
74+
75+
@Override
76+
public Collection<String> getDependencies() {
77+
return Collections.EMPTY_LIST;
78+
}
79+
80+
@Override
81+
public Collection<String> getIgnoredSourceFiles() {
82+
return Collections.EMPTY_LIST;
83+
}
84+
85+
@Override
86+
public Collection<String> getIgnoredResources() {
87+
return Collections.EMPTY_LIST;
88+
}
89+
90+
@Override
91+
public List<SimpleImmutableEntry<String, String>> getOverwrittenResources() {
92+
return Collections.EMPTY_LIST;
93+
}
94+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
com.itextpdf.pdfocr.SharpenConfigMapping

0 commit comments

Comments
 (0)