mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-10-15 19:54:52 +08:00
Adding handling when pageWords count = 0 for IPageSegmenters
This commit is contained in:
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using UglyToad.PdfPig.Content;
|
||||
using UglyToad.PdfPig.Geometry;
|
||||
using UglyToad.PdfPig.Util;
|
||||
|
||||
namespace UglyToad.PdfPig.DocumentLayoutAnalysis
|
||||
{
|
||||
@@ -47,6 +48,8 @@ namespace UglyToad.PdfPig.DocumentLayoutAnalysis
|
||||
public IReadOnlyList<TextBlock> GetBlocks(IEnumerable<Word> pageWords, double wlAngleLB, double wlAngleUB,
|
||||
double blAngleLB, double blAngleUB, double blMultiplier)
|
||||
{
|
||||
if (pageWords.Count() == 0) return EmptyArray<TextBlock>.Instance;
|
||||
|
||||
var pageWordsArr = pageWords.Where(w => !string.IsNullOrWhiteSpace(w.Text)).ToArray(); // remove white spaces
|
||||
|
||||
var withinLineDistList = new ConcurrentBag<double[]>();
|
||||
|
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UglyToad.PdfPig.Content;
|
||||
using UglyToad.PdfPig.Util;
|
||||
|
||||
namespace UglyToad.PdfPig.DocumentLayoutAnalysis
|
||||
{
|
||||
@@ -64,6 +65,8 @@ namespace UglyToad.PdfPig.DocumentLayoutAnalysis
|
||||
Func<IEnumerable<decimal>, decimal> dominantFontWidthFunc,
|
||||
Func<IEnumerable<decimal>, decimal> dominantFontHeightFunc)
|
||||
{
|
||||
if (pageWords.Count() == 0) return EmptyArray<TextBlock>.Instance;
|
||||
|
||||
XYLeaf root = new XYLeaf(pageWords); // Create a root node.
|
||||
XYNode node = VerticalCut(root, minimumWidth, dominantFontWidthFunc, dominantFontHeightFunc);
|
||||
|
||||
|
Reference in New Issue
Block a user