change the itext document test to reflect its text being form content. fix readme typo

This commit is contained in:
Eliot Jones
2018-01-03 19:13:12 +00:00
parent 7a28b05372
commit bfdca3079f
5 changed files with 20 additions and 6 deletions

View File

@@ -39,7 +39,7 @@ The ```Page``` contains the page width and height in points as well as mapping t
PageSize size = Page.Size;
bool sA4 = size == PageSize.A4;
bool isA4 = size == PageSize.A4;
The ```PdfDocument``` will also support opening from byte arrays (as well as streams eventually):

View File

@@ -5,13 +5,13 @@
using Content;
using Xunit;
public class SinglePageSimpleIText1Tests
public class SinglePageFormContentIText1Tests
{
private static string GetFilename()
{
var documentFolder = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..", "..", "..", "Integration", "Documents"));
return Path.Combine(documentFolder, "Single Page Simple - from itext 1_1.pdf");
return Path.Combine(documentFolder, "Single Page Form Content - from itext 1_1.pdf");
}
[Fact]
@@ -35,5 +35,16 @@
Assert.Equal(PageSize.A4, page.Size);
}
}
[Fact]
public void DoesNotExtractText()
{
using (var document = PdfDocument.Open(GetFilename()))
{
var page = document.GetPage(1);
Assert.Empty(page.Letters);
}
}
}
}

View File

@@ -12,9 +12,9 @@
<None Remove="Fonts\TrueType\Roboto-Regular.ttf" />
<None Remove="Integration\Documents\Font Size Test - from google chrome print pdf.pdf" />
<None Remove="Integration\Documents\Font Size Test - from libre office.pdf" />
<None Remove="Integration\Documents\Single Page Form Content - from itext 1_1.pdf" />
<None Remove="Integration\Documents\Single Page Non Latin - from acrobat distiller.pdf" />
<None Remove="Integration\Documents\Single Page Simple - from google drive.pdf" />
<None Remove="Integration\Documents\Single Page Simple - from itext 1_1.pdf" />
<None Remove="Integration\Documents\Single Page Simple - from open office.pdf" />
</ItemGroup>
@@ -37,7 +37,7 @@
<Content Include="Integration\Documents\Single Page Simple - from google drive.pdf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Integration\Documents\Single Page Simple - from itext 1_1.pdf">
<Content Include="Integration\Documents\Single Page Form Content - from itext 1_1.pdf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Integration\Documents\Single Page Simple - from open office.pdf">

View File

@@ -8,6 +8,7 @@
using Geometry;
using Graphics;
using IO;
using Util;
internal class PageFactory : IPageFactory
{
@@ -60,7 +61,9 @@
}
var contents = contentStream.Decode(filterProvider);
var txt = OtherEncodings.BytesAsLatin1String(contents);
var operations = pageContentParser.Parse(new ByteArrayInputBytes(contents));
var context = new ContentStreamProcessor(cropBox.Bounds, resourceStore, userSpaceUnit);