PdfTextExtractor: Calculate PdfTextElement height

This commit is contained in:
2016-06-21 15:19:39 +02:00
parent 44f6cb3d0c
commit baea8aabc2
4 changed files with 59 additions and 65 deletions

View File

@@ -68,10 +68,10 @@ namespace VAR.PdfTools.Workbench
{
PdfArray cropBox = page.BaseData.Values["CropBox"] as PdfArray;
lines.Add(string.Format("Page({0} of {1}): {2} {3} {4} {5}", pageNumber, doc.Pages.Count,
((PdfInteger)cropBox.Values[0]).Value,
((PdfInteger)cropBox.Values[1]).Value,
((PdfInteger)cropBox.Values[2]).Value,
((PdfInteger)cropBox.Values[3]).Value));
PdfElementUtils.GetReal(cropBox.Values[0], 0),
PdfElementUtils.GetReal(cropBox.Values[1], 0),
PdfElementUtils.GetReal(cropBox.Values[2], 0),
PdfElementUtils.GetReal(cropBox.Values[3], 0)));
}
else
{
@@ -82,8 +82,9 @@ namespace VAR.PdfTools.Workbench
PdfTextExtractor extractor = new PdfTextExtractor(page);
foreach (PdfTextElement textElement in extractor.Elements)
{
lines.Add(string.Format("Text({0}, {1})({2}): \"{3}\"",
textElement.Matrix.Matrix[0, 2], textElement.Matrix.Matrix[1, 2], textElement.VisibleWidth, textElement.VisibleText));
lines.Add(string.Format("Text({0}, {1})({2}, {3}): \"{4}\"",
textElement.Matrix.Matrix[0, 2], textElement.Matrix.Matrix[1, 2], textElement.VisibleWidth, textElement.VisibleHeight,
textElement.VisibleText));
}
}