diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5d075d3..92f743b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,16 +2,83 @@
All notable changes to this project will be documented in this file.
-## 1.0.4 -
+## [1.0.4] - 2022-08-04
-### Fixes
+### Added
+ 1. Add **TextLines** method to **PdfInput** class, for get the lines of text for an **PdfInput**, optionally you can set both the start and end pages and a value indicating whether blank lines are included in the result or uses a predicate for filtering
+
+ ```csharp
+ // Creates pdf file reference
+ var doc = new PdfInput
+ {
+ Input = "~/Resources/Sample-24/file-sample.pdf"
+ };
-### Added
+ // Extract text lines (Remove empty lines)
+ try
+ {
+ var textLines = doc.TextLines();
+
+ logger.Info(" > Document lines (Remove empty lines)");
+ logger.Info($" > Count: {textLines.Count()}");
+ }
+ catch
+ {
+ logger.Info(" > Error while extract text lines");
+ }
+
+ // Extract text lines (Include empty lines)
+ try
+ {
+ var textLines = doc.TextLines(removeEmptyLines: false);
+
+ logger.Info(" > Document lines (Include empty lines)");
+ logger.Info($" > Count: {textLines.Count()}");
+ }
+ catch
+ {
+ logger.Info(" > Error while extract text lines");
+ }
+ // Extract text lines (predicate)
+ try
+ {
+ var textLines = doc.TextLines(line => line.Text.Trim() == "#TITLE#");
+
+ logger.Info(" > Document lines (Predicate)");
+ logger.Info($" > Count: {textLines.Count()}");
+ }
+ catch
+ {
+ logger.Info(" > Error while extract text lines");
+ }
+ ```
### Changed
+ - Library versions for this version
+
+ | Library | Version | Description |
+ |:------|:------|:----------|
+ | iTin.Core | 2.0.0.4 | Base library containing various extensions, helpers, common constants |
+ | iTin.Core.Drawing | 1.0.0.2 | Drawing objects, extension, helpers, common constants |
+ | iTin.Core.Hardware.Common | 1.0.0.3 | Common Hardware Infrastructure |
+ | iTin.Core.Hardware.Linux.Devices.Graphics.Font | 1.0.0.0 | Linux Hardware Infrastructure |
+ | iTin.Core.Hardware.MacOS.Devices.Graphics.Font | 1.0.0.0 | MacOS Hardware Infrastructure |
+ | iTin.Core.Hardware.Windows.Devices.Graphics.Font | 1.0.0.0 | Windows Hardware Infrastructure |
+ | iTin.Core.IO | 1.0.0.2 | Common I/O calls |
+ | iTin.Core.IO.Compression | 1.0.0.2 | Compression library |
+ | iTin.Core.Interop.Shared | 1.0.0.2 | Generic Shared Interop Definitions |
+ | iTin.Core.Interop.Windows.Devices | 1.0.0.0 | Win32 Generic Interop Calls |
+ | iTin.Core.Models | 1.0.0.2 | Data models base |
+ | iTin.Core.Models.Design.Charting | 1.0.0.2 | Base charting models |
+ | iTin.Core.Models.Design.Styling | 1.0.0.2 | Base styling models |
+ | iTin.Logging | 1.0.0.1 | Logging library |
+ | iTin.Hardware.Abstractions.Devices.Graphics.Font | 1.0.0.0 | Generic Common Hardware Abstractions |
+ | iTin.Registry.Windows | 1.0.0.2 | Windows registry access |
+ | iTin.Utilities.Pdf.Design | **1.0.0.4** | Pdf design objects |
+ | iTin.Utilities.Pdf.Writer | **1.0.0.3** | Pdf Writer |
## [1.0.3] - 2022-08-03
diff --git a/README.txt b/README.txt
index dc925b0..b789fce 100644
--- a/README.txt
+++ b/README.txt
@@ -7,9 +7,55 @@ iPdfWriter is a lightweight implementation that allows modifying a pdf document
Changes in this version 1.0.4
=============================
-· Fixes
+· Added
-----
+ - Add TextLines method to PdfInput class for get the lines of text for an PdfInput, optionally you can set both the start and end pages and a value indicating whether blank lines are included in the result
+ or uses a predicate for filtering.
+
+
+· Changed
+ -------
+
+ •———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————•
+ | Library Version Description |
+ •———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————•
+ | iTin.Core 2.0.0.4 Base library containing various extensions, helpers, common constants |
+ •———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————•
+ | iTin.Core.Drawing 1.0.0.2 Drawing objects, extension, helpers, common constants |
+ •———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————•
+ | iTin.Core.Hardware.Common 1.0.0.3 Common Hardware Infrastructure |
+ •———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————•
+ | iTin.Core.Hardware.Linux.Devices.Graphics.Font 1.0.0.0 Linux Hardware Infrastructure |
+ •———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————•
+ | iTin.Core.Hardware.MacOS.Devices.Graphics.Font 1.0.0.0 MacOS Hardware Infrastructure |
+ •———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————•
+ | iTin.Core.Hardware.Windows.Devices.Graphics.Font 1.0.0.0 Windows Hardware Infrastructure |
+ •———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————•
+ | iTin.Core.IO 1.0.0.1 Common I/O calls |
+ •———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————•
+ | iTin.Core.IO.Compression 1.0.0.1 Compression library |
+ •———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————•
+ | iTin.Core.Interop.Shared 1.0.0.2 Generic Shared Interop Definitions |
+ •———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————•
+ | iTin.Core.Interop.Windows.Devices 1.0.0.0 Win32 Generic Interop Calls |
+ •———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————•
+ | iTin.Core.Models 1.0.0.2 Data models base |
+ •———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————•
+ | iTin.Core.Models.Design.Charting 1.0.0.2 Base charting models |
+ •———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————•
+ | iTin.Core.Models.Design.Styling 1.0.0.2 Base styling models |
+ •———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————•
+ | iTin.Logging 1.0.0.1 Logging library |
+ •———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————•
+ | iTin.Hardware.Abstractions.Devices.Graphics.Font 1.0.0.0 Generic Common Hardware Abstractions |
+ •———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————•
+ | iTin.Registry.Windows 1.0.0.2 Windows registry acces |
+ •———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————•
+ | iTin.Utilities.Pdf.Design 1.0.0.4 Pdf design elements |
+ •———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————•
+ | iTin.Utilities.Pdf.Writer 1.0.0.3 Pdf writer |
+ •———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————•
v1.0.3
======
diff --git a/src/lib/iTin.Utilities/iTin.Utilities.Pdf/iTin.Utilities.Pdf.Design/Text/PdfTextLine.cs b/src/lib/iTin.Utilities/iTin.Utilities.Pdf/iTin.Utilities.Pdf.Design/Text/PdfTextLine.cs
new file mode 100644
index 0000000..524e386
--- /dev/null
+++ b/src/lib/iTin.Utilities/iTin.Utilities.Pdf/iTin.Utilities.Pdf.Design/Text/PdfTextLine.cs
@@ -0,0 +1,62 @@
+
+namespace iTin.Utilities.Pdf.Design.Text
+{
+ ///
+ /// Defines a pdf text line object.
+ ///
+ public sealed class PdfTextLine
+ {
+ #region constructor/s
+
+ #region [private] PdfText(string, int): Initializes a new instance of the class with a native pdf table reference
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The text.
+ /// The page.
+ public PdfTextLine(string text, int page)
+ {
+ Text = text;
+ Page = page;
+ }
+ #endregion
+
+ #endregion
+
+ #region public properties
+
+ #region [public] (string) Text: Gets or sets the text
+ ///
+ /// Gets or sets the text.
+ ///
+ ///
+ /// The text.
+ ///
+ public string Text { get; set; }
+ #endregion
+
+ #region [public] (int) Page: Gets or sets the page
+ ///
+ /// Gets or sets the page.
+ ///
+ ///
+ /// The page.
+ ///
+ public int Page { get; set; }
+ #endregion
+
+ #endregion
+
+ #region public override methods
+
+ #region [public] {override} (string) ToString(): Returns a string than represents the current object.
+ ///
+ /// Returns a that represents this instance.
+ ///
+ /// A that represents this instance.
+ public override string ToString() => $"Text=\"{Text}\", Page={Page}";
+ #endregion
+
+ #endregion
+ }
+}
diff --git a/src/lib/iTin.Utilities/iTin.Utilities.Pdf/iTin.Utilities.Pdf.Design/iTin.Utilities.Pdf.Design.csproj b/src/lib/iTin.Utilities/iTin.Utilities.Pdf/iTin.Utilities.Pdf.Design/iTin.Utilities.Pdf.Design.csproj
index 00717d2..afaa2bb 100644
--- a/src/lib/iTin.Utilities/iTin.Utilities.Pdf/iTin.Utilities.Pdf.Design/iTin.Utilities.Pdf.Design.csproj
+++ b/src/lib/iTin.Utilities/iTin.Utilities.Pdf/iTin.Utilities.Pdf.Design/iTin.Utilities.Pdf.Design.csproj
@@ -5,7 +5,7 @@
true
true
Key.snk
- 1.0.0.3
+ 1.0.0.4
Pdf design elements
Copyright © 2020
diff --git a/src/lib/iTin.Utilities/iTin.Utilities.Pdf/iTin.Utilities.Pdf.Writer/ComponentModel/Input/Base/IInput.cs b/src/lib/iTin.Utilities/iTin.Utilities.Pdf/iTin.Utilities.Pdf.Writer/ComponentModel/Input/Base/IInput.cs
index 05e1319..3ec3a52 100644
--- a/src/lib/iTin.Utilities/iTin.Utilities.Pdf/iTin.Utilities.Pdf.Writer/ComponentModel/Input/Base/IInput.cs
+++ b/src/lib/iTin.Utilities/iTin.Utilities.Pdf/iTin.Utilities.Pdf.Writer/ComponentModel/Input/Base/IInput.cs
@@ -1,9 +1,12 @@
+using System;
+using System.Collections.Generic;
using System.IO;
using iTin.Core.ComponentModel;
using iTin.Core.ComponentModel.Results;
+using iTin.Utilities.Pdf.Design.Text;
using iTin.Utilities.Pdf.Writer.ComponentModel.Input;
using iTin.Utilities.Pdf.Writer.ComponentModel.Result.Insert;
using iTin.Utilities.Pdf.Writer.ComponentModel.Result.Output;
@@ -129,6 +132,27 @@ public interface IInput
///
IResult SaveToFile(string outputPath, SaveOptions options = null);
+ ///
+ /// Gets the lines of text for this , filtered values based on a predicate.
+ ///
+ /// A function to test each element for a condition.
+ ///
+ /// If document has no pages
+ /// If is
+ IEnumerable TextLines(Func predicate);
+
+ ///
+ /// Gets the lines of text for this , optionally you can set both the start and end pages and a value indicating whether blank lines are included in the result.
+ ///
+ /// Defines start page. If a value is not set, it will default to 1
+ /// Defines end page. If a value is not set, it will default to total document pages
+ /// Indicates whether blank lines are included in the result. By default they are not included
+ ///
+ /// If document has no pages
+ /// If is less than one or is greater than the total number of pages of the document
+ /// If is less than one or is greater than the total number of pages of the document
+ IEnumerable TextLines(int? fromPage = null, int? toPage = null, bool removeEmptyLines = true);
+
///
/// Convert this input into a stream object.
///
diff --git a/src/lib/iTin.Utilities/iTin.Utilities.Pdf/iTin.Utilities.Pdf.Writer/PdfInput.cs b/src/lib/iTin.Utilities/iTin.Utilities.Pdf/iTin.Utilities.Pdf.Writer/PdfInput.cs
index 6164af1..500d599 100644
--- a/src/lib/iTin.Utilities/iTin.Utilities.Pdf/iTin.Utilities.Pdf.Writer/PdfInput.cs
+++ b/src/lib/iTin.Utilities/iTin.Utilities.Pdf/iTin.Utilities.Pdf.Writer/PdfInput.cs
@@ -445,6 +445,9 @@ public PdfInput Clone()
///
/// A new instance of containing a document containing the specified pages.
///
+ /// If document has no pages
+ /// If is less than one or is greater than the total number of pages of the document
+ /// If is less than one or is greater than the total number of pages of the document
public PdfInput ExtractPages(int from, int? to = null)
{
using var reader = new NativePdf.PdfReader(this.ToStream());
@@ -453,10 +456,22 @@ public PdfInput ExtractPages(int from, int? to = null)
using var pdfCopyProvider = new NativePdf.PdfCopy(source, target);
source.Open();
+ var pages = reader.NumberOfPages;
+ if (pages == 0)
+ {
+ throw new ArgumentException("Document has not pages");
+ }
+
+ SentinelHelper.ArgumentOutOfRange(nameof(from), from, 1, pages);
+
var safeTo = to;
- if (!to.HasValue)
+ if (to.HasValue)
{
- safeTo = reader.NumberOfPages;
+ SentinelHelper.ArgumentOutOfRange(nameof(to), to.Value, 1, pages);
+ }
+ else
+ {
+ safeTo = pages;
}
for (var i = from; i <= safeTo; i++)
@@ -502,12 +517,12 @@ public IEnumerable SearchText(string text)
{
var matchs = new List();
- NativePdf.PdfReader pdfReader = new NativePdf.PdfReader(ToStream());
- int count = pdfReader.NumberOfPages;
- for (int page = 1; page <= count; page++)
+ var pdfReader = new NativePdf.PdfReader(ToStream());
+ var count = pdfReader.NumberOfPages;
+ for (var page = 1; page <= count; page++)
{
NativePdfParser.ITextExtractionStrategy strategy = new NativePdfParser.SimpleTextExtractionStrategy();
- string currentText = NativePdfParser.PdfTextExtractor.GetTextFromPage(pdfReader, page, strategy);
+ var currentText = NativePdfParser.PdfTextExtractor.GetTextFromPage(pdfReader, page, strategy);
currentText = Encoding.UTF8.GetString(Encoding.Convert(Encoding.Default, Encoding.UTF8, Encoding.Default.GetBytes(currentText)));
var absolutePosition = currentText.IndexOf(text, StringComparison.OrdinalIgnoreCase);
@@ -523,6 +538,132 @@ public IEnumerable SearchText(string text)
}
#endregion
+ #region [public] (IEnumerable) TextLines(int? = null, int? = null, bool = true): Gets the lines of text for this PdfInput
+ ///
+ /// Gets the lines of text for this , optionally you can set both the start and end pages and a value indicating whether blank lines are included in the result.
+ ///
+ /// Defines start page. If a value is not set, it will default to 1
+ /// Defines end page. If a value is not set, it will default to total document pages
+ /// Indicates whether blank lines are included in the result. By default they are not included
+ ///
+ /// If document has no pages
+ /// If is less than one or is greater than the total number of pages of the document
+ /// If is less than one or is greater than the total number of pages of the document
+ public IEnumerable TextLines(int? fromPage = null, int? toPage = null, bool removeEmptyLines = true)
+ {
+ var result = new List();
+
+ using var reader = new NativePdf.PdfReader(ToStream());
+ using var stamper = new NativePdf.PdfStamper(reader, new NativeIO.MemoryStream());
+ var pages = reader.NumberOfPages;
+
+ if (pages == 0)
+ {
+ throw new ArgumentException("Document has not pages");
+ }
+
+ var safeFrom = fromPage;
+ if (fromPage.HasValue)
+ {
+ SentinelHelper.ArgumentOutOfRange(nameof(fromPage), fromPage.Value, 1, pages);
+ }
+ else
+ {
+ safeFrom = 1;
+ }
+
+ var safeTo = toPage;
+ if (toPage.HasValue)
+ {
+ SentinelHelper.ArgumentOutOfRange(nameof(toPage), toPage.Value, 1, pages);
+ }
+ else
+ {
+ safeTo = pages;
+ }
+
+ for (var page = safeFrom; page <= safeTo; page++)
+ {
+ var currentPage = page.Value;
+ var strategy = new LocationTextExtractionStrategy();
+ var cb = stamper.GetOverContent(currentPage);
+
+ // Send some data contained in PdfContentByte, looks like the first is always cero for me and the second 100,
+ // but i'm not sure if this could change in some cases.
+ strategy.UndercontentCharacterSpacing = cb.CharacterSpacing;
+ strategy.UndercontentHorizontalScaling = cb.HorizontalScaling;
+
+ // It's not really needed to get the text back, but we have to call this line ALWAYS,
+ // because it triggers the process that will get all chunks from PDF into our strategy Object
+ var pageLines =
+ NativePdfParser.PdfTextExtractor.GetTextFromPage(reader, currentPage, strategy)
+ .Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries)
+ .Select(text => new PdfTextLine(text, currentPage));
+
+ if (removeEmptyLines)
+ {
+ pageLines = pageLines.Where(textLine => textLine.Text != " ");
+ }
+
+ result.AddRange(pageLines);
+ }
+
+ return result;
+ }
+
+ #endregion
+
+ #region [public] (IEnumerable) TextLines(Func): Gets the lines of text for this PdfInput, filtered values based on a predicate
+ ///
+ /// Gets the lines of text for this , filtered values based on a predicate.
+ ///
+ /// A function to test each element for a condition.
+ ///
+ /// If document has no pages
+ /// If is
+ public IEnumerable TextLines(Func predicate)
+ {
+ SentinelHelper.ArgumentNull(predicate, nameof(predicate));
+
+ var result = new List();
+
+ using var reader = new NativePdf.PdfReader(ToStream());
+ using var stamper = new NativePdf.PdfStamper(reader, new NativeIO.MemoryStream());
+
+ var pages = reader.NumberOfPages;
+ if (pages == 0)
+ {
+ throw new ArgumentException("Document has not pages");
+ }
+
+ for (var page = 1; page <= pages; page++)
+ {
+ var currePage = page;
+ var strategy = new LocationTextExtractionStrategy();
+ var cb = stamper.GetOverContent(currePage);
+
+ // Send some data contained in PdfContentByte, looks like the first is always cero for me and the second 100,
+ // but i'm not sure if this could change in some cases.
+ strategy.UndercontentCharacterSpacing = cb.CharacterSpacing;
+ strategy.UndercontentHorizontalScaling = cb.HorizontalScaling;
+
+ // It's not really needed to get the text back, but we have to call this line ALWAYS,
+ // because it triggers the process that will get all chunks from PDF into our strategy Object
+ var pageLines =
+ NativePdfParser.PdfTextExtractor.GetTextFromPage(reader, currePage, strategy)
+ .Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries)
+ .Select(text => new PdfTextLine(text, currePage));
+
+ pageLines = pageLines.Where(predicate);
+
+ result.AddRange(pageLines);
+ }
+
+ return result;
+ }
+
+ #endregion
+
#endregion
#region public override methods
diff --git a/src/lib/iTin.Utilities/iTin.Utilities.Pdf/iTin.Utilities.Pdf.Writer/iTin.Utilities.Pdf.Writer.csproj b/src/lib/iTin.Utilities/iTin.Utilities.Pdf/iTin.Utilities.Pdf.Writer/iTin.Utilities.Pdf.Writer.csproj
index c70050d..a550be0 100644
--- a/src/lib/iTin.Utilities/iTin.Utilities.Pdf/iTin.Utilities.Pdf.Writer/iTin.Utilities.Pdf.Writer.csproj
+++ b/src/lib/iTin.Utilities/iTin.Utilities.Pdf/iTin.Utilities.Pdf.Writer/iTin.Utilities.Pdf.Writer.csproj
@@ -5,7 +5,7 @@
true
Key.snk
true
- 1.0.0.2
+ 1.0.0.3
Pdf Writer
Copyright © 2020
diff --git a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Code/Sample23.cs b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Code/Sample23.cs
index 27ecae6..384763d 100644
--- a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Code/Sample23.cs
+++ b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Code/Sample23.cs
@@ -16,7 +16,7 @@ public static void Generate()
// Creates pdf file reference
var doc = new PdfInput
{
- Input = "~/Resources/Sample-22/file-sample.pdf"
+ Input = "~/Resources/Sample-23/file-sample.pdf"
};
// Extract pages and save result
diff --git a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Code/Sample24.cs b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Code/Sample24.cs
new file mode 100644
index 0000000..7a8c0e5
--- /dev/null
+++ b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Code/Sample24.cs
@@ -0,0 +1,64 @@
+
+using System.Linq;
+
+using iTin.Logging.ComponentModel;
+
+using iTin.Utilities.Pdf.Writer;
+
+namespace iPdfWriter.Code
+{
+ ///
+ /// Show how to extract text lines from a pdf document
+ ///
+ internal static class Sample24
+ {
+ // Generates partial document(s)
+ public static void Generate(ILogger logger)
+ {
+ // Creates pdf file reference
+ var doc = new PdfInput
+ {
+ Input = "~/Resources/Sample-24/file-sample.pdf"
+ };
+
+ // Extract text lines (Remove empty lines)
+ try
+ {
+ var textLines = doc.TextLines();
+
+ logger.Info(" > Document lines (Remove empty lines)");
+ logger.Info($" > Count: {textLines.Count()}");
+ }
+ catch
+ {
+ logger.Info(" > Error while extract text lines");
+ }
+
+ // Extract text lines (Include empty lines)
+ try
+ {
+ var textLines = doc.TextLines(removeEmptyLines: false);
+
+ logger.Info(" > Document lines (Include empty lines)");
+ logger.Info($" > Count: {textLines.Count()}");
+ }
+ catch
+ {
+ logger.Info(" > Error while extract text lines");
+ }
+
+ // Extract text lines (predicate)
+ try
+ {
+ var textLines = doc.TextLines(line => line.Text.Trim() == "#TITLE#");
+
+ logger.Info(" > Document lines (predicate)");
+ logger.Info($" > Count: {textLines.Count()}");
+ }
+ catch
+ {
+ logger.Info(" > Error while extract text lines");
+ }
+ }
+ }
+}
diff --git a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample01/Sample-01.pdf b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample01/Sample-01.pdf
index 7bf4532..aec3674 100644
Binary files a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample01/Sample-01.pdf and b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample01/Sample-01.pdf differ
diff --git a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample02/Sample-02.pdf b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample02/Sample-02.pdf
index f2ab01c..79d5b0d 100644
Binary files a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample02/Sample-02.pdf and b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample02/Sample-02.pdf differ
diff --git a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample03/Sample-03.pdf b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample03/Sample-03.pdf
index 0330e40..784a9f5 100644
Binary files a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample03/Sample-03.pdf and b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample03/Sample-03.pdf differ
diff --git a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample04/Sample-04.pdf b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample04/Sample-04.pdf
index 6ef21db..e94bc9c 100644
Binary files a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample04/Sample-04.pdf and b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample04/Sample-04.pdf differ
diff --git a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample05/Sample-05.pdf b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample05/Sample-05.pdf
index d37a663..8d7557b 100644
Binary files a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample05/Sample-05.pdf and b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample05/Sample-05.pdf differ
diff --git a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample06/Sample-06.pdf b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample06/Sample-06.pdf
index 0cfd3bf..0f5d92b 100644
Binary files a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample06/Sample-06.pdf and b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample06/Sample-06.pdf differ
diff --git a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample07/Sample-07.zip b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample07/Sample-07.zip
index 81d468d..186688c 100644
Binary files a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample07/Sample-07.zip and b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample07/Sample-07.zip differ
diff --git a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample08/Sample-08.zip b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample08/Sample-08.zip
index 9d0e8e5..746b642 100644
Binary files a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample08/Sample-08.zip and b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample08/Sample-08.zip differ
diff --git a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample09/Sample-09.zip b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample09/Sample-09.zip
index 93b11f6..e68342b 100644
Binary files a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample09/Sample-09.zip and b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample09/Sample-09.zip differ
diff --git a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample10/Sample-10.zip b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample10/Sample-10.zip
index cf4033d..48d2518 100644
Binary files a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample10/Sample-10.zip and b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample10/Sample-10.zip differ
diff --git a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample13/Sample-13.pdf b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample13/Sample-13.pdf
index 4558209..57b48e5 100644
Binary files a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample13/Sample-13.pdf and b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample13/Sample-13.pdf differ
diff --git a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample16/Sample-16.pdf b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample16/Sample-16.pdf
index abd0c40..2584f0a 100644
Binary files a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample16/Sample-16.pdf and b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample16/Sample-16.pdf differ
diff --git a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample18/Sample-18.pdf b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample18/Sample-18.pdf
index 4556b30..ed832d4 100644
Binary files a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample18/Sample-18.pdf and b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample18/Sample-18.pdf differ
diff --git a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample20/Sample-20.pdf b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample20/Sample-20.pdf
index be261a0..743ca46 100644
Binary files a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample20/Sample-20.pdf and b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample20/Sample-20.pdf differ
diff --git a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample21/Sample-21.pdf b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample21/Sample-21.pdf
index 9492bdd..95ab4bc 100644
Binary files a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample21/Sample-21.pdf and b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample21/Sample-21.pdf differ
diff --git a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample22/Sample-22.pdf b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample22/Sample-22.pdf
index 878a8ec..a719210 100644
Binary files a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample22/Sample-22.pdf and b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample22/Sample-22.pdf differ
diff --git a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample23/Sample-23-1.pdf b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample23/Sample-23-1.pdf
index 746df27..eb1cc90 100644
Binary files a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample23/Sample-23-1.pdf and b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Output/Sample23/Sample-23-1.pdf differ
diff --git a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Program.cs b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Program.cs
index b3c92aa..5e12460 100644
--- a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Program.cs
+++ b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Program.cs
@@ -140,6 +140,12 @@ static void Main(string[] args)
logger.Info(" > Show how to extract pages from a pdf document by search text");
Sample23.Generate();
+ // 24.Show how to extract text lines from a pdf document
+ logger.Info("");
+ logger.Info("> Start Pdf Sample 24");
+ logger.Info(" > Show how to extract text lines from a pdf document");
+ Sample24.Generate(logger);
+
logger.Info("");
logger.Debug(">End Logging<");
Console.ReadKey();
diff --git a/src/test/FullFramework/iPdfWriter.ConsoleApp472/Resources/Sample-24/file-sample.pdf b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Resources/Sample-24/file-sample.pdf
new file mode 100644
index 0000000..d8e568c
Binary files /dev/null and b/src/test/FullFramework/iPdfWriter.ConsoleApp472/Resources/Sample-24/file-sample.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Code/Sample23.cs b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Code/Sample23.cs
index c05df56..2639ce7 100644
--- a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Code/Sample23.cs
+++ b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Code/Sample23.cs
@@ -17,7 +17,7 @@ public static void Generate()
// Creates pdf file reference
var doc = new PdfInput
{
- Input = "~/Resources/Sample-22/file-sample.pdf"
+ Input = "~/Resources/Sample-23/file-sample.pdf"
};
// Extract pages and save result
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Code/Sample24.cs b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Code/Sample24.cs
new file mode 100644
index 0000000..7a8c0e5
--- /dev/null
+++ b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Code/Sample24.cs
@@ -0,0 +1,64 @@
+
+using System.Linq;
+
+using iTin.Logging.ComponentModel;
+
+using iTin.Utilities.Pdf.Writer;
+
+namespace iPdfWriter.Code
+{
+ ///
+ /// Show how to extract text lines from a pdf document
+ ///
+ internal static class Sample24
+ {
+ // Generates partial document(s)
+ public static void Generate(ILogger logger)
+ {
+ // Creates pdf file reference
+ var doc = new PdfInput
+ {
+ Input = "~/Resources/Sample-24/file-sample.pdf"
+ };
+
+ // Extract text lines (Remove empty lines)
+ try
+ {
+ var textLines = doc.TextLines();
+
+ logger.Info(" > Document lines (Remove empty lines)");
+ logger.Info($" > Count: {textLines.Count()}");
+ }
+ catch
+ {
+ logger.Info(" > Error while extract text lines");
+ }
+
+ // Extract text lines (Include empty lines)
+ try
+ {
+ var textLines = doc.TextLines(removeEmptyLines: false);
+
+ logger.Info(" > Document lines (Include empty lines)");
+ logger.Info($" > Count: {textLines.Count()}");
+ }
+ catch
+ {
+ logger.Info(" > Error while extract text lines");
+ }
+
+ // Extract text lines (predicate)
+ try
+ {
+ var textLines = doc.TextLines(line => line.Text.Trim() == "#TITLE#");
+
+ logger.Info(" > Document lines (predicate)");
+ logger.Info($" > Count: {textLines.Count()}");
+ }
+ catch
+ {
+ logger.Info(" > Error while extract text lines");
+ }
+ }
+ }
+}
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample01/Sample-01.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample01/Sample-01.pdf
index 158bf92..5f015ff 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample01/Sample-01.pdf and b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample01/Sample-01.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample02/Sample-02.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample02/Sample-02.pdf
index c41d188..309ae03 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample02/Sample-02.pdf and b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample02/Sample-02.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample03/Sample-03.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample03/Sample-03.pdf
index 9698fb7..22d43f0 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample03/Sample-03.pdf and b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample03/Sample-03.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample04/Sample-04.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample04/Sample-04.pdf
index 801cd75..38bd36a 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample04/Sample-04.pdf and b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample04/Sample-04.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample05/Sample-05.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample05/Sample-05.pdf
index 0f0ba72..d098c50 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample05/Sample-05.pdf and b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample05/Sample-05.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample06/Sample-06.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample06/Sample-06.pdf
index f927f95..a0e9a03 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample06/Sample-06.pdf and b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample06/Sample-06.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample07/Sample-07.zip b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample07/Sample-07.zip
index 54ffdc8..f8a9cd6 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample07/Sample-07.zip and b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample07/Sample-07.zip differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample08/Sample-08.zip b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample08/Sample-08.zip
index f89c42d..d4831f2 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample08/Sample-08.zip and b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample08/Sample-08.zip differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample09/Sample-09.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample09/Sample-09.pdf
index a7caf0a..dc7b581 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample09/Sample-09.pdf and b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample09/Sample-09.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample10/Sample-10.zip b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample10/Sample-10.zip
index 74f9b1b..bc9ad8c 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample10/Sample-10.zip and b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample10/Sample-10.zip differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample13/Sample-13.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample13/Sample-13.pdf
index 53b7c62..5749a8e 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample13/Sample-13.pdf and b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample13/Sample-13.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample16/Sample-16.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample16/Sample-16.pdf
index 7709ad4..f0fdbcc 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample16/Sample-16.pdf and b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample16/Sample-16.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample18/Sample-18.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample18/Sample-18.pdf
index c587304..355f87c 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample18/Sample-18.pdf and b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample18/Sample-18.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample20/Sample-20.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample20/Sample-20.pdf
index 6b8556a..7dd784b 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample20/Sample-20.pdf and b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample20/Sample-20.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample21/Sample-21.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample21/Sample-21.pdf
index 7e797d7..f3bebc2 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample21/Sample-21.pdf and b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample21/Sample-21.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample22/Sample-22.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample22/Sample-22.pdf
index 398987b..7871e1f 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample22/Sample-22.pdf and b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample22/Sample-22.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample23/Sample-23-1.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample23/Sample-23-1.pdf
index 9e2eb76..3f7c1da 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample23/Sample-23-1.pdf and b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Output/Sample23/Sample-23-1.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Program.cs b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Program.cs
index b3c92aa..5e12460 100644
--- a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Program.cs
+++ b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Program.cs
@@ -140,6 +140,12 @@ static void Main(string[] args)
logger.Info(" > Show how to extract pages from a pdf document by search text");
Sample23.Generate();
+ // 24.Show how to extract text lines from a pdf document
+ logger.Info("");
+ logger.Info("> Start Pdf Sample 24");
+ logger.Info(" > Show how to extract text lines from a pdf document");
+ Sample24.Generate(logger);
+
logger.Info("");
logger.Debug(">End Logging<");
Console.ReadKey();
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Resources/Sample-24/file-sample.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Resources/Sample-24/file-sample.pdf
new file mode 100644
index 0000000..d8e568c
Binary files /dev/null and b/src/test/NetCore/iPdfWriter.ConsoleAppCore31/Resources/Sample-24/file-sample.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Code/Sample22.cs b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Code/Sample22.cs
index 605e79f..4f4e61b 100644
--- a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Code/Sample22.cs
+++ b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Code/Sample22.cs
@@ -36,7 +36,7 @@ public static void Generate(ILogger logger)
#region Extract pages
var partialInput = doc.ExtractPages(1, 2);
-
+
#endregion
#region Create output result
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Code/Sample23.cs b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Code/Sample23.cs
index f3db873..cbae2d1 100644
--- a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Code/Sample23.cs
+++ b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Code/Sample23.cs
@@ -15,7 +15,7 @@ public static void Generate()
// Creates pdf file reference
var doc = new PdfInput
{
- Input = "~/Resources/Sample-22/file-sample.pdf"
+ Input = "~/Resources/Sample-23/file-sample.pdf"
};
// Extract pages and save result
@@ -25,7 +25,7 @@ public static void Generate()
for (var i = 0; i < matchesCount; i++)
{
var currentMatch = matches[i];
- int? to = currentMatch.Page; ;
+ int? to = currentMatch.Page;
var hasNextMatch = i != matchesCount - 1;
if (hasNextMatch)
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Code/Sample24.cs b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Code/Sample24.cs
new file mode 100644
index 0000000..6c5e97f
--- /dev/null
+++ b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Code/Sample24.cs
@@ -0,0 +1,62 @@
+
+using iTin.Logging.ComponentModel;
+
+using iTin.Utilities.Pdf.Writer;
+
+namespace iPdfWriter.Code
+{
+ ///
+ /// Show how to extract text lines from a pdf document
+ ///
+ internal static class Sample24
+ {
+ // Generates partial document(s)
+ public static void Generate(ILogger logger)
+ {
+ // Creates pdf file reference
+ var doc = new PdfInput
+ {
+ Input = "~/Resources/Sample-24/file-sample.pdf"
+ };
+
+ // Extract text lines (Remove empty lines)
+ try
+ {
+ var textLines = doc.TextLines();
+
+ logger.Info(" > Document lines (Remove empty lines)");
+ logger.Info($" > Count: {textLines.Count()}");
+ }
+ catch
+ {
+ logger.Info(" > Error while extract text lines");
+ }
+
+ // Extract text lines (Include empty lines)
+ try
+ {
+ var textLines = doc.TextLines(removeEmptyLines: false);
+
+ logger.Info(" > Document lines (Include empty lines)");
+ logger.Info($" > Count: {textLines.Count()}");
+ }
+ catch
+ {
+ logger.Info(" > Error while extract text lines");
+ }
+
+ // Extract text lines (predicate)
+ try
+ {
+ var textLines = doc.TextLines(line => line.Text.Trim() == "#TITLE#");
+
+ logger.Info(" > Document lines (predicate)");
+ logger.Info($" > Count: {textLines.Count()}");
+ }
+ catch
+ {
+ logger.Info(" > Error while extract text lines");
+ }
+ }
+ }
+}
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample01/Sample-01.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample01/Sample-01.pdf
index bd960d5..998c51f 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample01/Sample-01.pdf and b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample01/Sample-01.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample02/Sample-02.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample02/Sample-02.pdf
index 954787e..4fa37df 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample02/Sample-02.pdf and b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample02/Sample-02.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample03/Sample-03.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample03/Sample-03.pdf
index b4fbe11..6a41478 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample03/Sample-03.pdf and b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample03/Sample-03.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample04/Sample-04.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample04/Sample-04.pdf
index 56ca357..6fda52e 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample04/Sample-04.pdf and b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample04/Sample-04.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample05/Sample-05.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample05/Sample-05.pdf
index 8ae2323..8ca32bd 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample05/Sample-05.pdf and b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample05/Sample-05.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample06/Sample-06.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample06/Sample-06.pdf
index fe4bd0a..24d416a 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample06/Sample-06.pdf and b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample06/Sample-06.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample07/Sample-07.zip b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample07/Sample-07.zip
index 2cfccee..aec2a18 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample07/Sample-07.zip and b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample07/Sample-07.zip differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample08/Sample-08.zip b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample08/Sample-08.zip
index 939a8f7..0e1af64 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample08/Sample-08.zip and b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample08/Sample-08.zip differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample09/Sample-09.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample09/Sample-09.pdf
index 730e2aa..dcea4bf 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample09/Sample-09.pdf and b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample09/Sample-09.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample10/Sample-10.zip b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample10/Sample-10.zip
index eb39b40..36fcc5c 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample10/Sample-10.zip and b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample10/Sample-10.zip differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample13/Sample-13.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample13/Sample-13.pdf
index f36fc2d..44b06ab 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample13/Sample-13.pdf and b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample13/Sample-13.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample16/Sample-16.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample16/Sample-16.pdf
index 0300648..09fb152 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample16/Sample-16.pdf and b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample16/Sample-16.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample17/Sample-17.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample17/Sample-17.pdf
new file mode 100644
index 0000000..a325845
Binary files /dev/null and b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample17/Sample-17.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample18/Sample-18.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample18/Sample-18.pdf
index f3a4be3..c58fd7e 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample18/Sample-18.pdf and b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample18/Sample-18.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample19/Sample-19.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample19/Sample-19.pdf
new file mode 100644
index 0000000..8fadc48
Binary files /dev/null and b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample19/Sample-19.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample20/Sample-20.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample20/Sample-20.pdf
index dd65b3c..700d4b0 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample20/Sample-20.pdf and b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample20/Sample-20.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample21/Sample-21.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample21/Sample-21.pdf
index f5a106e..7bec08d 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample21/Sample-21.pdf and b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample21/Sample-21.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample22/Sample-22.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample22/Sample-22.pdf
index a4b88e4..8b4ec21 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample22/Sample-22.pdf and b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample22/Sample-22.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample23/Sample-23-1.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample23/Sample-23-1.pdf
index 54885cd..624f43d 100644
Binary files a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample23/Sample-23-1.pdf and b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Output/Sample23/Sample-23-1.pdf differ
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Program.cs b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Program.cs
index 59a7b73..b014ad7 100644
--- a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Program.cs
+++ b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Program.cs
@@ -96,11 +96,11 @@ static void Main(string[] args)
logger.Info(" > Shows the use of add an enumerable (render as html) in a pdf document.");
Sample16.Generate(logger, YesNo.No);
- // 17. Shows the use of add an enumerable (native render) in a pdf document.
- logger.Info("");
- logger.Info("> Start Pdf Sample 17");
- logger.Info(" > Shows the use of add an enumerable (native render) in a pdf document.");
- Sample17.Generate(logger, YesNo.No);
+ //// 17. Shows the use of add an enumerable (native render) in a pdf document.
+ //logger.Info("");
+ //logger.Info("> Start Pdf Sample 17");
+ //logger.Info(" > Shows the use of add an enumerable (native render) in a pdf document.");
+ //Sample17.Generate(logger, YesNo.No);
// 18. Shows the use of add a datatable (render as html) in a pdf document.
logger.Info("");
@@ -108,11 +108,11 @@ static void Main(string[] args)
logger.Info(" > Shows the use of add a datatable (render as html) in a pdf document.");
Sample18.Generate(logger, YesNo.No);
- // 19. Shows the use of add a datatable (native render) in a pdf document.
- logger.Info("");
- logger.Info("> Start Pdf Sample 19");
- logger.Info(" > Shows the use of add a datatable (native render) in a pdf document.");
- Sample19.Generate(logger, YesNo.No);
+ //// 19. Shows the use of add a datatable (native render) in a pdf document.
+ //logger.Info("");
+ //logger.Info("> Start Pdf Sample 19");
+ //logger.Info(" > Shows the use of add a datatable (native render) in a pdf document.");
+ //Sample19.Generate(logger, YesNo.No);
// 20. Shows the use of add a datatable in a pdf document.
logger.Info("");
@@ -138,6 +138,12 @@ static void Main(string[] args)
logger.Info(" > Show how to extract pages from a pdf document by search text");
Sample23.Generate();
+ // 24.Show how to extract text lines from a pdf document
+ logger.Info("");
+ logger.Info("> Start Pdf Sample 24");
+ logger.Info(" > Show how to extract text lines from a pdf document");
+ Sample24.Generate(logger);
+
logger.Info("");
logger.Debug(">End Logging<");
Console.ReadKey();
diff --git a/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Resources/Sample-24/file-sample.pdf b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Resources/Sample-24/file-sample.pdf
new file mode 100644
index 0000000..d8e568c
Binary files /dev/null and b/src/test/NetCore/iPdfWriter.ConsoleAppCore60/Resources/Sample-24/file-sample.pdf differ