mirror of
https://github.com/UglyToad/PdfPig.git
synced 2026-01-18 19:51:24 +08:00
visible text, the presence of images and the presence of paths. Certain combinations thereof potentially must be run through OCR.
25 lines
846 B
C#
25 lines
846 B
C#
namespace UglyToad.PdfPig.Tests.Integration
|
|
{
|
|
using PdfPig.Core;
|
|
using Xunit;
|
|
|
|
public class PageContentTests
|
|
{
|
|
[Fact]
|
|
public void DetectPageContents()
|
|
{
|
|
var file = IntegrationHelpers.GetDocumentPath("Various Content Types");
|
|
|
|
using (var document = PdfDocument.Open(file, ParsingOptions.LenientParsingOff))
|
|
{
|
|
var page = document.GetPage(1);
|
|
var letters = page.Letters;
|
|
Assert.Contains(letters, l => l.RenderingMode == TextRenderingMode.Stroke); // "REGULAR TEXT"
|
|
Assert.Contains(letters, l => l.RenderingMode == TextRenderingMode.Neither); // "INVISIBLE TEXT"
|
|
Assert.NotEmpty(page.Content.GetImages());
|
|
Assert.NotEmpty(page.Content.Paths);
|
|
}
|
|
}
|
|
}
|
|
}
|