-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
146 changed files
with
1,217 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
itext.tests/itext.pdfocr.api.tests/itext/pdfocr/OcrPdfCreatorEventHelperTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
itext.tests/itext.pdfocr.api.tests/itext/pdfocr/OcrProcessContextTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
itext.tests/itext.pdfocr.api.tests/itext/pdfocr/PdfCreatorUtilTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
itext.tests/itext.pdfocr.api.tests/itext/pdfocr/PdfInputImageTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
itext.tests/itext.pdfocr.api.tests/itext/pdfocr/PdfLayersTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
itext.tests/itext.pdfocr.api.tests/itext/pdfocr/PdfOcrMetaInfoContainerTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
itext.tests/itext.pdfocr.api.tests/itext/pdfocr/ScaleModeTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
itext.tests/itext.pdfocr.api.tests/itext/pdfocr/exceptions/PdfOcrExceptionTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
itext.tests/itext.pdfocr.api.tests/itext/pdfocr/helpers/CustomOcrEngine.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
itext.tests/itext.pdfocr.api.tests/itext/pdfocr/helpers/CustomProductAwareOcrEngine.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
itext.tests/itext.pdfocr.api.tests/itext/pdfocr/helpers/ExtractionStrategy.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
itext.tests/itext.pdfocr.api.tests/itext/pdfocr/helpers/PdfHelper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
itext.tests/itext.pdfocr.api.tests/itext/pdfocr/helpers/TestProcessProperties.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
This file is part of the iText (R) project. | ||
Copyright (c) 1998-2024 Apryse Group NV | ||
Authors: Apryse Software. | ||
This program is offered under a commercial and under the AGPL license. | ||
For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. | ||
AGPL licensing: | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
using iText.Pdfocr; | ||
|
||
namespace iText.Pdfocr.Helpers { | ||
public class TestProcessProperties : IOcrProcessProperties { | ||
private float cellWidth; | ||
|
||
private float cellHeight; | ||
|
||
private float startX; | ||
|
||
private float startY; | ||
|
||
private int rowCount; | ||
|
||
private int columnCount; | ||
|
||
public TestProcessProperties(int rowCount, int columnCount, float cellWidth, float cellHeight, float startX | ||
, float startY) { | ||
this.rowCount = rowCount; | ||
this.columnCount = columnCount; | ||
this.cellWidth = cellWidth; | ||
this.cellHeight = cellHeight; | ||
this.startX = startX; | ||
this.startY = startY; | ||
} | ||
|
||
public virtual int GetRowCount() { | ||
return rowCount; | ||
} | ||
|
||
public virtual int GetColumnCount() { | ||
return columnCount; | ||
} | ||
|
||
public virtual float GetCellWidth() { | ||
return cellWidth; | ||
} | ||
|
||
public virtual float GetCellHeight() { | ||
return cellHeight; | ||
} | ||
|
||
public virtual float GetStartX() { | ||
return startX; | ||
} | ||
|
||
public virtual float GetStartY() { | ||
return startY; | ||
} | ||
} | ||
} |
89 changes: 89 additions & 0 deletions
89
itext.tests/itext.pdfocr.api.tests/itext/pdfocr/helpers/TestStructureDetectionOcrEngine.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* | ||
This file is part of the iText (R) project. | ||
Copyright (c) 1998-2024 Apryse Group NV | ||
Authors: Apryse Software. | ||
This program is offered under a commercial and under the AGPL license. | ||
For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. | ||
AGPL licensing: | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using iText.Kernel.Geom; | ||
using iText.Pdfocr; | ||
using iText.Pdfocr.Structuretree; | ||
|
||
namespace iText.Pdfocr.Helpers { | ||
public class TestStructureDetectionOcrEngine : IOcrEngine { | ||
public TestStructureDetectionOcrEngine() { | ||
} | ||
|
||
public virtual IDictionary<int, IList<TextInfo>> DoImageOcr(FileInfo input) { | ||
return null; | ||
} | ||
|
||
public virtual IDictionary<int, IList<TextInfo>> DoImageOcr(FileInfo input, OcrProcessContext ocrProcessContext | ||
) { | ||
TestProcessProperties processProperties = (TestProcessProperties)ocrProcessContext.GetOcrProcessProperties | ||
(); | ||
IList<TextInfo> textItems = new List<TextInfo>(); | ||
TableTreeItem table = new TableTreeItem(); | ||
float cellWidth = processProperties.GetCellWidth(); | ||
float cellHeight = processProperties.GetCellHeight(); | ||
float startX = processProperties.GetStartX(); | ||
float startY = processProperties.GetStartY(); | ||
float x = startX; | ||
float y = startY; | ||
for (int i = 0; i < processProperties.GetRowCount(); ++i) { | ||
TableRowTreeItem row = null; | ||
if (i > 0) { | ||
row = new TableRowTreeItem(); | ||
table.AddRow(row); | ||
} | ||
for (int j = 0; j < processProperties.GetColumnCount(); ++j) { | ||
TextInfo textInfo = new TextInfo(i + " " + j, new Rectangle(x, y, cellWidth, cellHeight)); | ||
// Mark the 1st row item as artifacts | ||
if (i == 0) { | ||
textInfo.SetLogicalStructureTreeItem(ArtifactItem.GetInstance()); | ||
} | ||
else { | ||
TableCellTreeItem cell = new TableCellTreeItem(); | ||
row.AddCell(cell); | ||
ParagraphTreeItem paragraph = new ParagraphTreeItem(); | ||
cell.AddChild(paragraph); | ||
SpanTreeItem span = new SpanTreeItem(); | ||
paragraph.AddChild(span); | ||
textInfo.SetLogicalStructureTreeItem(span); | ||
} | ||
textItems.Add(textInfo); | ||
x += cellWidth; | ||
} | ||
x = startX; | ||
y -= cellHeight; | ||
} | ||
IDictionary<int, IList<TextInfo>> result = new Dictionary<int, IList<TextInfo>>(); | ||
result.Put(1, textItems); | ||
return result; | ||
} | ||
|
||
public virtual void CreateTxtFile(IList<FileInfo> inputImages, FileInfo txtFile) { | ||
} | ||
|
||
public virtual void CreateTxtFile(IList<FileInfo> inputImages, FileInfo txtFile, OcrProcessContext ocrProcessContext | ||
) { | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...text.pdfocr.api.tests/itext/pdfocr/statistics/PdfOcrOutputTypeStatisticsAggregatorTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...sts/itext.pdfocr.api.tests/itext/pdfocr/statistics/PdfOcrOutputTypeStatisticsEventTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.