From ed03166f6fad42376248aaa19dcee6288fc8a8d5 Mon Sep 17 00:00:00 2001 From: "Valeriano A.R" Date: Fri, 24 Jun 2016 15:35:08 +0200 Subject: [PATCH] PdfFont: Keep font name --- VAR.PdfTools.Workbench/FrmPdfInfo.cs | 5 +++-- VAR.PdfTools/PdfDocumentPage.cs | 1 + VAR.PdfTools/PdfFont.cs | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/VAR.PdfTools.Workbench/FrmPdfInfo.cs b/VAR.PdfTools.Workbench/FrmPdfInfo.cs index 49d4f88..7fb2c8f 100644 --- a/VAR.PdfTools.Workbench/FrmPdfInfo.cs +++ b/VAR.PdfTools.Workbench/FrmPdfInfo.cs @@ -85,8 +85,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}): \"{4}\"", - textElement.Matrix.Matrix[0, 2], textElement.Matrix.Matrix[1, 2], textElement.VisibleWidth, textElement.VisibleHeight, + lines.Add(string.Format("Text({0}, {1})({2}, {3})[{4}]: \"{5}\"", + textElement.Matrix.Matrix[0, 2], textElement.Matrix.Matrix[1, 2], textElement.VisibleWidth, textElement.VisibleHeight, + textElement.Font == null ? string.Empty : textElement.Font.Name, textElement.VisibleText)); } } diff --git a/VAR.PdfTools/PdfDocumentPage.cs b/VAR.PdfTools/PdfDocumentPage.cs index bc80c1a..8b0198c 100644 --- a/VAR.PdfTools/PdfDocumentPage.cs +++ b/VAR.PdfTools/PdfDocumentPage.cs @@ -58,6 +58,7 @@ namespace VAR.PdfTools foreach (KeyValuePair pair in fonts.Values) { var font = new PdfFont(pair.Value as PdfDictionary); + font.Name = pair.Key; _fonts.Add(pair.Key, font); } } diff --git a/VAR.PdfTools/PdfFont.cs b/VAR.PdfTools/PdfFont.cs index c55af25..d92d653 100644 --- a/VAR.PdfTools/PdfFont.cs +++ b/VAR.PdfTools/PdfFont.cs @@ -15,6 +15,8 @@ namespace VAR.PdfTools private double _height = 1.0; + private string _name = string.Empty; + private bool _tainted = false; #endregion @@ -25,6 +27,8 @@ namespace VAR.PdfTools public double Height { get { return _height; } } + public string Name { get { return _name; } set { _name = value; } } + public bool Tainted { get { return _tainted; } } #endregion