mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-09-20 20:07:57 +08:00
#57 add access to document metadata and expose wrapper type
This commit is contained in:
@@ -20,12 +20,11 @@
|
||||
Assert.Contains("catus", page.Text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
[Fact]
|
||||
public void CanGetAnnotations()
|
||||
{
|
||||
using (var document = PdfDocument.Open(GetFilename(), new ParsingOptions { UseLenientParsing = false }))
|
||||
using (var document = PdfDocument.Open(GetFilename(), ParsingOptions.LenientParsingOff))
|
||||
{
|
||||
var page = document.GetPage(1);
|
||||
|
||||
|
@@ -4,6 +4,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using PdfPig.Util;
|
||||
using Xunit;
|
||||
|
||||
public class LaTexTests
|
||||
@@ -16,7 +17,7 @@
|
||||
[Fact]
|
||||
public void CanReadContent()
|
||||
{
|
||||
using (var document = PdfDocument.Open(GetFilename()))
|
||||
using (var document = PdfDocument.Open(GetFilename(), ParsingOptions.LenientParsingOff))
|
||||
{
|
||||
var page = document.GetPage(1);
|
||||
|
||||
@@ -125,6 +126,25 @@ used per estimate, we introduce a “complement class”
Naive Bayes is often us
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CanGetMetadata()
|
||||
{
|
||||
using (var document = PdfDocument.Open(GetFilename(), ParsingOptions.LenientParsingOff))
|
||||
{
|
||||
var hasMetadata = document.TryGetXmpMetadata(out var metadata);
|
||||
|
||||
Assert.True(hasMetadata);
|
||||
|
||||
var xDocument = metadata.GetXDocument();
|
||||
|
||||
Assert.NotNull(xDocument);
|
||||
|
||||
var text = OtherEncodings.BytesAsLatin1String(metadata.GetXmlBytes().ToArray());
|
||||
|
||||
Assert.StartsWith("<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'", text);
|
||||
}
|
||||
}
|
||||
|
||||
private static IReadOnlyList<AssertablePositionData> GetPdfBoxPositionData()
|
||||
{
|
||||
|
Reference in New Issue
Block a user