mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-09-19 19:07:56 +08:00
update XYLeaf with word separator
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using UglyToad.PdfPig.DocumentLayoutAnalysis.ReadingOrderDetector;
|
||||||
using UglyToad.PdfPig.Geometry;
|
using UglyToad.PdfPig.Geometry;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -38,20 +39,19 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the lines of the leaf.
|
/// Gets the lines of the leaf.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IReadOnlyList<TextLine> GetLines()
|
public IReadOnlyList<TextLine> GetLines(string wordSeparator)
|
||||||
{
|
{
|
||||||
return Words.GroupBy(x => x.BoundingBox.Bottom).OrderByDescending(x => x.Key)
|
return Words.GroupBy(x => x.BoundingBox.Bottom)
|
||||||
.Select(x => new TextLine(x.ToList())).ToArray();
|
.Select(x => new TextLine(x.OrderByReadingOrder(), wordSeparator))
|
||||||
|
.OrderByReadingOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new <see cref="XYLeaf"/>.
|
/// Create a new <see cref="XYLeaf"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="words">The words contained in the leaf.</param>
|
/// <param name="words">The words contained in the leaf.</param>
|
||||||
public XYLeaf(params Word[] words) : this(words == null ? null : words.ToList())
|
public XYLeaf(params Word[] words) : this(words?.ToList())
|
||||||
{
|
{ }
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new <see cref="XYLeaf"/>.
|
/// Create a new <see cref="XYLeaf"/>.
|
||||||
|
Reference in New Issue
Block a user